Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - FIFO simulation

 
Thread Tools Search this Thread
Old 06-16-2005, 03:54 PM   #1
Default FIFO simulation


Hi,

I have generated a FIFO with output registers and one without
output registers. (Altera QuartusII MegaWizardManager)

And yet when simulating both in Modelsim(functional simulation)I get
the same result: The data appear on the output of the FIFO immediately
after asserting the rdreq.

Any ideas what could be wrong ?

Here is my testbench code:

ibrary ieee;

use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;

entity tb_fifo_test_unregistered is
end tb_fifo_test_unregistered;


architecture testbench of tb_fifo_test_unregistered is

component fifo_test_unregistered
port ( Data : in std_logic_vector(8 downto 0);
Wrreq : in std_logic;
Rdreq : in std_logic;
Clock : in std_logic;
Aclr : in std_logic;
Q : out std_logic_vector(8 downto 0)
);

end component;

signal t_data : std_logic_vector(8 downto 0);
signal t_wrreq : std_logic;
signal t_rdreq : std_logic;
signal t_clock : std_logic;
signal t_clock2 : std_logic;
signal t_aclr : std_logic;
signal t_q : std_logic_vector(8 downto 0);

begin

uut : fifo_test_unregistered
port map ( Data => t_data,
Wrreq => t_wrreq,
Rdreq => t_rdreq,
Clock => t_clock2,
Aclr => t_aclr,
Q => t_q
);

process
begin
t_clock <= '1'; wait for 5.5 ns;
t_clock <= '0'; wait for 5.5 ns;
end process;

process
begin
t_clock2 <= '0'; wait for 5.5 ns;
t_clock2 <= '1'; wait for 5.5 ns;
end process;



process
begin
t_aclr <= '1', '0' after 103 ns;
wait;
end process;



process
begin
t_data <= (others => '0');
t_wrreq <= '0';
t_rdreq <= '0';

for i in 0 to 40 loop
wait until rising_edge(t_clock);
end loop;

for i in 0 to 31 loop
wait until rising_edge(t_clock);
t_wrreq <= '1';
t_data <= conv_std_logic_vector(i+1, 9);
end loop;

t_wrreq <= '0';

for i in 0 to 10 loop
wait until rising_edge(t_clock);
end loop;

for i in 0 to 31 loop
wait until rising_edge(t_clock);
t_rdreq <= '1';
wait until rising_edge(t_clock);
t_rdreq <= '0';
wait until rising_edge(t_clock);
end loop;
t_rdreq <= '0';

wait;
end process;


end testbench;



ALuPin@web.de
  Reply With Quote
Old 06-17-2005, 06:25 AM   #2
Neo
 
Posts: n/a
Default Re: FIFO simulation
Nothing is wrong with the test bench but you have not put the
registered fifo code here. cant make out anything without the rtl.



Neo
  Reply With Quote
Old 06-17-2005, 08:16 AM   #3
ALuPin@web.de
 
Posts: n/a
Default Re: FIFO simulation
Here is the code for registered one:

LIBRARY ieee;
USE ieee.std_logic_1164.all;

LIBRARY altera_mf;
USE altera_mf.altera_mf_components.all;

ENTITY fifo_test_registered IS
PORT
(
data : IN STD_LOGIC_VECTOR (8 DOWNTO 0);
wrreq : IN STD_LOGIC ;
rdreq : IN STD_LOGIC ;
clock : IN STD_LOGIC ;
aclr : IN STD_LOGIC ;
q : OUT STD_LOGIC_VECTOR (8 DOWNTO 0)
);
END fifo_test_registered;


ARCHITECTURE SYN OF fifo_test_registered IS

SIGNAL sub_wire0 : STD_LOGIC_VECTOR (8 DOWNTO 0);



COMPONENT scfifo
GENERIC (
lpm_width : NATURAL;
lpm_numwords : NATURAL;
lpm_widthu : NATURAL;
intended_device_family : STRING;
lpm_type : STRING;
lpm_showahead : STRING;
overflow_checking : STRING;
underflow_checking : STRING;
use_eab : STRING;
add_ram_output_register : STRING
);
PORT (
rdreq : IN STD_LOGIC ;
aclr : IN STD_LOGIC ;
clock : IN STD_LOGIC ;
q : OUT STD_LOGIC_VECTOR (8 DOWNTO 0);
wrreq : IN STD_LOGIC ;
data : IN STD_LOGIC_VECTOR (8 DOWNTO 0)
);
END COMPONENT;

