How to overcome fixedpoint division problem in chisel3?

118 Views Asked by At

When I am running a code for testing in fixedpoint, I am getting an error. Can anyone help me with the code??? Code:

    import chisel3._
    import chisel3.util._
    import chisel3.experimental.FixedPoint
    import chisel3.internal.ChiselException

    import scala.language.experimental.macros

    class FPMul extends Module {
        val io = IO(new Bundle {
            val a = Input(FixedPoint(4.W, 2.BP))
            val b = Input(FixedPoint(4.W, 2.BP))
            val p = Output(FixedPoint(8.W, 2.BP))
        })

        io.p := io.a + io.b / 6.0.F(0.BP)
    }

Error:

#### chisel3.internal.ChiselException: division is illegal on FixedPoint types**

Your help is highly appreciated.

1

There are 1 best solutions below

0
On

It's simply not possible with FixedPoint.

As Jack explained it, if you want to do division, you will need to implement it yourself.