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

How to initialize a large buffer by quartus prime

CAlex
New Contributor II
1,519 Views

Hi, I want to init my written RAM by a mif file.

Here is my mif file:

DEPTH = 256;
WIDTH = 32;
ADDRESS_RADIX = HEX;
DATA_RADIX = HEX;

CONTENT
BEGIN
00 : 0000 0000;
01 : 0000 0000;
02 : 0000 0000;
03 : 0000 0000;
04 : 0000 0000;
05 : 0000 0000;

.

.

.

FF : 0000 0000;

END;

And here is the error from the quartus prime:

Error (10852): Verilog HDL error at DPbuffer_init.mif(1): illegal character 'p' in hexadecimal number

Error (10170): Verilog HDL syntax error at DPbuffer_init.mif(1) near text: p. Check for and fix any syntax errors that appear immediately before or at the specified keyword. The Intel FPGA Knowledge Database contains many articles with specific details on how to resolve this error. Visit the Knowledge Database at https://www.altera.com/support/support-resources/knowledge-base/search.html and search for this specific error message number.

Error (12152): Can't elaborate user hierarchy "soc_system:soc_inst|m_buffer:dpbuffer_0"

 

Do you guys know how to fix that or is there another way to init the RAM?

 

Thank you.

Labels (1)
0 Kudos
1 Solution
RichardTanSY_Intel
1,413 Views

I discovered that we cannot use the $readmemb funciton to read a MIF file.

To read the MIF file, you should use the ram_init_file attribute instead.

You may refer to the document below for instructions on how to apply this attribute:

Link: https://www.intel.com/content/www/us/en/docs/programmable/683283/18-1/ram-initialization-file-for-inferred-memory.html


Best Regards,

Richard Tan


View solution in original post

0 Kudos
8 Replies
FvM
Valued Contributor III
1,514 Views

Hi,

please show how you reference the .mif file in your design.

0 Kudos
CAlex
New Contributor II
1,475 Views

Hi

in the RAM design:

// initial
initial
begin
    if (DPBUFFER_INITIAL_FILE == "DPbuffer_init.mif")begin
        $readmemh(DPBUFFER_INITIAL_FILE,mem);
    end
   
// read data initial
    ava_read_data <= 0;
    read_data <= 0;
end
 
I've tried different path, but the quartus still cant recognize the mif file.
I've placed the mif file both under qpf file and my IP verilog file.
 
0 Kudos
RichardTanSY_Intel
1,467 Views

Could you help to share your design .qar file (Project> Achieve Project) so I could investigate further?


Best Regards,

Richard Tan


0 Kudos
CAlex
New Contributor II
1,441 Views

Sure,

the qar file is attached.

 

I changed the mif file to mem file so that it can be compiled successfully.

But I still need to use mif file to start.

The IP name is DPbuffer.

0 Kudos
RichardTanSY_Intel
1,414 Views

I discovered that we cannot use the $readmemb funciton to read a MIF file.

To read the MIF file, you should use the ram_init_file attribute instead.

You may refer to the document below for instructions on how to apply this attribute:

Link: https://www.intel.com/content/www/us/en/docs/programmable/683283/18-1/ram-initialization-file-for-inferred-memory.html


Best Regards,

Richard Tan


0 Kudos
RichardTanSY_Intel
1,235 Views

May I know does my latest reply helps?

Do you need further help in regards to this case?


Best Regards,

Richard Tan


0 Kudos
CAlex
New Contributor II
1,227 Views

Hi

sorry for the late reply,

Yes, it works.

 

Thank you for the help

0 Kudos
RichardTanSY_Intel
1,203 Views

Thank you for acknowledging the solution provided. I'm glad to hear that your question has been addressed. Now, I will transition this thread to community support. If you have any further questions or concerns, please don't hesitate to reach out. Thank you and have a great day!


Best Regards,

Richard Tan


0 Kudos
Reply