Work out what a FIFO four entries deep must do at each of its corners. Then sort each corner as an end, a seam or a corner in time.
Hardware context: A FIFO four entries deep. Corner lists for queues, counters and buffers.
The FIFO of the lesson: four entries deep, empty after reset. A push is taken when it is not full, and a pop when it is not empty. Both may happen in one clock, each decided by the count before it. A push at the n-th clock writes the value 16 + n.
This worksheet uses named constants. The first three entries show how to record your decisions.
Replace each unresolved value of 255 with your result.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
question | 8 | input of each check |
Full specification
| Code | Kind of corner |
|---|---|
| 1 | An end of a range |
| 2 | A seam: two events in one clock |
| 3 | A corner in time |
| Entry | Your decision |
|---|---|
| PUSHES_TO_FULL | From empty, how many pushes in a row make the FIFO full? |
| AFTER_BOTH_EMPTY | Entries after a push and a pop in one clock, starting empty. |
| AFTER_BOTH_FULL | Entries after a push and a pop in one clock, starting full. |
| AFTER_BOTH_MID | Entries after a push and a pop in one clock, starting with 2. |
| AFTER_POP_EMPTY | Entries after a pop alone, starting empty. |
| AFTER_PUSH_FULL | Entries after a push alone, starting full. |
| WRAP_PUSH | Starting empty, with a pop after every push, which push (counting from 1) writes slot 0 for the second time? |
| AFTER_RESET | Entries straight after a reset while 3 were inside. |
| OLDEST | Pushes at clocks 1, 2 and 3 (values 17, 18, 19), then one pop. The oldest entry, in decimal? |
| KIND_POP_EMPTY | Kind of corner: a pop when empty. |
| KIND_BOTH_FULL | Kind of corner: a push and a pop together when full. |
| KIND_RESET | Kind of corner: reset while the FIFO holds data. |
| MIN_CLOCKS | The same rules, but DEPTH entries deep, one push or pop per clock. From empty, you fill it and push once more, then drain it and pop once more. How many clocks? |
Examples
Example 1
PUSHES TO FULL- Input
From empty, how many pushes in a row make the FIFO full?
- Output
matches = 1
Full means four entries, so four pushes.
Example 2
AFTER BOTH EMPTY- Input
Entries after a push and a pop in one clock, starting empty.
- Output
matches = 1
At empty the pop is refused and the push is taken.
Example 3
AFTER BOTH FULL- Input
Entries after a push and a pop in one clock, starting full.
- Output
matches = 1
At full the push is refused and the pop is taken.
Constraints and Contract
- Keep the parameter and named constants. Use the numeric codes and units on this page.
- For MIN_CLOCKS, enter a constant expression using DEPTH. Only this entry changes with the parameter. The supported integer range is 2 through 32, inclusive.
Hints
Hint 1
A push and a pop in one clock are each decided by the count before it.
Hint 2
Every end is tested at the end and one step beyond it.
Hint 3
Ends are values, seams are pairs of events, corners in time are about when.
What the grader checks: Each check compares the full eight-bit answer. Parameter trials change one condition and keep the other decisions fixed.
17 checks on Icarus Verilog · server. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain your source only; samples require the simulation service. A passing result establishes the tested cases, not a proof for all possible inputs.
See all 2 problems on this path