Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17252 Discussions

$readmemb and $readmemh cannot accept parameters!

Altera_Forum
Honored Contributor II
4,780 Views

I have a design that infers memory and I would like to initialize memory from a file. I used $readmemb and $readmemh and a filename parameter that is passed to the block. 

 

parameter P_MEM_FILE = "mem_ini.txt", 

 

$readmemb( P_MEM_FILE, memory, 0, P_DEPTH-1 ); 

 

Quartus complains about the parameter! 

 

Error (10853): Verilog HDL error at cw_memory_sp.v(248): argument 0 to $readmemb must be a string literal File: cw_memory_sp.v Line: 248 

 

If I have a fixed string as the filename in $readmemb, it works fine. I would like to reuse the same code among different synthesis tools and it is frustrating when one vendor does not support this. 

 

Has anyone encountered this? Or do you have any workarounds? 

-- Amal
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
3,242 Views

I don't like `defines but using a `define instead of a parameter should solve the issue. 

 

Jake
0 Kudos
Altera_Forum
Honored Contributor II
3,242 Views

I don't want to define all the different ROM files that we use. I don't like defines either unless they are managed properly, which they are not most often. 

 

-- Amal
0 Kudos
Reply