07-22-2017 11:34 AM
I have a Microblaze IP generated use in an Artix7. I've followed the standard method to set up the microblaze where you generate output products, instantiate your instance, export the hardware, launch the SDK, build a simply elf file, then associate the ELF file for use in synthesis and simulation.
On the physical device, the elf file is loaded into the bitfile as expected. I can see output from the microblaze in accordance with how I programmed the firmware.
On simulation though, it appears that the microblaze is stuck with uninitialized bram. I exported the trace bus and I can see that TRACE_pc is incrementing by 4 from 0 to 0x7fff (32k prom size). TRACE_instruction is always 0. Tracing down into the microblaze instance and opening the bram ram instances shows that the read data is always 0.
So there seems to be some step not getting done properly.
* I've associated an ELF file for sim the same way we did for the implementation.
* In my sim directory, I see a .mem file that is generated by the sim setup which contains
bd_fc5c_lmb_bram_I_0.mem:// Data file(s) - /path/to/desired/elf/file
(So it looks like that is generated correctly.
I'm not sure what else to check. Any good reason why the .mem file isn't simply loaded by the bram and the microblaze starts to run properly?
08-04-2017 08:51 AM
I've found the problem with this but I need help finding a solution.
Here is the simulation source tree for the generated micro blaze:
Notice that the microblaze_mcs_0 is being simulated from the sim_netlist.v file which is part of the generated output products. This file doesn't actually read the bram memory though. That happens in the behavioral model for the blk_mem_gen_XXX.v (also generated as an output product). The behavioral models are only included if you use the file sim/microblaze_mcs_0.v instead of the setlist though.
So... if in the generated directory for the behavioral sim, I manually edit the project and swap out the sim_netlist with the behavioral model top for the micro blaze and then re-run the compile, I can then run the sim and see the mcs simulating correctly the firmware.
Question is, how to get the IP to do that. If I remove the IP and add the behavior sim files manually I think the project will stop generating the memory file for the bram as it won't detect the need from the IP any more. I'm not sure about that but that's the way it seems like it'll work.
08-04-2017 02:45 PM
If you are asking for a way to automate this, then the answer is simple, you can use a TCL script to do this for you -- but I'm not sure I fully understand what you are trying to do.
Anyway, here are a few thoughts on the netlist simulation:
Hope this helps,
08-04-2017 02:54 PM
At the most basic level, I'm just trying to click the button that says "run simulation" in the UI and then choose behavior simulation.
Currently, the result of that is that I do get a simulation to pop up and our RTL simulates fine. The micro blaze however doesn't load any contents into it's BRAM and therefore does nothing.
So that's the origin of my other thread where I generated the sim from the command line and generated the ram manually so that I could launch the sim and actually get the micro blaze to run the firmware in simulation.
It seems that when I choose "Associate ELF" and point the simulation elf file to the correct file that there is some missing link in the UI to actually make things work. It does generate a .mem file but that mem file never gets loaded into the netlist. Like you said, it probably has a way to load the contents but this should just work. I'm not sure if there is some different way when I generate the IP or with the IP project settings that could affect this but for whatever reason in my setup, I had to modify the sim manually and include the behavioral model instead of the netlist to get it to work.