Compilation
Elaboration
Wildcard Arithmetic Value Checking
When arithmetic operations involve wildcard Int values (Scala Int or DFHDL Int parameters), the wildcard Int value adapts to the bit-accurate value's sign and width. The value is then checked to ensure it fits. This check occurs at three levels, depending on when the value becomes known:
-
Scala compile-time -- Literal Scala integers (e.g.,
u8 + 1000) have known values at compile time. The Scala compiler reports an error immediately if the wildcardIntvalue exceeds the bit-accurate value's range or has incompatible sign. -
DFHDL elaboration-time -- Non-literal Scala integers (e.g.,
val x: Int = computeValue(); u8 + x) and DFHDLIntconstants whose values are resolved during elaboration. A DFHDL elaboration error (Scala runtime error) is generated if the value does not fit. -
Synthesis/simulation-time -- DFHDL
Intparameters that are set externally or computed in complex generation loops may not be known until synthesis or simulation. Assertions must be added to verify these values at the target platform level. This is a planned future feature (TODO).