MATLAB: Is there a delay in the output of the HDL Cosimulation block when using Simulink HDL Coder 1.5 (R2009a)

HDL Coder

I run a model where I compare the results between a simulation and HDL Cosimulation. There appears to be a unit time step delay in the HDL results.

Best Answer

This enhancement has been incorporated in Release 2010a (R2010a). For previous product releases, read below for any possible workarounds:
The HDL Cosimulation block introduces a unit step delay. This occurs because the block does not support direct feedthrough. In blocks that do support this, the output is controlled directly by the value of an input port. In situations where this is not possible, a block's output may be delayed by one computation step.
As a workaround, you can introduce unit delays in signals that are to be compared with the HDL cosimulation block's output using the unit delay block.