-
Notifications
You must be signed in to change notification settings - Fork 621
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
[WIP] Load simulator memory from file #592
Conversation
Cool! You can have a look at @colinschmidt's pr #598 to see how to more cleanly add new plusargs. |
Thanks! I'll check that out. Any ideas about the segfault? Is there a different format of input file I should be using? |
I switched the plusarg parsing to match #598, thanks for pointing this out! I'm still unsure about why the model segfaults as soon as the load finishes. I remembered that I had to replace |
I thought I had a hack that worked for my system (blackboxed MMIO peripheral containing a huge memory I could directly initialize in the verilog), but it's looking to be insufficient. @davidbiancolin any ideas on things I should look into to debug this approach crashing / any examples of what using this flag on firesim looks like? I still haven't been able to find any examples. |
This line here needs one more level of indirection.
The
Also, note that the line_size argument is specified in bytes and not in words. |
The proper way of doing this that makes it compatible with multichannel would be a bit trickier. We'd have to rearchitect SimDRAM so that it knows about all the channels. |
Thanks! I'll check this out. I personally do not need multichannel, just some way to load memory. It definitely looks like making this PR fully compatible in general would require a lot of changes to automatically pull parameters out of Chipyard, since the ones the firesim implementation grabs things from headers that come out of Midas/golden gate if I understand correctly? |
To confirm, is the format of file that comes out of generate_memory_init.py the correct format to load via this function? |
Yes, it should work. The format is just a list of hex numbers in little-endian order. |
I updated the argument to be a double pointer and changed line_size to be in bytes. It isn't segfaulting now but also doesn't seem to be loading anything. I tried providing it a file that is entirely filled with
However, the print is consistently |
I wasn't able to get the TLRAM to store the program I'm trying to run, but I did find that if I change my link address to |
HTIF generally runs after loadmem, so it's most likely overwriting the memory with the program. Are you invoking it with the correct arguments? In the invocation you provided, you use |
That makes sense, does HTIF start writing from the beginning of memory though? I would expect that to mean that I'd see significantly slower load times for loading at I am, good catch -
which results in the simulator invocation being
The print statement I added indicating that the fastloadmem is happening is also popping up, so the code is definitely being reached. Just unsure if the load is happening correctly. |
Related issue: n/a
Type of change: new feature
Impact: software change
Release Notes
WIP: Still needs debugging, but discussing this and #591 in the same mailing list thread was getting confusing. I'm guessing my c++ isn't great but I'm happy to clean it up after the functionality is correct!
In this branch + the branch of testchipip that is currently being pointed to for testing purposes, I have added command line support to initialize the simulated DRAM.
Usage (also added to the simulator help output):
./simulator-chipyard-RocketConfig +dramsim +fastloadmem --loadmem=/path/to/test.hex /path/to/test.riscv
I attempted to do this as similarly as possible to the way that Firesim does (see here and here). Currently, the load finishes, but then the simulator segfaults during the first call to
memory_tick()
.I have tried passing a file from generate_memory_init.py as well as a file that only has a single line, and I get the same result. I also get the same result whether or not I pass the
+dramsim
flag (though it does show the dramsim ini files being loaded if I do).