Author: Scott Gravenhorst
Using PicoBlaze with distributed ROM program storage
It is possible to use up to 1024 locations x 18 bits of distributed RAM instead of a block RAM to store the machine code that PicoBlaze will execute. The procedure requires that you are somewhat familiar with the Core Generator.
The following procedure can accomplish this:
1) Write and debug your PSM file using block RAM first - this will allow you to quickly compile and test your code. The next few steps can take a good deal of time, so it is important to know that the code works correctly in a block RAM before trying to convert to distributed RAM.
2) Find the .COE file that KCPSM3.EXE produced - this file contains the initialization data for the RAM. It will be named <PROJECT>.COE where <PROJECT> is the name you gave the project and supplied to KCPSM3.EXE.
3) Create a directory for using the core generator.
4) Copy the .COE file (not ROM_form.coe, only the <project>.COE file) to a directory you just created. Edit the .COE file with a text editor and remove the coefficient lines except for:
Leave the RAM initialization data in the file (should come immediately after the "memory_initialization_vector=" line).
5) Open the Core Generator
6) Create a new project in the directory you created above.
7) Select from the core types to generate RAM, specifically, distributed RAM.
8) Set the core generator to use:
data width should be 18
data depth should be no more than 1024
Select to generate Distibuted ROM.
Select to register the output (but NOT the input)
9) Tell the generator to use the <project.COE> file that you edited.
10) Let the core generator run - this will take several minutes.
11) When core generator is finished, it will have created several files that should be copied into the ISE project which contains the PicoBlaze instantiation. In my case, I copied the following files:
Note: I am not sure that ALL of the files above need to be copied. I did, however, successfully test this with the files I list above.
12) Once the files are copied to the ISE project, you will need to modify the HDL code that instantiates the ROM for PicoBlaze to use dist_mem_gen_v3_4.v (or whatever name you used if you renamed it) instead of the <project>.v file. This will also require editing the instantiation line to include the "address" and "instruction" objects used by kcpsm3.v
13) Run ISE to synthesize and test it!