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

Inferring ROM module

Altera_Forum
Honored Contributor II
2,069 Views

Hello everyone, I am currently designing 8-bit resolution Sinusoidal Wave Generator. I chose the look-up table method which needs a ROM module (256x8bit). I am using verilog coding and synthesize using Quartus II 9.1 on cyclone II device family. Here is my sub-module for the look-up table : 

 

module LUT256 ( ADDR, // Address input DataOut, // Data output RE, // Read Enable CE // Chip Enable ) /* synthesis romstyle = "M4K" */; input ADDR; output DataOut; input RE,CE; (* romstyle = "M4K" *) reg mem ; wire DataOut; assign DataOut = (CE && RE) ? mem : 8'b0; initial begin $readmemb("sine_value.list", mem); // sine_value is pre-calcualted value end endmodule 

 

The problem is, when I view the Technology Map Viewer (post mapping), the sub-module doesn't synthesize into ROM but instead into logic cells. RTL Viewer shows that the sub-module synthesized into memory module though. I also changed the appropriate settings in Quartus II analysis&synthesis settings for ROM/RAM to infer ROM/RAM module. Can someone please explain how to fix this problem. Thank you in advance.
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
985 Views

I think you need to add a clk. I had this problem too and the solution was to make the memory bigger, so you might want to try that as well.

0 Kudos
Altera_Forum
Honored Contributor II
985 Views

 

--- Quote Start ---  

I think you need to add a clk. 

--- Quote End ---  

 

Exactly. View the Verilog language templates in Quartus editor, they have examples of RAM and ROM inference. The requirements are also explained in detail in the Quartus software handbook.
0 Kudos
Altera_Forum
Honored Contributor II
985 Views

Thanks everyone for helping me. I managed to solve the problem by adding clock to the module. Here's the final code : 

module LUT256DFF ( Clk, ADDR, // Address input DataOut, // Data output RE, // Read Enable CE // Chip Enable ) /* synthesis romstyle = "M4K" */; input Clk; input ADDR; output DataOut; input RE,CE; (* romstyle = "M4K" *) reg mem ; reg DataOut; always @ (posedge Clk) begin if (CE && RE) DataOut <= mem; end initial begin $readmemb("sine_value.list", mem); // sine_value is pre-calcualted external memory file end endmodule  

 

It will synthesize to 2048bits of RAM (altsyncram). One question, is this RAM has the same attribute with the cyclone II's M4K ROM ?
0 Kudos
Reply