Use the runs of lesson S9.9 to count what each way of sharing a buffer costs. Then say when software upkeep beats a coherent port.
Hardware context: The CRC engine of S9.8 as a bus manager beside a hart with a write-back data cache, with software maintenance or a coherent port. Driver cache maintenance and I/O coherency
The hart of lesson S9.9 has a write-back data cache with lines of 4 words. It writes a buffer, starts the CRC engine of S9.8, and reads the result word that the engine writes. The lab uses these costs. A clean or an invalidate looks a line up in 1 cycle, and writing a dirty line back takes 4 more. The engine takes 1 cycle for each word and 1 for its result. Through the coherent port each read takes 2.
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
| Run | Words | Words the hart wrote | Clean and invalidate: total | Coherent port: total |
|---|---|---|---|---|
| A | 16 | 16 | 38 | 33 |
| B | 16 | 4 | 26 | 33 |
| C | 64 | 64 | 146 | 129 |
Enter a way as 1 clean and invalidate, 2 coherent port, 3 no upkeep.
| Entry | Your decision |
|---|---|
| STALE_A | Run A with no upkeep: how many words does the engine read stale? |
| STALE_B | Run B with no upkeep: how many stale words? |
| UPKEEP_A | Run A: cycles of upkeep for clean and invalidate? |
| UPKEEP_B | Run B: cycles of upkeep for clean and invalidate? |
| ENGINE_PORT | Run A: cycles of the engine through the coherent port? |
| CHEAPER_A | Which way is cheaper in run A? |
| CHEAPER_B | Which way is cheaper in run B? |
| FASTEST_WRONG | Which way has the lowest total in run A, and the wrong answer? |
| SNOOP_HITS_B | Run B through the port: how many reads find a dirty copy in the cache? |
| FORGOT_INVALIDATE | The driver cleans but forgets the invalidate. Which value does the hart read for the result? 1 the right CRC, 2 the old copy. |
| CHEAPER_WAY | A buffer of 16 words (4 lines) has DIRTY dirty lines. Which way is cheaper in total: 1 clean and invalidate, 2 the coherent port? (Clean: 4 lookups, 4 cycles for each dirty line, 1 invalidate, 17 for the engine. Port: 33.) |
Examples
Example 1
STALE A- Input
Run A with no upkeep: how many words does the engine read stale?
- Output
matches = 1
All 16 are new in the cache and old in SRAM.
Example 2
STALE B- Input
Run B with no upkeep: how many stale words?
- Output
matches = 1
The hart wrote only words 0 to 3.
Example 3
UPKEEP A- Input
Run A: cycles of upkeep for clean and invalidate?
- Output
matches = 1
4 lines × (1 + 4) to clean, plus 1 to invalidate the result line.
Constraints and Contract
- Keep the parameter and named constants. Use the numeric codes and units on this page.
- For CHEAPER_WAY, enter a constant expression using DIRTY. Only this entry changes with the parameter. The supported integer range is 0 through 4, inclusive.
Hints
Hint 1
Only dirty lines cost a write-back; every line costs a lookup.
Hint 2
A snooped read costs more on every word, dirty or not.
Hint 3
What the engine writes must be invalidated in the cache before the hart reads it.
What the grader checks: Each check compares the full eight-bit answer. Parameter trials change one condition and keep the other decisions fixed.
11 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 1 problem on this path