Closed fuzhouxiang closed 8 months ago
Analysis of bug report
forsyde-deep produces the wrong code for the function take
in mingzi_lib/mingzi_lib.vhd
.
The following code is produced in line 182-189:
function take (n : natural;
vec : fsvec_int32)
return fsvec_int32 is
variable res : fsvec_int32 (0 to n - 1);
begin
res := vec(1 to n - 1);
return res;
end;
The following code should be produced:
function take (n : natural;
vec : fsvec_int32)
return fsvec_int32 is
variable res : fsvec_int32 (0 to n - 1);
begin
res := vec(0 to n - 1);
return res;
end;
So, for the lower index in line 187 in the function take
res := vec(1 to n - 1); -- wrong code
a 0 needs to be generated instead of a 1.
res := vec(1 to n - 1); -- correct code
Error Fix
A solution to fix this error has been included in the development
branch.
The forsyde-deep in the development branch works well for writeandmodelsimvhdl.
It has now been integrated into the main branch.
Hi, I found that the generated VHDL code for 'take' function in Data.Param.FSVec cannot be simulated by writeAndModelsimVHDL. Here is a small example.
The simulation in ForSyDe.Deep is fine.
But the simulation in Modelsim failed.
For the simulation in Quartus, I am still struggling.