dynamically created blockRAM contents?

I have some Verilog code that generates an array of blockRAMs to any dimensions that I want. For example, if I set LENGTH=3 and HEIGHT=4 then 12 blockRAMs get synthesized. I have a separate script written in Ruby that creates the initial blockRAM contents according to the position of each blockRAM in the array. What I'd like to do is be able to pass in the blockRAM init parameters dynamically as each blockRAM is generated.

I'm looking for suggestions on how to do this. Can XST execute and interact with scripts from the command line?

Reply to
matteo
Loading thread data ...

If you use VHDL, you can initialize block RAMs during synthesis. Check the "Initializing RAM" section in XST User Guide for examples.

Cheers, Jim

formatting link

matteo wrote:

Reply to
Jim Wu

I can infer blockRAMs and initialize their contents with a file using the $readmemh system task from an initial block. The problem now is how do I dynamically load a different file based on the parameters that get passed from an upper module? The syntax is

initial $readmemh("data.txt",Mem,0,7);

where 0 is the start address and 7 would be the end address if the depth was 8. Say I have a set of files for different blockram contents: data0.txt data1.txt data2.txt

the # comes in as a parameter. Is there a way that I can convert it to a string?

Matt

Reply to
matteo

Does this help?

formatting link
Probably not, but just checking. Cheers, Syms.

Reply to
Symon

Is there some reason why the code that generates the initial contents is written in Ruby? More to the point, is there some reason that this Ruby program can not be converted to VHDL or Verilog bundled up as a function that will return the memory contents?

Kevin Jennings

Reply to
KJ

What I've found is that in Verilog, what gets passed in as module parameters has to be a constant. I wanted to use genvar's but that is not allowed. The workaround was to write another Ruby script that would generate the Verilog code itself. Instead of using the generate statement I pre-generate each module with Ruby. This creates a large Verilog file but the parameters are now constant and the synthesis tool is happy.

messagenews: snipped-for-privacy@51g2000cwl.googlegroups.com...

code that generates the initial contents is

Reply to
matteo

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.