Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21595 Discussions

confusion of lpm_rom

Altera_Forum
Honored Contributor II
1,216 Views

Hi everyone! 

I've created a project to test test lpm module. The simulation seems strange to me. The output of the lpm_rom has one clock period delay. 

For example, address 00 has content of "AEFF", 01 "BD11", 02 "CD12" etc, when the first rising edge of lpm_rom's clock comes, the output is not what expected "AEFF", it's 

"0000"; current address 02, but on the rising edge of clock, output is address "01"'s content, "BD11"! 

Seems to me it always gets the previous address content instead of current one! 

I've attached the design files, can someone explain it? 

// cnt4bit.v 

// address generator 

module cnt4bit(clk, rst, addr); 

input clk, rst; 

output [3:0] addr; 

reg [3:0] addr; 

always @( posedge clk or posedge rst) 

if(rst==1) 

addr <= 4'b0; 

else 

addr <= addr + 1'b1; 

endmodule 

 

 

https://www.alteraforum.com/forum/attachment.php?attachmentid=3078  

 

https://www.alteraforum.com/forum/attachment.php?attachmentid=3079  

 

https://www.alteraforum.com/forum/attachment.php?attachmentid=3080  

https://www.alteraforum.com/forum/attachment.php?attachmentid=3081
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
500 Views

I believe your ROM module is registering both "addr" and "dout". 

Thus, you get that delay.
0 Kudos
Altera_Forum
Honored Contributor II
500 Views

 

--- Quote Start ---  

I believe your ROM module is registering both "addr" and "dout". 

Thus, you get that delay. 

--- Quote End ---  

 

 

yes, you're right! Just double checked the lpm_rom, I've enabled register q' output!
0 Kudos
Reply