fromIntegral package:clash-prelude

general coercion from integral types
Like fromIntegral, but errors if a is out of bounds for b. Useful when you "know" a can't be out of bounds, but would like to have your assumptions checked.
  • NB: Check only affects simulation. I.e., no checks will be inserted into the generated HDL
  • NB: fromIntegral is not well suited for Clash as it will go through Integer which is arbitrarily bounded in HDL. Instead use bitCoerce and the Resize class.