Consider a synchronous FIFO with depth 4. The write pointer (wr_ptr) and read pointer (rd_ptr) are 2-bit counters. After writing 3 data items and reading 1, what are the values of wr_ptr and rd_ptr?
signal wr_ptr : std_logic_vector(1 downto 0) := "00"; signal rd_ptr : std_logic_vector(1 downto 0) := "00"; -- After writing 3 times: wr_ptr <= std_logic_vector(unsigned(wr_ptr) + 1); wr_ptr <= std_logic_vector(unsigned(wr_ptr) + 1); wr_ptr <= std_logic_vector(unsigned(wr_ptr) + 1); -- After reading 1 time: rd_ptr <= std_logic_vector(unsigned(rd_ptr) + 1);
Count how many times each pointer increments and remember they are 2-bit counters.
Writing 3 times increments wr_ptr from 00 to 11 (0->1->2->3). Reading once increments rd_ptr from 00 to 01.
In a synchronous FIFO design, which condition correctly indicates the FIFO is full?
Think about how the write pointer catches up to the read pointer in a circular buffer.
The FIFO is full when the write pointer is one position behind the read pointer in a circular manner, meaning (wr_ptr + 1) mod depth equals rd_ptr.
Given the following VHDL code snippet for empty flag, what is the error?
empty <= '1' when wr_ptr = rd_ptr else '0'; -- wr_ptr and rd_ptr are std_logic_vector(2 downto 0)
Think about how VHDL compares vectors and the need for numeric types.
In VHDL, comparing std_logic_vector directly is allowed but may not reflect numeric comparison. For pointer arithmetic and comparison, converting to unsigned is safer and clearer.
Which option contains the correct VHDL syntax for a synchronous FIFO write process triggered on rising clock edge?
Check the correct way to detect rising edge and compare std_logic signals.
Option D uses the correct rising_edge function and compares write_enable to '1' (std_logic). Option D uses older style but is valid. Option D compares write_enable to integer 1 (wrong). Option D tries to add integer to std_logic_vector directly (invalid).
In a synchronous FIFO with depth 8, write pointer wr_ptr and read pointer rd_ptr are 3-bit unsigned counters. Which VHDL expression correctly calculates the number of stored items (occupancy)?
Think about pointer wrap-around and modulo arithmetic for circular buffers.
The occupancy is the difference between write and read pointers modulo the FIFO depth. This handles wrap-around correctly.
