Work out how often a small DRAM must be refreshed, what share of the time that takes, and how long a read can be held up.
Hardware context: A small model of a serial flash chip (read command 03) and test code that acts as its controller on the four SPI wires. Execute-in-place flash controllers of small microcontrollers
A small DRAM has 64 rows. Every row must be refreshed at least once in every 3200 cycles of the clock. One REF command refreshes one row, and the DRAM picks the rows in turn. The commands take: ACT 2 cycles, RD or WR 2 cycles, PRE 2 cycles, REF 4 cycles. A REF needs every row closed, so an open row is closed with PRE first. The controller sends a REF that is due before it serves the bus.
This worksheet uses named constants. The first three entries show how to record your decisions.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
question | 8 | input of each check |
Full specification
Enter every answer as a whole number. Times are in cycles of the clock.
| Entry | Your decision |
|---|---|
| REFS_IN_WINDOW | How many REF commands are needed in every 3200 cycles? |
| REF_INTERVAL | The REF commands are spread evenly. How many cycles lie from one to the next? |
| REFRESH_WORST | A row is open when a REF is due. How many cycles does that refresh take? |
| PERCENT_WORST | Every refresh finds a row open. What percentage of all cycles goes to refresh? |
| PERCENT_BEST | Every refresh finds all rows closed. What percentage of all cycles goes to refresh? |
| READ_OPEN_ROW | A read finds its row open, and no REF is due. How long does the bus wait? |
| READ_OTHER_ROW | A read finds another row open, and no REF is due. How long does the bus wait? |
| READ_WITH_REFRESH | A read finds its row open, and a REF is due. How long does the bus wait? |
| BURST_CYCLES | The controller may save up 8 REF commands and send them together, after one PRE. How long does that burst take? |
| READ_AFTER_BURST | A read arrives as that burst starts. How long does the bus wait? |
| INTERVAL_FAST_CLOCK | The clock is made twice as fast, so the same time is 6400 cycles. How many cycles now lie between two REF commands? |
| INTERVAL_FOR_ROWS | The DRAM has ROWS rows, each refreshed once in every 3200 cycles. Give the cycles from one REF to the next. |
Examples
Example 1
REFS IN WINDOW- Input
How many REF commands are needed in every 3200 cycles?
- Output
matches = 1
One for each of the 64 rows.
Example 2
REF INTERVAL- Input
The REF commands are spread evenly. How many cycles lie from one to the next?
- Output
matches = 1
3200 divided by 64.
Example 3
REFRESH WORST- Input
A row is open when a REF is due. How many cycles does that refresh take?
- Output
matches = 1
PRE takes 2 and REF takes 4.
Constraints and Contract
- Keep the parameter and named constants. Use the numeric codes and units on this page.
- For INTERVAL_FOR_ROWS, enter a constant expression using ROWS. Only this entry changes with the parameter. The supported integer range is 16 through 200, inclusive.
Hints
Hint 1
One REF for each row in every window gives the number of REF commands, and so the interval.
Hint 2
Add PRE when a row is open. Compare the cycles of one refresh with the interval.
Hint 3
Put the refresh, the PRE, the ACT and the access one after another.
What the grader checks: Each check compares the full eight-bit answer. Parameter trials change one condition and keep the other decisions fixed.
12 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