In order to provide bit-accurate simulation of hardware, HDL blocks operate on Boolean, floating-point, and arbitrary precision fixed-point values. By contrast, the fundamental scalar signal type in Simulink® is double precision floating point. The gateway blocks in the Model Composer HDL library allow connection between HDL blocks in the AMD toolbox and blocks in the Simulink library. The Gateway In converts a double precision signal into an AMD signal, and the Gateway Out converts an AMD signal into double precision. Simulink® continuous time signals must be sampled by the Gateway In block.
Most HDL blocks are polymorphic (that is, they can deduce appropriate output types based on their input types). When full precision is specified for a block in its parameters dialog box, Model Composer chooses the output type to ensure no precision is lost. Sign extension and zero padding occur automatically as necessary. User-specified precision is usually also available. This allows you to set the output type for a block and to specify how quantization and overflow should be handled. Quantization possibilities include unbiased rounding towards plus or minus infinity, depending on sign, or truncation. Overflow options include saturation, truncation, and reporting overflow as an error.
Fix_11_9
, then the signal is a two's complement signed 11-bit
number having nine fractional bits. Similarly, if the type is Ufix_5_3
,
then the signal is an unsigned 5-bit number having three fractional bits.In the Model Composer portion of a Simulink model, every signal must be sampled. Sample times can be inherited using Simulink's propagation rules, or set explicitly in a block customization dialog box. When there are feedback loops, Model Composer is sometimes unable to deduce sample periods and/or signal types, in which case the tool issues an error message. Assert blocks must be inserted into loops to address this problem. It is not necessary to add assert blocks at every point in a loop; usually it suffices to add an assert block at one point to “break” the loop.