Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Help in SRAM block??

Reply
Thread Tools

Help in SRAM block??

 
 
dcreddy1980
Guest
Posts: n/a
 
      12-20-2004
I dont know where i went wrong in the following code,when i simulate the
code...i am getting RWD <= "UUUUUU"in the waveform results....

entity SRAM is
port(CADDR : in std_logic_vector(3 downto 0);
RADDR : in std_logic_vector(6 downto 0);
RWD : inout std_logic_vector(15 downto 0);
BNKSEL : in std_logic;
RDCAS : in std_logic;
WRCAS : in std_logic;
DTRDY : out std_logic);
end SRAM;

architecture behaviour of SRAM is
begin
process(BNKSEL,RDCAS,WRCAS,CADDR,RADDR,RWD)
subtype tmp is std_logic_vector(15 downto 0);
type memory_array is array(integer range 0 to 127,integer range 0 to
15);---128 rows and 16 columns
variable mem : memory_array;
begin
if(BNKSEL'event and BNKSEL = '1') then
if(RDCAS = '1') then
RWD <=
mem(conv_integer(unsigned(CADDR)),conv_integer(uns igned(RADDR)));
DTRDY <= '1';
end if;
if(WRCAS = '1') then
mem(conv_integer(unsigned(CADDR)),conv_integer(uns igned(RADDR))) :=
RWD;
DTRDY <= '0';
end if;
end if;
end process;
end behaviour;


TESTBENCH :
------------

entity tb_SRAM is
end tb_SRAM;

architecture tb of tb_SRAM is
component SRAM
port(CADDR : in std_logic_vector(3 downto 0);
RADDR : in std_logic_vector(6 downto 0);
RWD : inout std_logic_vector(15 downto 0);
BNKSEL : in std_logic;
RDCAS : in std_logic;
WRCAS : in std_logic;
DTRDY : out std_logic);
end component;
signal RDCAS,WRCAS,DTRDY,BNKSEL : std_logic;
signal CADDR : std_logic_vector(6 downto 0);
signal RADDR : std_logic_vector(3 downto 0);
signal RWD : std_logic_vector(15 downto 0);
begin

UUT : SRAM port map(CADDR,RADDR,RWD,BNKSEL,RDCAS,WRCAS,DTRDY);

CADDR <= "0010010";
RADDR <= "0010";
RWD <= "0001000100010001";
BNKSEL <= '0','1' after 8 ns,'0' after 16 ns,'1' after 24 ns,'0' after 30
ns;
RDCAS <= '0','1' after 26 ns,'0' after 34 ns;
WRCAS <= '0','1' after 10 ns,'0' after 18 ns;

end tb;


is there any correction in my testbench???if so,can u plz rectify my
mistake....


Regards,
dcreddy1980

 
Reply With Quote
 
 
 
 
Paul Uiterlinden
Guest
Posts: n/a
 
      12-21-2004
dcreddy1980 wrote:
> I dont know where i went wrong in the following code,when i simulate the
> code...i am getting RWD <= "UUUUUU"in the waveform results....


I would expect it to be XXXX.

> UUT : SRAM port map(CADDR,RADDR,RWD,BNKSEL,RDCAS,WRCAS,DTRDY);
>
> CADDR <= "0010010";
> RADDR <= "0010";
> RWD <= "0001000100010001";
> BNKSEL <= '0','1' after 8 ns,'0' after 16 ns,'1' after 24 ns,'0' after 30
> ns;
> RDCAS <= '0','1' after 26 ns,'0' after 34 ns;
> WRCAS <= '0','1' after 10 ns,'0' after 18 ns;
>
> end tb;
>
> is there any correction in my testbench???if so,can u plz rectify my
> mistake....


RWD is an inout, so in the testbench if you want to read a value from
the RAM, you should set RWD hi-Z: RWD <= (OTHERS => 'Z');

The same goes for your RAM: it should drive RWD hi-Z if it is not being
read.

Paul.
 
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
Simulation Model for SRAM ALuPin VHDL 2 02-22-2004 03:05 AM
How do I model a 6T SRAM cell in VHDL KM VHDL 1 12-05-2003 08:30 PM
Reading back SRAM content via JTAG? moe VHDL 3 11-16-2003 02:22 PM
SRAM vs Cache Michael VHDL 4 09-22-2003 08:31 AM
write data to Sram and then read to PC sarah VHDL 1 08-13-2003 10:08 PM



Advertisments