Synchronous FIFO with Full/Empty Flags
intermediate · memory · 180 XP
Sign in to write your solution, run it in the simulator and submit it for grading.
Sign in or create a free account →Problem
Synchronous FIFO with Full/Empty Flags
A **First-In First-Out** buffer: data written to the write port emerges from the read port in the same order, after a variable delay. Single clock domain.
**Depth: 8 entries. Width: 8 bits.**
**Interface**
| Port | Direction | Description |
|-------------|-----------|-------------------------------------|
| `clk` | input | Clock |
| `rst` | input | Synchronous reset |
| `wr_en` | input | Write enable |
| `rd_en` | input | Read enable |
| `din[7:0]` | input | Write data |
| `dout[7:0]` | output | Read data (synchronous) |
| `full` | output | FIFO is full (count == 8) |
| `empty` | output | FIFO is empty (count == 0) |
| `count[3:0]`| output | Current number of entries |
**Rules:**
- Writes are ignored (no-op) when `full=1`
- Reads are ignored (no-op) when `empty=1`
- Simultaneous valid read + valid write: count stays constant, data flows through
- `dout` is registered (synchronous read)
Constraints
- Use write pointer wr_ptr[2:0] and read pointer rd_ptr[2:0], both wrapping mod 8.
- count[3:0] tracks number of entries: increment on write, decrement on read.
- full = (count == 4'd8). empty = (count == 4'd0).
- Write when full: no-op. Read when empty: no-op.
Examples
Input: Write 8 entries
Output: full=1, count=8
FIFO full
Input: Write 8, then read 8
Output: Data emerges in same order, empty=1 after last read
FIFO ordering preserved
Input: Simultaneous wr_en=1, rd_en=1 when half-full
Output: count unchanged, data flows
Simultaneous read+write
Common questions
- What does the Synchronous FIFO with Full/Empty Flags problem ask you to build?
- Synchronous FIFO with Full/Empty Flags A **First-In First-Out** buffer: data written to the write port emerges from the read port in the same order, after a variable delay. Single clock domain. **Depth: 8 entries.
- What constraints does Synchronous FIFO with Full/Empty Flags have?
- Use write pointer wr_ptr[2:0] and read pointer rd_ptr[2:0], both wrapping mod 8.; count[3:0] tracks number of entries: increment on write, decrement on read.; full = (count == 4'd8). empty = (count == 4'd0).; Write when full: no-op. Read when empty: no-op.
- What is an example input and output for Synchronous FIFO with Full/Empty Flags?
- Input Write 8 entries gives output full=1, count=8. FIFO full
- Which Verilog concepts does Synchronous FIFO with Full/Empty Flags practise?
- memory, FIFO, interview, flow-control, sequential.