Double to fixpoint conversion of Sum and Discrete transfer function block

3 views (last 30 days)
Hi, this model works fine with data types shown
for summer (input1 : ufix6_En7, input2: ufixe6_En6, output : double) and
Discrete TF.. (output: double)
but when i change the sum block output to any fix point it does not give the correct results. what should be the correct method So that I can convert all these to fixed point so that HDL code can be generated.
- Do we need to insert ZOH block prior to conversion , or some fix point tool will insert where necessary.
- what should be the fix point settings for Discrete TF block
- what does the wire color shows,,, when I update diagram it turns to red
- for above both blocks ,, how to set the Accumulator/ ouput data type settings..
Thank you

Answers (1)

Andrew Schenk
Andrew Schenk on 15 Jun 2015
It is best practice to insert a ZOH block after the input port to the model as it will convert an input signal with continuous sample time to an output signal with a discrete sample time.
The reason you are getting incorrect results is likely because the fixed point data type has not been selected correctly for your specific signal data range. If you use the Simulink Menu Bar -> Analysis -> Fixed Point Tool utility, this will simulate your model, derive signal ranges, and automatically propose data types that prevent over/underflow errors while maximizing resolution.
Finally, the blocks are colored red to indicate the particular sample time. This can be changed by clicking: Display -> Sample Time -> Off. Also, click Display -> Sample Time -> Display Sample Time Legend will pop-up a window describing the meaning of each color.
  1 Comment
Safiya
Safiya on 17 Jun 2015
Thank you for your reply. one more thing whether ZOH block should be included in HDL code generation subsystem or it could be outside the subsystem. what is difference if code is generated with or without ZOH block. does it be synthesizable to cadence layout etc.. if code is generated including ZOH. thanks

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!