Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Dual Port ram Simulation Issue

Status
Not open for further replies.

shethpurak

Junior Member level 1
Joined
Nov 15, 2005
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,399
Hi

This is how I have implemented my dual port ram

always@(posedge clk) begin
if(wr_en)
mem[wr_ptr] <= data_in;

end

always@(posedge clk) begin
if(rd_en)
data_out <= mem[rd_ptr];

end


Somehow in the simulations my data_out is 1 clock delayed. it gets output after 1 clock delay after rd_en.

I know one is use asynchronous read using assign statements. Is there any solutions with keeping the read synchronous so that my read happens at the same time I get the rd_en.

Please let me know

Thanks
 

do it like this:

always @(*)
if (rd_en)
data_out_pre =mem[rd_ptr];


always@(posedge clk)
data_out <= data_out_pre;

Basically, you are reading the ram with combo logic and transfer it to the output on clock edge.
 

I do like shethpurak,but when i sim the netlist syn by dc,read happens at the same time I get the rd_en.
I use "<=" .
 

Why don't you just do this ?

always@(posedge clk) begin
if(wr_en)
mem[wr_ptr] <= data_in;

end

assign data_out = rd_en ? mem[rd_ptr] : z ;


This is actually a synchronous read as long as rd_en is synchronizing the read clock.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top