05-05-2020 04:43 AM
I have just found a bug which causes inconsinstency between simualtion and code generation in System Generator 2019.1/Matlab 2018b:
I have a register which has a UFIX_32_0 input with enable and reset inputs.
Initial value is set to 2^32.
- In simualtion the register initializes to 2^32 - 1 and in this case and simulation works correctly as expected.
- In the generated code the register value becomes 0 instead and the final design doesnt work in hardware.
I am aware that the intial value of 2^32 is out of range of the UFIX_32_0 signal.
It should either raise a warning/error or saturate to the highest possible value 2^32 - 1 like it correctly does in the constant blocks.
05-05-2020 07:04 AM
Is it possible to share a small testcase to reproduce this issue.
05-06-2020 01:33 AM
I have attached a small model for it.
both the constant and the register initial values are set to 2^32 in this example.
generated code for constant (ContMax):
- assign op = 32'b11111111111111111111111111111111;
generated code for register (RegMax):
In simulation the register output is 2^31-1 permanently. In hardware it is 0 for the first 101 cycles before it becomes 2^31-1
05-06-2020 02:44 AM
I verified it as bug.
We are checking for a fix.
Thanks for reporting it.