Complete the code to declare a FIFO buffer with a depth of 8.
reg [7:0] fifo_mem [0:[1]-1];
The FIFO depth is 8, so the memory array should have 8 entries indexed from 0 to 7.
Complete the code to increment the write pointer in the FIFO.
write_ptr <= (write_ptr + 1) % [1];
The write pointer wraps around after reaching the FIFO depth, which is 8.
Fix the error in the FIFO full condition check.
fifo_full = ([1] == read_ptr);The FIFO is full when the next write pointer position equals the read pointer.
Fill both blanks to complete the FIFO empty condition check.
fifo_empty = ([1] == [2]);
The FIFO is empty when the write pointer equals the read pointer.
Fill all three blanks to complete the FIFO write operation.
if (write_enable && !fifo_full) begin fifo_mem[[1]] <= [2]; [3] <= ([3] + 1) % 8; end
Write data to memory at write pointer, then increment write pointer modulo FIFO depth.
