Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Simple Memory Read Problem drives me crazy

Reply
Thread Tools

Simple Memory Read Problem drives me crazy

 
 
Gerry
Guest
Posts: n/a
 
      02-06-2008
Hi

I have a strange bug in my simulation and cant figure out the error.
I have a simple ram that contains data that should be read as described
in the following process:

PROC_ram : process (clk)
begin
if (clk'event and clk = '1') then
-- memory write:
if (ew_cp0 = '1') then
ram(conv_integer(unsigned(rw_addr_cp0))) <= data_in_cp0;
end if;
if (rst = '0') then -- optional reset
data_out_cp0 <= (others => '0');
else
data_out_cp0 <= ram(conv_integer(unsigned(rw_addr_cp0)));
end if;
end if;
end process PROC_ram;

The problem that I have is, that the data is output with a delay of one
cycle. So when I check the waveforms I see that on a rising edge of the
clock the address changes to one for instance, but the data is still
read from memory position zero...

Anyone an idea what could be wrong here?

Many thanks!
 
Reply With Quote
 
 
 
 
Gerry
Guest
Posts: n/a
 
      02-06-2008
Stupid me, found the error, I should have an asynchronous read....

Now it looks like this:

PROC_ram : process (clk)
begin
if (clk'event and clk = '1') then
-- memory write:
if (ew_cp0 = '1') then
ram(conv_integer(unsigned(rw_addr_cp0))) <= data_in_cp0;
end if;
if (rst = '0') then -- optional reset
--data_out_cp0 <= (others => '0');
-- else
--data_out_cp0 <= ram(conv_integer(unsigned(rw_addr_cp0)));
end if;
end if;
end process PROC_ram;
data_out_cp0 <= ram(conv_integer(unsigned(rw_addr_cp0)));

In this case the reset port can be omitted, I wanna sythesis this as a
BRAM on a Xilinx FPGA. Hope that works!
 
Reply With Quote
 
 
 
 
Gerry
Guest
Posts: n/a
 
      02-06-2008

> In this case the reset port can be omitted, I wanna sythesis this as a
> BRAM on a Xilinx FPGA. Hope that works!


Well unfortuatnely XST tells me that the RAM will be implemented with
LUTS and that I have to describe it in a way that BRAM can be
instatiated, so that initial values can be stored in it...

Anyone who can help me out in this matter?
 
Reply With Quote
 
want.a.friendlier.world@gmail.com
Guest
Posts: n/a
 
      02-07-2008
Hi Gerry,

Is it possible at all that you can use the Core Generator or simply
use the BRAM primitives?

Why exactly are you writing your own RAM module when you want BRAM?

Cheers.

On Feb 6, 11:53*pm, Gerry <(E-Mail Removed)> wrote:
> > In this case the reset port can be omitted, I wanna sythesis this as a
> > BRAM on a Xilinx FPGA. Hope that works!

>
> Well unfortuatnely XST tells me that the RAM will be implemented with
> LUTS and that I have to describe it in a way that BRAM can be
> instatiated, so that initial values can be stored in it...
>
> Anyone who can help me out in this matter?


 
Reply With Quote
 
Gerry
Guest
Posts: n/a
 
      02-07-2008
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Hi Gerry,
>
> Is it possible at all that you can use the Core Generator or simply
> use the BRAM primitives?
>
> Why exactly are you writing your own RAM module when you want BRAM?


Hi

the problem is, I need an asynchronous RAM for my design. But with BRAM
you can just implement synchronous RAM. So I would need to know how
it is possible to initialise distributed RAM (1536 x 32bits) with some
initial values at startup.

Any idea if this is possible?
 
Reply With Quote
 
Andy
Guest
Posts: n/a
 
      02-07-2008
On Feb 7, 5:39 am, Gerry <(E-Mail Removed)> wrote:
> (E-Mail Removed) wrote:
> > Hi Gerry,

>
> > Is it possible at all that you can use the Core Generator or simply
> > use the BRAM primitives?

>
> > Why exactly are you writing your own RAM module when you want BRAM?

>
> Hi
>
> the problem is, I need an asynchronous RAM for my design. But with BRAM
> you can just implement synchronous RAM. So I would need to know how
> it is possible to initialise distributed RAM (1536 x 32bits) with some
> initial values at startup.
>
> Any idea if this is possible?


Depending on your synthesis tool, it may be able to use an initial
value specified when you declare the array that is used for the
memory. Check your tool docs.

Andy
 
Reply With Quote
 
Gerry
Guest
Posts: n/a
 
      02-07-2008

>
> Depending on your synthesis tool, it may be able to use an initial
> value specified when you declare the array that is used for the
> memory. Check your tool docs.


I used the Xilinx Core generator that generated me a distributed RAM
and the inital values are provided by a .coe file. I have no included
a black box for the RAM and the netlist file that was generated I have
put into my project directory. It is 160kb big, so I hope in this
netlist are also the inital values specified for the single RAM addresses.

Hope it works!
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Losing Drives - Finding Drives - Losing Drives mel@no.spam.com Computer Support 2 09-21-2007 10:16 PM
javascript in XSP (COCOON2) drives me crazy!!!! arashamiri@hotmail.com XML 4 08-25-2005 05:05 PM
Python and encodings drives me crazy Oliver Andrich Python 7 06-20-2005 11:38 PM
crazy browser go crazy dr greg Computer Support 7 01-14-2005 09:13 PM
Page.ParseControl drives me crazy Matthias Lohrer ASP .Net 0 07-08-2003 01:21 PM



Advertisments