Skip to content
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

certain MEM_SIZE values cause failures #123

Open
medexs opened this issue Oct 13, 2024 · 2 comments
Open

certain MEM_SIZE values cause failures #123

medexs opened this issue Oct 13, 2024 · 2 comments

Comments

@medexs
Copy link

medexs commented Oct 13, 2024

I have successfully ported the Demo System to the Basys3 board (the branch in my forked repo is here) and have found a bug when changing the value of the MEM_SIZE parameter. If the value of MEM_SIZE is not a power of two, the core crashes due to some failure. It always happens when one of the jump instructions is executed. For every non power of two value of MEM_SIZE, there is one specific jump instruction that causes the failure after executing it. After executing the specific jump instruction, halting of the hart is not successfull and any communication with the board via openocd is not possible, so the bitstream has to be loaded again (this behaviour is similar to the one mentioned in issue #122 , but it was invoked differently).

Although I have been only testing it on the Basys3 board, I think that this issue will also be present on the Arty-A7 board.

@nbdd0121
Copy link
Contributor

The code was written assuming MEM_SIZE is power of two, e.g. the mask calculation relies on MEM_SIZE being power of two to work. Why do you need to be not a power of two?

@medexs
Copy link
Author

medexs commented Oct 13, 2024

@nbdd0121 Thank you for a quick reply.

I am porting NuttX to the Demo System and needed to bump up the memory size from the original 64KiB and didn't set it to a power of two value because I didn't know that the implementation doesn't allow it. I spent a lot of time finding where the problem is as the NuttX port wasn't in a stable state yet so I didn't know if it's a SW or HW bug, because there are also methodology warnings in Vivado. Then I discovered that certain values of MEM_SIZE work as mentioned above. So I thought it's a bug.

Maybe there should be a comment or a note somewhere about this? So people don't have to peek into the implementation of the Xilinx primitives? Or is it possible to allow the size to be a non power of 2 value?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants