필터 지우기
필터 지우기

How to avoid the division operator from hdlcoder?

조회 수: 1 (최근 30일)
kim lee
kim lee 2018년 7월 27일
댓글: Bharath Venkataraman 2018년 8월 22일
Dear All,
I've got the below verilog code when I generated with hdlcoder.
fx = srcX / dstX;
fy = srcY / dstY;
always @(srcX, srcY, dstX, dstY, recur, in, AP) begin
if (dstX == 3'b000) begin
test_function1_fixpt_tmp = 39'h7FFFFFFFFF;
end
else begin
test_function1_fixpt_cast = {srcX, 24'b000000000000000000000000};
if (dstX == 31'sd0) begin
test_function1_fixpt_div_temp = 36'hFFFFFFFFF;
end
else begin
test_function1_fixpt_div_temp = test_function1_fixpt_cast / dstX;
end
test_function1_fixpt_tmp = {3'b0, test_function1_fixpt_div_temp};
end
test_function1_fixpt_fx = test_function1_fixpt_tmp[33:24];
//fx = (float)srcX / (float)dstX; ;
As you can see that used a division operator " /".
But I'm confused quite a bit the output of hdlcoder.
Because I don't want to use "/" a division operator in RTL code, because utilization problem and Design Compiler and Xilinx VIVADO can not synthesize divider problem.
So I want to resolve this problem with another different way instead of "/".
What am I supposed to do to resolve this problem?
# update
I came across some relative posting as the below when I googling, But In my 2017B matlab version can't find any options. Would you please help and let me know how to resolve this problem?
"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."

답변 (1개)

Bharath Venkataraman
Bharath Venkataraman 2018년 7월 31일
You can try using the HDL reciprocal block followed by a multiply to perform this operation.
  댓글 수: 2
kim lee
kim lee 2018년 8월 5일
편집: kim lee 2018년 8월 5일
Hi!
Could you let me know more how to use HDL reciprocal block in "HDLCODER"?
For example,
If I want to do the below division, what am I supposed to do in hdlcoder?
dstY = 4096;
for y = 1:255
v = y / (dstY);
end
I can't find any HDL Reciprocal options in HDLCODER.
Bharath Venkataraman
Bharath Venkataraman 2018년 8월 22일
This is a Simulink block. If you drag the block into a Simulink model, and feed it dstY, it will return (1/dstY) at the output.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 HDL Coder에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by