subtypeConstructorMap property

Map<({int exponentWidth, int mantissaWidth}), FloatingPointValue Function({required LogicValue exponent, required LogicValue mantissa, required LogicValue sign})> subtypeConstructorMap
getter/setter pair

A mapping from a ({exponentWidth, mantissaWidth}) record to a constructor for a specific FloatingPointValue subtype. This map is used by the FloatingPointValue.withMappedSubtype constructor to select the appropriate constructor for a given set of widths.

By default, this is populated with available subtypes from ROHD-HCL, but it can be overridden or extended based on the user's needs.

Implementation

static Map<
    ({int exponentWidth, int mantissaWidth}),
    FloatingPointValue Function(
        {required LogicValue sign,
        required LogicValue exponent,
        required LogicValue mantissa})> subtypeConstructorMap = {
  (
    exponentWidth: FloatingPoint32Value.exponentWidth,
    mantissaWidth: FloatingPoint32Value.mantissaWidth
  ): FloatingPoint32Value.new,
  (
    exponentWidth: FloatingPoint64Value.exponentWidth,
    mantissaWidth: FloatingPoint64Value.mantissaWidth
  ): FloatingPoint64Value.new,
  (exponentWidth: 4, mantissaWidth: 3): FloatingPoint8E4M3Value.new,
  (exponentWidth: 5, mantissaWidth: 2): FloatingPoint8E5M2Value.new,
  (exponentWidth: 5, mantissaWidth: 10): FloatingPoint16Value.new,
  (exponentWidth: 8, mantissaWidth: 7): FloatingPointBF16Value.new,
  (exponentWidth: 8, mantissaWidth: 10): FloatingPointTF32Value.new,
};