FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > Verilog

Verilog comp.lang.verilog newsgroup / usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-15-2006, 10:20 AM
Guest
 
Posts: n/a
Default Inferring dual port two output sram

Hi,

I wish to infer a dual port SRAM with one input write data port and two
output read data ports. Ideally I'd like describe this abstractly
enough so that the code will generate the correct hardware for my
prototype FPGA platform (xilinx Spartan 3) and also when using an ASIC
library (memory to be inferred via Synopsys Designware). The following
code in ISE results in 2 dual port memories with a single input and
output - which is not what I want

always @(posedge clk)
begin
if (wr_en)
ram[waddr] <= data_in;
end
//-----------------------------------------------------------------------

always @(posedge clk)
begin
if(rst_n ==1'b0)
begin
data_out0 <= 'b0;
data_out1 <= 'b0;
end
else
if(wr_en!=1'b1)
begin
data_out0 <= ram[raddr0];
data_out1 <= ram[raddr1];
end
end

Any suggestions would be most welcome!
thanks

Reply With Quote
  #2 (permalink)  
Old 08-15-2006, 03:41 PM
gabor
Guest
 
Posts: n/a
Default Re: Inferring dual port two output sram


[email protected] wrote:
> Hi,
>
> I wish to infer a dual port SRAM with one input write data port and two
> output read data ports. Ideally I'd like describe this abstractly
> enough so that the code will generate the correct hardware for my
> prototype FPGA platform (xilinx Spartan 3) and also when using an ASIC
> library (memory to be inferred via Synopsys Designware). The following
> code in ISE results in 2 dual port memories with a single input and
> output - which is not what I want
>
> always @(posedge clk)
> begin
> if (wr_en)
> ram[waddr] <= data_in;
> end
> //-----------------------------------------------------------------------
>
> always @(posedge clk)
> begin
> if(rst_n ==1'b0)
> begin
> data_out0 <= 'b0;
> data_out1 <= 'b0;
> end
> else
> if(wr_en!=1'b1)
> begin
> data_out0 <= ram[raddr0];
> data_out1 <= ram[raddr1];
> end
> end
>
> Any suggestions would be most welcome!
> thanks


To end up with one dual-port memory, one of the outputs
in the second process needs to use the same address
as the write section, i.e. replace either raddr0 or raddr1
with waddr. Otherwise this can't be implemented in a
single DP RAM. What you've described is a quasi three
port memory (1 write and 2 read) since you have three
address buses.

Regards,
Gabor

Reply With Quote
  #3 (permalink)  
Old 08-15-2006, 03:45 PM
John_H
Guest
 
Posts: n/a
Default Re: Inferring dual port two output sram

For a dual port memory in the Xilinx architecture, each port has one
address, not two addresses. You specify a waddr which is different than
raddr0 and raddr1. You're describing a three port memory. If you can
use a 2x clock for the memory, it's simple to enable the write on the
equivalent of the 1x clock rising edge and the read on the 1x clk
falling edge by delivering the 2x clk with the write enable in the
correct place. The address also needs to be muxed but muxes are fast.


[email protected] wrote:
> Hi,
>
> I wish to infer a dual port SRAM with one input write data port and two
> output read data ports. Ideally I'd like describe this abstractly
> enough so that the code will generate the correct hardware for my
> prototype FPGA platform (xilinx Spartan 3) and also when using an ASIC
> library (memory to be inferred via Synopsys Designware). The following
> code in ISE results in 2 dual port memories with a single input and
> output - which is not what I want
>
> always @(posedge clk)
> begin
> if (wr_en)
> ram[waddr] <= data_in;
> end
> //-----------------------------------------------------------------------
>
> always @(posedge clk)
> begin
> if(rst_n ==1'b0)
> begin
> data_out0 <= 'b0;
> data_out1 <= 'b0;
> end
> else
> if(wr_en!=1'b1)
> begin
> data_out0 <= ram[raddr0];
> data_out1 <= ram[raddr1];
> end
> end
>
> Any suggestions would be most welcome!
> thanks
>

Reply With Quote
  #4 (permalink)  
Old 08-15-2006, 03:48 PM
John_H
Guest
 
Posts: n/a
Default Re: Inferring dual port two output sram

Sorry, it's early... I see now you don't need the read value during the
write. Define a wire for one of the addresses that looks like
rwaddr = wr_en? waddr : raddr0;
and use the rwaddr in both the write and appropriate read.


[email protected] wrote:
> Hi,
>
> I wish to infer a dual port SRAM with one input write data port and two
> output read data ports. Ideally I'd like describe this abstractly
> enough so that the code will generate the correct hardware for my
> prototype FPGA platform (xilinx Spartan 3) and also when using an ASIC
> library (memory to be inferred via Synopsys Designware). The following
> code in ISE results in 2 dual port memories with a single input and
> output - which is not what I want
>
> always @(posedge clk)
> begin
> if (wr_en)
> ram[waddr] <= data_in;
> end
> //-----------------------------------------------------------------------
>
> always @(posedge clk)
> begin
> if(rst_n ==1'b0)
> begin
> data_out0 <= 'b0;
> data_out1 <= 'b0;
> end
> else
> if(wr_en!=1'b1)
> begin
> data_out0 <= ram[raddr0];
> data_out1 <= ram[raddr1];
> end
> end
>
> Any suggestions would be most welcome!
> thanks
>

Reply With Quote
  #5 (permalink)  
Old 08-15-2006, 06:41 PM
mk
Guest
 
Posts: n/a
Default Re: Inferring dual port two output sram

On 15 Aug 2006 01:20:34 -0700, "[email protected]"
<[email protected]> wrote:

>Hi,
>
>I wish to infer a dual port SRAM with one input write data port and two
>output read data ports. Ideally I'd like describe this abstractly
>enough so that the code will generate the correct hardware for my
>prototype FPGA platform (xilinx Spartan 3) and also when using an ASIC
>library (memory to be inferred via Synopsys Designware).


I haven't used Designware recently but I'd be very surprised if they
added memory inferring to its features. In ASICs one needs to run a
memory compiler which is specific to each process and it's supplied by
the library vendor (or another third party memory IP vendor). So you
probably will have to run a memory compiler get a model and
instantiate that model in your design. If so it makes more sense to do
the same for the FPGA flow too.
Reply With Quote
  #6 (permalink)  
Old 08-15-2006, 07:35 PM
Guest
 
Posts: n/a
Default Re: Inferring dual port two output sram

Thanks for that John! that definitely points me in the right direction

John_H wrote:
> Sorry, it's early... I see now you don't need the read value during the
> write. Define a wire for one of the addresses that looks like
> rwaddr = wr_en? waddr : raddr0;
> and use the rwaddr in both the write and appropriate read.
>
>
> [email protected] wrote:
> > Hi,
> >
> > I wish to infer a dual port SRAM with one input write data port and two
> > output read data ports. Ideally I'd like describe this abstractly
> > enough so that the code will generate the correct hardware for my
> > prototype FPGA platform (xilinx Spartan 3) and also when using an ASIC
> > library (memory to be inferred via Synopsys Designware). The following
> > code in ISE results in 2 dual port memories with a single input and
> > output - which is not what I want
> >
> > always @(posedge clk)
> > begin
> > if (wr_en)
> > ram[waddr] <= data_in;
> > end
> > //-----------------------------------------------------------------------
> >
> > always @(posedge clk)
> > begin
> > if(rst_n ==1'b0)
> > begin
> > data_out0 <= 'b0;
> > data_out1 <= 'b0;
> > end
> > else
> > if(wr_en!=1'b1)
> > begin
> > data_out0 <= ram[raddr0];
> > data_out1 <= ram[raddr1];
> > end
> > end
> >
> > Any suggestions would be most welcome!
> > thanks
> >


Reply With Quote
  #7 (permalink)  
Old 08-15-2006, 07:38 PM
Guest
 
Posts: n/a
Default Re: Inferring dual port two output sram

> >I wish to infer a dual port SRAM with one input write data port and two
> >output read data ports. Ideally I'd like describe this abstractly
> >enough so that the code will generate the correct hardware for my
> >prototype FPGA platform (xilinx Spartan 3) and also when using an ASIC
> >library (memory to be inferred via Synopsys Designware).

>
> I haven't used Designware recently but I'd be very surprised if they
> added memory inferring to its features. In ASICs one needs to run a
> memory compiler which is specific to each process and it's supplied by
> the library vendor (or another third party memory IP vendor). So you
> probably will have to run a memory compiler get a model and
> instantiate that model in your design. If so it makes more sense to do
> the same for the FPGA flow too.


aha :-( thanks for clearing that up.

Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dual Port RAM: Different Bus Sizes? deadsy Verilog 2 05-19-2006 05:58 AM
How do I make dual-port RAM from single port RAM? Frank @ CN Verilog 34 03-06-2006 01:33 PM
Overheads of 4-port over 2-port SRAM John T. Goodman Verilog 0 01-25-2005 05:26 PM
Making output-port to bi-directional-port! Vick Verilog 5 12-15-2004 07:03 AM
infer dual-port Block RAM with different dimensions kyrten Verilog 0 08-25-2004 08:55 PM


All times are GMT +1. The time now is 12:39 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved