HDL Coder: how to divide (eg, 1/3) using simulink when the divisor is not 2^x
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
hello guys/girls,
how to perform the division of 1/3 in simulink for HDL code generation. I keep having the synthesis problem saying that the divisor need to be a value of 2^x .
0 Kommentare
Akzeptierte Antwort
Tim McBrayer
am 3 Sep. 2013
Certain synthesis tools do not support division of arbitrary numbers; this is why you are encountering this restriction. The most straightforward way to generate a synthesizable division is to use the Product block in division mode by setting its inputs to '*/'. Then you can choose either the 'RecipNewton' or 'RecipNewtonSingleRate' implementation. These avoid the use of the '/' operator.
3 Kommentare
Tim McBrayer
am 4 Sep. 2013
Bearbeitet: Tim McBrayer
am 4 Sep. 2013
The RecipNewton implementation is a HDL Coder option on the Product block. You can reach the HDL Block Options on any HDL-supported block by right-clicking on the block in your model and choosing "HDL Code->HDL Block Properties...". On the Product block, you can then change the 'Architecture' field from the default 'Linear' to 'RecipNewton'. The RecipNewton method is only valid when the block is in division mode; HDL Coder will error out should you choose this architecture when the block is configured for multiplication.
The architecture field describes how the HDL code will be generated for the block. It does not affect Simulink simulation. If the implementation introduces latency, as the RecipNewton architecture can, HDL Coder will notify you of the additional latency that has been inserted. The generated HDL testbench will be automatically adjusted to reflect the change in latencies.
Weitere Antworten (1)
Walter Roberson
am 2 Sep. 2013
1/3 = 1/4 + 1/16 + 1/64 + 1/256 (etc.)
So do all those divisions by 2^x and sum the result.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Speed Optimization finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!