Here 8x128 FIFO has a depth of 128 and width of 8bit. Let's consider the design with almost full and almost empty flag.
Let's consider the notif-delta as 4 i.e the delta at which machine will notify as almost empty/full.
Code:
entity module_fifo_regs_with_flags is
generic (
g_WIDTH : natural := 8;
g_DEPTH : integer := 128;
g_AF_LEVEL : integer := 124;
g_AE_LEVEL : integer := 4
);
port (
i_rst_sync : in std_logic;
i_clk : in std_logic;
-- FIFO Write Interface
i_wr_en : in std_logic;
i_wr_data : in std_logic_vector(g_WIDTH-1 downto 0);
o_af : out std_logic;
o_full : out std_logic;
-- FIFO Read Interface
i_rd_en : in std_logic;
o_rd_data : out std_logic_vector(g_WIDTH-1 downto 0);
o_ae : out std_logic;
o_empty : out std_logic
);
end module_fifo_regs_with_flags;
architecture rtl of module_fifo_regs_with_flags is
type t_FIFO_DATA is array (0 to g_DEPTH-1) of std_logic_vector(g_WIDTH-1 downto 0);
signal r_FIFO_DATA : t_FIFO_DATA := (others => (others => '0'));
signal r_WR_INDEX : integer range 0 to g_DEPTH-1 := 0;
signal r_RD_INDEX : integer range 0 to g_DEPTH-1 := 0;
-- # Words in FIFO, has extra range to allow for assert conditions
signal r_FIFO_COUNT : integer range -1 to g_DEPTH+1 := 0;
signal w_FULL : std_logic;
signal w_EMPTY : std_logic;
begin
p_CONTROL : process (i_clk) is
begin
if rising_edge(i_clk) then
if i_rst_sync = '1' then
r_FIFO_COUNT <= 0;
r_WR_INDEX <= 0;
r_RD_INDEX <= 0;
else
-- Keeps track of the total number of words in the FIFO
if (i_wr_en = '1' and i_rd_en = '0') then
r_FIFO_COUNT <= r_FIFO_COUNT + 1;
elsif (i_wr_en = '0' and i_rd_en = '1') then
r_FIFO_COUNT <= r_FIFO_COUNT - 1;
end if;
-- Keeps track of the write index (and controls roll-over)
if (i_wr_en = '1' and w_FULL = '0') then
if r_WR_INDEX = g_DEPTH-1 then
r_WR_INDEX <= 0;
else
r_WR_INDEX <= r_WR_INDEX + 1;
end if;
end if;
-- Keeps track of the read index (and controls roll-over)
if (i_rd_en = '1' and w_EMPTY = '0') then
if r_RD_INDEX = g_DEPTH-1 then
r_RD_INDEX <= 0;
else
r_RD_INDEX <= r_RD_INDEX + 1;
end if;
end if;
-- Registers the input data when there is a write
if i_wr_en = '1' then
r_FIFO_DATA(r_WR_INDEX) <= i_wr_data;
end if;
end if; -- sync reset
end if; -- rising_edge(i_clk)
end process p_CONTROL;
o_rd_data <= r_FIFO_DATA(r_RD_INDEX);
w_FULL <= '1' when r_FIFO_COUNT = g_DEPTH else '0';
w_EMPTY <= '1' when r_FIFO_COUNT = 0 else '0';
o_af <= '1' when r_FIFO_COUNT > g_AF_LEVEL else '0';
o_ae <= '1' when r_FIFO_COUNT < g_AE_LEVEL else '0';
o_full <= w_FULL;
o_empty <= w_EMPTY;
-----------------------------------------------------------------------------
-- ASSERTION LOGIC - Not synthesized
-----------------------------------------------------------------------------
-- synthesis translate_off
p_ASSERT : process (i_clk) is
begin
if rising_edge(i_clk) then
if i_wr_en = '1' and w_FULL = '1' then
report "ASSERT FAILURE - MODULE_REGISTER_FIFO: FIFO IS FULL AND BEING WRITTEN " severity failure;
end if;
if i_rd_en = '1' and w_EMPTY = '1' then
report "ASSERT FAILURE - MODULE_REGISTER_FIFO: FIFO IS EMPTY AND BEING READ " severity failure;
end if;
end if;
end process p_ASSERT;
-- synthesis translate_on
end rtl;
TESTBENCH for the same:
entity module_fifo_regs_with_flags_tb is
end module_fifo_regs_with_flags_tb;
architecture behave of module_fifo_regs_with_flags_tb is
constant c_DEPTH : integer := 4;
constant c_WIDTH : integer := 8;
constant c_AF_LEVEL : integer := 2;
constant c_AE_LEVEL : integer := 2;
signal r_RESET : std_logic := '0';
signal r_CLOCK : std_logic := '0';
signal r_WR_EN : std_logic := '0';
signal r_WR_DATA : std_logic_vector(c_WIDTH-1 downto 0) := X"A5";
signal w_AF : std_logic;
signal w_FULL : std_logic;
signal r_RD_EN : std_logic := '0';
signal w_RD_DATA : std_logic_vector(c_WIDTH-1 downto 0);
signal w_AE : std_logic;
signal w_EMPTY : std_logic;
component module_fifo_regs_with_flags is
generic (
g_WIDTH : natural := 8;
g_DEPTH : integer := 32;
g_AF_LEVEL : integer := 28;
g_AE_LEVEL : integer := 4
);
port (
i_rst_sync : in std_logic;
i_clk : in std_logic;
-- FIFO Write Interface
i_wr_en : in std_logic;
i_wr_data : in std_logic_vector(g_WIDTH-1 downto 0);
o_af : out std_logic;
o_full : out std_logic;
-- FIFO Read Interface
i_rd_en : in std_logic;
o_rd_data : out std_logic_vector(g_WIDTH-1 downto 0);
o_ae : out std_logic;
o_empty : out std_logic
);
end component module_fifo_regs_with_flags;
begin
MODULE_FIFO_REGS_WITH_FLAGS_INST : module_fifo_regs_with_flags
generic map (
g_WIDTH => c_WIDTH,
g_DEPTH => c_DEPTH,
g_AF_LEVEL => c_AF_LEVEL,
g_AE_LEVEL => c_AE_LEVEL
)
port map (
i_rst_sync => r_RESET,
i_clk => r_CLOCK,
i_wr_en => r_WR_EN,
i_wr_data => r_WR_DATA,
o_af => w_AF,
o_full => w_FULL,
i_rd_en => r_RD_EN,
o_rd_data => w_RD_DATA,
o_ae => w_AE,
o_empty => w_EMPTY
);
r_CLOCK <= not r_CLOCK after 5 ns;
p_TEST : process is
begin
wait until r_CLOCK = '1';
r_WR_EN <= '1';
wait until r_CLOCK = '1';
wait until r_CLOCK = '1';
wait until r_CLOCK = '1';
wait until r_CLOCK = '1';
r_WR_EN <= '0';
r_RD_EN <= '1';
wait until r_CLOCK = '1';
wait until r_CLOCK = '1';
wait until r_CLOCK = '1';
wait until r_CLOCK = '1';
r_RD_EN <= '0';
r_WR_EN <= '1';
wait until r_CLOCK = '1';
wait until r_CLOCK = '1';
r_RD_EN <= '1';
wait until r_CLOCK = '1';
wait until r_CLOCK = '1';
wait until r_CLOCK = '1';
wait until r_CLOCK = '1';
wait until r_CLOCK = '1';
wait until r_CLOCK = '1';
wait until r_CLOCK = '1';
wait until r_CLOCK = '1';
r_WR_EN <= '0';
wait until r_CLOCK = '1';
wait until r_CLOCK = '1';
wait until r_CLOCK = '1';
wait until r_CLOCK = '1';
end process;
end behave;
Can I please get the answers for these questions ASAP. Please. Design a 8x128 FIFO (8...
Can anyone explain how can you
get the above logic diagram? I have no clue how the answer is like
that. I've been trying to derive the truth table and draw the logic
diagram, but it's not the same as the above answer.
Exercise 9. Design of Sequential Circuits Design the sequential circuit illustrated by Figure 10. The circuit has an input X and an output Z. The out put Z goes high (1) whenever the target sequence 1-1-1 has...
Please label the circuit as well, the inputs and outputs
Design a sequence detector that examines a string of inputs applied to the input X and generates an output Z-1 whenever the input sequence is 011. A typical input sequence is as follows: X 0 01 1 01 1 1 0 1 0 1 0 0 1 1 Z 0 0 01 0 01 0 0 0 0 0 0 0 0 1 Time: 0 1 2 3 4 5...
please provide the answers of the 4 points thanks?
C Tarek Ould-Bachir, PEng,PhD. Design of Sequential Circuits ise 10. nesign the sequential circuit illustrated by Figure 11 Sequence Detector. The cireuit has an input X and wo outputs Y and Z. The output Y goes high (1) whenever the sequence 1-0-1 has been detected on x. The output Z goes high (1) whenever the sequence 1-1 has been detected on X. Figure 11 Sequence Detector #2 1 Draw the state...
I need some help with these questions.
Draw the minimal state diagram for a single input sequence detector whose output wil produce a 1 whenever the input sequence 1010 or 1101 is detected. Overlapping input sequences are allowed. 1 2. Write the minimal state table for this sequence detector, begin with state A for the initial state 3. Write the transition table for this sequence detector. Use the state variables starting with w.... Assign state 0 to A, 1 to...
Using D flip-flops, design a Moore circuit that detects the sequence 1100. The circuit outputs I when the sequence 1100 is received and outputs 0 otherwise. Draw the state diagram and state table, and find the D flip-flops input equations and the output equation x- Z Clock Hint: X: 01011 00011001100011 Z: 0 0 0 0 0 0 100000000000
all please
Design a 3-bit counter that has only one input, w. It counts down 7, 6,5,... 0, 7,.. whenever w-0, and counts up 0,1,2...7,0... when w 1 The output z-1, when the state of the counter is a prime number. Otherwise, z-0 1. List Inputs, Outputs and the count sequence. (5pts) 2. Draw the finite State machine for the counter. (10pts) 3. Draw the state transition table <extra columns for the flip flops values> (20pts) armed resource/content/1/case%20study.template.docx 4. Design...
Can I get the chance to do this please ? A sequential circuit has an input w and an output z (and an input reset). Its function is to generate z = 1 when the binary sequence 010 is detected; otherwise, z = 0. Implement the circuit in a Moore machine using graphical symbols of D flip-flops and any other gates. You can use a straightforward assignment method. An example of the desired behavior is as follows w: 010101010011001011 z:...
Please send an easy to read circuit design as well and explain
how it works.
4:02 00 LTE il 50% + ENEE 2586 - Lab 9_f... @ + : ENEF 356 Lab -Sequence Detector ENEE 2586 Lab #9 - Sequence Detector Purpose: The goal of this lab is to design a sequence detector using sequential logic circuits Procedure: 1. Design a sequential logic circuit to check an input stream labeled X and to produce an output Z=1 for any input...
please help question 2
2. Design a half-adder with the constraint that you can only use NAND and NOR gates. The circuit inputs are two bits I and y and the outputs are the sum bit s and carry bit c. Draw a circuit diagram and label each input and output. 3. The digital circuit below contains a latch and two flip-flops. Use the wave forms provided to find Qa. Qb, and Qe. Assume that all three states have initial...
9. Product State Graph ou are asked to design a sequence detector to detect the input codes 10 and 01. The input of the circuit is and the output is Z, which only changes at a clock edge. Overlaps must also be detected. Z only changes at the clock edge . [2%] A. Restate the problem by circling the most appropriate term within the parentheses 1. The circuilt type is (combinational- asynchronous- FSM). 2. The subcategory of the circuit is...