Line | |
---|
1 | LIBRARY ieee ; |
---|
2 | LIBRARY unisim ; |
---|
3 | LIBRARY work ; |
---|
4 | USE ieee.std_logic_1164.all ; |
---|
5 | USE ieee.std_logic_arith.all ; |
---|
6 | USE ieee.STD_LOGIC_UNSIGNED.all ; |
---|
7 | USE unisim.VCOMPONENTS.all ; |
---|
8 | USE work.CoreTypes.all ; |
---|
9 | ENTITY fifo_256_fwft_tb IS |
---|
10 | END ; |
---|
11 | |
---|
12 | ARCHITECTURE fifo_256_fwft_tb_arch OF fifo_256_fwft_tb IS |
---|
13 | SIGNAL dout : std_logic_vector (7 downto 0) ; |
---|
14 | SIGNAL srst : STD_LOGIC ; |
---|
15 | SIGNAL rd_en : STD_LOGIC ; |
---|
16 | SIGNAL clk : STD_LOGIC:='0' ; |
---|
17 | SIGNAL full : STD_LOGIC ; |
---|
18 | SIGNAL empty : STD_LOGIC ; |
---|
19 | SIGNAL wr_en : STD_LOGIC ; |
---|
20 | SIGNAL din : std_logic_vector (7 downto 0) ; |
---|
21 | COMPONENT FIFO_256_FWFT |
---|
22 | PORT ( |
---|
23 | dout : out std_logic_vector (7 downto 0) ; |
---|
24 | srst : in STD_LOGIC ; |
---|
25 | rd_en : in STD_LOGIC ; |
---|
26 | clk : in STD_LOGIC ; |
---|
27 | full : out STD_LOGIC ; |
---|
28 | empty : out STD_LOGIC ; |
---|
29 | wr_en : in STD_LOGIC ; |
---|
30 | din : in std_logic_vector (7 downto 0) ); |
---|
31 | END COMPONENT ; |
---|
32 | BEGIN |
---|
33 | DUT : FIFO_256_FWFT |
---|
34 | PORT MAP ( |
---|
35 | dout => dout , |
---|
36 | srst => srst , |
---|
37 | rd_en => rd_en , |
---|
38 | clk => clk , |
---|
39 | full => full , |
---|
40 | empty => empty , |
---|
41 | wr_en => wr_en , |
---|
42 | din => din ) ; |
---|
43 | |
---|
44 | |
---|
45 | |
---|
46 | clk <= not clk after 5 ns; |
---|
47 | srst<='0','1' after 10 ns,'0' after 100 ns; |
---|
48 | |
---|
49 | input_data:process |
---|
50 | begin |
---|
51 | |
---|
52 | wr_en<='0'; |
---|
53 | wait for 10 ns; |
---|
54 | srst<='0'; |
---|
55 | wr_en<='1'; |
---|
56 | for i in 0 to 10 loop |
---|
57 | din<=conv_std_logic_vector(i,8); |
---|
58 | wait for 10 ns; |
---|
59 | end loop; |
---|
60 | wr_en<='0'; |
---|
61 | wait for 10 ns; |
---|
62 | |
---|
63 | for i in 11 to 20 loop |
---|
64 | wr_en<='1'; |
---|
65 | din<=conv_std_logic_vector(i,8); |
---|
66 | wait for 10 ns; |
---|
67 | wr_en<='0'; |
---|
68 | wait for 10 ns; |
---|
69 | end loop; |
---|
70 | --wait; |
---|
71 | end process; |
---|
72 | |
---|
73 | output_data:process(clk,empty) |
---|
74 | begin |
---|
75 | -- if rising_edge(clk) then |
---|
76 | if empty='0' then |
---|
77 | rd_en<='1'; |
---|
78 | else |
---|
79 | rd_en<='0'; |
---|
80 | end if; |
---|
81 | |
---|
82 | --end if; |
---|
83 | end process; |
---|
84 | |
---|
85 | end fifo_256_fwft_tb_arch; |
---|
Note: See
TracBrowser
for help on using the repository browser.