manasic
Junior Member level 1
- Joined
- Nov 2, 2013
- Messages
- 15
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 3
- Activity points
- 154
hello friends;
I am implementing a circular queue fifo buffer: I am having a issue that when a simulation signal read enable is given my waves stop appearing. I think its some issue with my implementation. can anyone help: following is my FIFO code and the test bench is attached along with:
I am implementing a circular queue fifo buffer: I am having a issue that when a simulation signal read enable is given my waves stop appearing. I think its some issue with my implementation. can anyone help: following is my FIFO code and the test bench is attached along with:
Code VHDL - [expand] 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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; use IEEE.std_logic_unsigned.all; entity FIFO_buffer is port ( clk: in std_logic; rst : in std_logic; -- system clock; re : in std_logic; -- read enable; we : in std_logic; -- write enable; datain : in std_logic_vector(7 downto 0); -- datainput; dataout : out std_logic_vector(7 downto 0); -- dataoutput; req : out std_logic; empt : inout std_logic; -- buffer empty status; full : inout std_logic); -- buffer full status; end FIFO_buffer; architecture behavior of FIFO_buffer is type buffertype is array (0 to 15) of std_logic_vector(7 downto 0); -- buffer depth; signal depth: buffertype := (others => (others => '0')); --contents of buffer at the time of initialisation signal rdptr : unsigned(3 downto 0) := "0000"; signal weptr : unsigned(3 downto 0) := "0000"; -- read and write pointer constant zero : unsigned (1 downto 0):= "00"; constant one : unsigned (1 downto 0):= "01"; begin --________________________________________________________________________________________________________________________________________________ process(clk,rst,re,we,rdptr,weptr,full,empt) -- process to write or read data and increment pointers begin if rst='1' then rdptr <= (others => '0'); weptr <= (others => '0'); empt <='1'; full <='0'; end if; if ((re = '1') or (full = '1')) then rdptr <= rdptr + one; dataout <= depth(to_integer(rdptr)); end if; if ((clk' event and clk = '1') and ((we = '1') or (empt = '1'))) then depth(to_integer(weptr)) <= datain; weptr <= weptr + one; end if; if (weptr + one = rdptr) then full <='1'; else full <='0'; end if ; if (rdptr = weptr ) then empt <='1'; else empt <='0'; end if ; end process; --____________________________________________________________________________________________________________________________________________________ requestgeneration:process(full,empt,rdptr) -- process to generate request to arbiter begin if ((full = '1') or (empt = '0') or (rdptr > "0010")) then req <= '1'; elsif ((empt = '1') or (rdptr < "0010")) then req <= '0'; end if; end process; end behavior; [ /syntax ] test bench: [syntax=vhdl] library IEEE; use IEEE.numeric_std.all; use IEEE.std_logic_1164.all; entity test_fifo is end entity; architecture behavior of test_fifo is component FIFO_buffer is port ( clk : in std_logic; rst : in std_logic; -- system clock; re : in std_logic; -- read enable; we : in std_logic; -- write enable; datain : in std_logic_vector(7 downto 0); -- datainput; dataout : out std_logic_vector(7 downto 0); -- dataoutput; empt : inout std_logic; -- buffer empty status; full : inout std_logic; --weptr_stat : inout std_logic_vector; --rdptr_stat : inout std_logic_vector; req : out std_logic); -- buffer full status; end component; signal clk_t : std_logic := '0'; signal rst_t : std_logic := '0'; signal re_t : std_logic := '0'; signal we_t : std_logic := '0'; signal datain_t : std_logic_vector(7 downto 0) := "00000000"; begin fifo1: FIFO_buffer port map (clk_t,rst_t,re_t,we_t,datain_t); inputdata:process(we_t) begin if (we_t = '1') then datain_t <= "00001111"; end if; end process; systemclock:process begin clk_t <= '1'; wait for 1 ns; clk_t <= '0'; wait for 1 ns; end process; systemreset:process begin rst_t <= '0'; wait for 100 ns; rst_t <= '1'; wait for 1 ns; end process; readenab: process begin re_t <= '0'; wait for 76 ns; re_t <= '1'; wait for 76 ns; end process; writeenab : process begin we_t <= '1'; wait for 5 ns; we_t <= '0'; wait for 5 ns; end process; sumulation:process begin wait for 1000 ns; assert false report "end simulation" severity failure; end process; end behavior; [ /syntax ] Thanks Manasi
Last edited: