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

Use riscv32-unknown-elf-objcopy to generate Verilog memory init files instead of octal dump (od) #35

Merged
merged 1 commit into from
Feb 2, 2024

Conversation

rafaelcalcada
Copy link
Collaborator

Octal dump might not be present in all Linux distributions, and my own code to generate the hex dump using it might not work in all cases. riscv32-unknown-elf-objcopy is a safer option and it is always present.

@rafaelcalcada rafaelcalcada added the enhancement New feature or request label Feb 1, 2024
@AlexxMarkov
Copy link
Collaborator

AlexxMarkov commented Feb 2, 2024

Hi @rafaelcalcada,

This seems to work, but if your linking address is not 0x00000000, but let’s say 0x10000000. Then you will receive the address @10000000 at the very beginning of the file. And as a result, you will most likely get something like this:

$readmem file address beyond bounds of array

But since we have a link from address 0x00000000, if this does not change, then there is no need to worry.

@rafaelcalcada
Copy link
Collaborator Author

This format is also accepted. I though there could only be one word per line, but more than one are allowed. And the lines starting with @ tell $readmemh the address where the data must be placed. I tested in Verilator and Vivado, both accept this format.

@rafaelcalcada rafaelcalcada merged commit 1588185 into main Feb 2, 2024
@AlexxMarkov
Copy link
Collaborator

@rafaelcalcada I've edited the comment a bit, please look at it again.

@rafaelcalcada rafaelcalcada deleted the verilog-objcopy branch February 2, 2024 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants