-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mtime_o could be instable #58
Comments
What do you mean with "instabilities"? The 64-bit MTIME counter is split in two 32-bit counter (timing issues), so there might be an inconsistency when the lower word overflows into the higher word as the carry propagation requires an additional cycle. Let me illustrate that:
For the CPU that is no deal at all as it reads/writes MTIME only in chunks of 32-bit. Is that what you mean with "instability"? |
This seems to be a real "bug" 😅
You were absolutely right. I am sorry, that I did not see that at first. I will add a synchronization delay to |
Should be fixed now 😉🚀 |
Yes, that is this inconsistency which disturbs other modules in my project. |
The problem of inconsistency is not corrected. I have made some tests with testbench, and the most simple is just to put the line with 'mtime_lo_ovfl' outside the process, with the mtime_lo increment:
And with this modification, 'mtime_lo_ovfl' is updated before the same clock cycle which updates 'mtime_lo' and 'mtime_hi'. |
Right, by this the LOW and HIGH words of the mtime counter are always "sync". The problem here is that this will introduce a 64-bit carry chain, which will reduce maximum clock frequency. That is why I split that up into two 32-bit carry chains (one for the HIGH word, one for the LOW word) that are coupled via the registered
Could you share or specify your simulation scenario? I have also done some simulation. I have set mtime to There is no inconsistency in |
We've seen mismatches between GHDL and ModelSim due to delta cycle ordering issues: VUnit/vunit#692. Might this be the case here? |
Oh wait, I think this is just a misunderstanding 😄 I think you are checking neorv32/rtl/core/neorv32_mtime.vhd Lines 55 to 56 in 74ee026
I was talking about the neorv32/rtl/core/neorv32_top.vhd Lines 187 to 189 in 74ee026
neorv32/rtl/core/neorv32_top.vhd Lines 944 to 961 in 74ee026
|
Yes !!! I understand what happens ! And I have the problem because I updated only I am sorry, it is my mistake ! 😕 |
Absolutely no problem. |
You have export the mtime_o to top instance and I thank you for that ! It helps me a lot anf avoid to add a timer in my project.
But I observed instabilities, probably because 'time_o' in the file "neorv32_mtime.vhd" is not in a synchronous process...
Although, I read it in a synchronous process. It is always when the msb words 'mtime_hi' updates that it reads a bad value.
To validate a good reading whithout changing something in the core, I added a process to check mtime_o change only by '1' between two clock ticks. But it is a little messy to add this process to validate the ntime output.
I don'k know why it is this instability... Maybe putting the line 167 (' time_o <= mtime_hi & mtime_lo(31 downto 00); ') in a synchronous process ?
The text was updated successfully, but these errors were encountered: