Forum Discussion
Altera_Forum
Honored Contributor
14 years agobasically, the graph you have displays lots and lots of clipping, which is usually the result of not enough integer bits.
Also, the HDL output is very steppy, a sympton of not enough fractional bits. Also, the fact that the graph goes from 500 to -2500 is a bit concerning, making me think there is something not quite riught with your HDL conversion. Is this model one that is simply the model output of simulink when you're converting everything to "HDL codable" ie. you dont have any actual HDL yet? you may need to go back to basics with this - work through it yourself. Its not that hard to see how many bits you need for each step yourself. The first giveaway you have not done this is the fact you have 10.6 for your coefficients. The integer bits will never be used, and the 6 fractional bits are nowhere near enough bits to give the accuracy you seem to need for your coefficients. I suggest you change it to a 0.16 (0 integer, 16 fractional - gives you range 0 to 1 ) or 1.15 if you need it signed (range -1 to +1). Secondly, your input graph only goes from -1 to 1, but you say your temperature inputs go from 300 to 400. Is this somehow normalised to a range -1 to 1? If the input reall is only -1 to 1, you can have 1.15 numbers for your input to. thirdly - when assesing what you need, the rules are like this when you need to maintain values with no clipping or rounding: when adding, add an extra integer bit. when multiplying, add together the integer and fraction bits of both inputs. So a 1.15 x 1.15 will give you a 2.30 output (simulink should do this automatically. You can tell simulink to output any specific number format, and chose the rounding and flooring method) As multiplication actually gives you 2 sign bits, you can lose one of them and keep a 1.15 output. So as you can see, there are a few things we need to clear up.