1

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.

FabienM
  • 3,421
  • 23
  • 45
Soham
  • 11
  • 1
  • It seems to not be implemented yet : https://github.com/chipsalliance/chisel3/blob/v3.5.3/core/src/main/scala/chisel3/Bits.scala#L1495 – FabienM Aug 05 '22 at 06:25
  • While using this, it is throwing this: not found: value throwException [error] throwException(s"division is illegal on FixedPoint types") Code: 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)) }) override def do_/(that: FixedPoint)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): FixedPoint = throwException(s"division is illegal on FixedPoint types") io.p := io.a + io.b / 6.0.F(0.BP) } – Soham Aug 05 '22 at 16:14

1 Answers1

0

It's simply not possible with FixedPoint.

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

FabienM
  • 3,421
  • 23
  • 45