BEGIN
q <= sub_wire0(8 DOWNTO 0);

scfifo_component : scfifo
GENERIC MAP (
lpm_width => 9,
lpm_numwords => 32,
lpm_widthu => 5,
intended_device_family => "Cyclone",
lpm_type => "scfifo",
lpm_showahead => "OFF",
overflow_checking => "ON",
underflow_checking => "ON",
use_eab => "ON",
add_ram_output_register => "ON"
)
PORT MAP (
rdreq => rdreq,
aclr => aclr,
clock => clock,
wrreq => wrreq,
data => data,
q => sub_wire0
);
END SYN;




And here is the code for the non-registered one:





LIBRARY ieee;
USE ieee.std_logic_1164.all;

LIBRARY altera_mf;
USE altera_mf.altera_mf_components.all;

ENTITY fifo_test_unregistered IS
PORT
(
data : IN STD_LOGIC_VECTOR (8 DOWNTO 0);
wrreq : IN STD_LOGIC ;
rdreq : IN STD_LOGIC ;
clock : IN STD_LOGIC ;
aclr : IN STD_LOGIC ;
q : OUT STD_LOGIC_VECTOR (8 DOWNTO 0)
);
END fifo_test_unregistered;


ARCHITECTURE SYN OF fifo_test_unregistered IS

SIGNAL sub_wire0 : STD_LOGIC_VECTOR (8 DOWNTO 0);



COMPONENT scfifo
GENERIC (
lpm_width : NATURAL;
lpm_numwords : NATURAL;
lpm_widthu : NATURAL;
intended_device_family : STRING;
lpm_type : STRING;
lpm_showahead : STRING;
overflow_checking : STRING;
underflow_checking : STRING;
use_eab : STRING;
add_ram_output_register : STRING
);
PORT (
rdreq : IN STD_LOGIC ;
aclr : IN STD_LOGIC ;
clock : IN STD_LOGIC ;
q : OUT STD_LOGIC_VECTOR (8 DOWNTO 0);
wrreq : IN STD_LOGIC ;
data : IN STD_LOGIC_VECTOR (8 DOWNTO 0)
);
END COMPONENT;

BEGIN
q <= sub_wire0(8 DOWNTO 0);

scfifo_component : scfifo
GENERIC MAP (
lpm_width => 9,
lpm_numwords => 32,
lpm_widthu => 5,
intended_device_family => "Cyclone",
lpm_type => "scfifo",
lpm_showahead => "OFF",
overflow_checking => "ON",
underflow_checking => "ON",
use_eab => "ON",
add_ram_output_register => "OFF"
)
PORT MAP (
rdreq => rdreq,
aclr => aclr,
clock => clock,
wrreq => wrreq,
data => data,
q => sub_wire0
);



END SYN;



ALuPin@web.de
  Reply With Quote
Old 06-17-2005, 11:06 AM   #4
Neo
 
Posts: n/a
Default Re: FIFO simulation
Well, its a macro so cant do much. try checking out the attributes of
the macro. But do you mean the output is available in the same cycle
the signal "rdreq" is aaeerted?



Neo
  Reply With Quote
Old 06-17-2005, 12:20 PM   #5
ALuPin@web.de
 
Posts: n/a
Default Re: FIFO simulation
Yes, in both simulations.

Of course I have instantiated "fifo_test_registered" in my testbench
for the
registered version.

Rgds
André



ALuPin@web.de
  Reply With Quote
Old 06-23-2005, 08:43 PM   #6
info_
 
Posts: n/a
Default Re: FIFO simulation
Have you checked the documentation waveform that Quartus II
Megawizzard does generate for you to illustrate the behavior
of the generated macro ?

Simulating is still definitely a good idea...
however, I think you are changing rdreq just at the clock's rising edge,
which might be legit if you don't have any delta delay (which is hard
to assess in a macro model) but which makes the waveform harder to
interpret anyway.
I suggest you change your inputs at the clock's inactive (falling) edge.

Bert Cuzeau


info_
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Simulation question Issue Rahul MCITP 9 06-30-2008 09:53 PM
Simulation in 70-444 CorreiaLC MCITP 0 10-11-2007 07:18 PM
Post-Route Simulation does not give output for the first clock cycle Options velocityreviews Software 0 04-17-2007 05:47 PM
simulation Tom MCITP 0 04-05-2007 01:40 AM
Wanna site names that provide simulation tests for A+ raisasheikh@lycos.com A+ Certification 0 09-06-2005 07:50 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46