HDL coder Fixed-Point and Stimulus-Signal

1 view (last 30 days)
Nam Tran
Nam Tran on 7 Mar 2013
I am new to HDL-coder feature in Simulink. I have some questions regarding to the workflow of design using HDL-Coder:
  1. I have a transfer function in Lapace, do i have to transform it into Z-Space?
  2. Does the specified sample time have to be given in every single blocks, or only the (1/z)-Block is enough?
  3. After the conversion to fixed point, there is a problem with the data format. My subsystem has sfix32 and the step-block has double. I placed a convert between them but it still didnt work. Is there a solution for that ? I want to keep the normal stimulus signals to compare with the S-Space Block.

Answers (1)

Tim McBrayer
Tim McBrayer on 11 Mar 2013
  1. HDL Coder is algorithm-agnostic. If you can represent it with supported blocks and data types in Simulink, HDL Coder will be able to generate HDL for it.
  2. You do not need to specify a sample time on every block; you don't even need to specify the sample time on every delay. As long as the design compiles cleanly in Simulink, each block will have a sample time assigned to it. You can see the sample times in color if you enable this through Simulink's menus or by running 'hdlsetup model_name'.
  3. This sounds like a Simulink modelling issue. You need to first figure out what numeric values your step-block emits, and what integer or fixed point value best represents these values inside your design. There is a tradeoff here between bit width and accuracy. The Fixed Point Advisor, if you have access to it, can help with converting your design to fixed point.

Categories

Find more on Code Generation in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!