cucapra/dahlia

Remove fixed point constants from Dahlia.

Closed this issue · 0 comments

Part of Calyx #470.

from dahlia/FutilBackend.scala:

  case ECast(ERational(d), typ) => {
    val _ = rhsInfo
    val (width, Some(int_bit)) = bitsForType(Some(typ), expr.pos)
    val frac_bit = width - int_bit
    val lst = d.split('.')
    val v_1 = lst(0).toInt
    val v_2 = lst(1).toInt
    val fpconst =
      Cell(
        genName("fpconst"),
        Stdlib.fixed_point(width, int_bit, frac_bit, v_1, v_2),
        false
      )
    EmitOutput(
      fpconst.id.port("out"),
      ConstantPort(1, 1),
      List(fpconst),
      Some(0)
    )
  }

This will be the one place that fixed point constants are dependent on. We’ll have to instead re-interpret v_1 and v_2 accordingly (taking into account signedness).

It can then be removed from here as well. This will break the test here, which should instead use a std_const.