S9.9.1 Choose a Sharing Method for the Engine

MediumImplement22 minIcarus Verilog · serverReview the topic

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

SignalWidthRole
question8input of each check
Full specification
RunWordsWords the hart wroteClean and invalidate: totalCoherent port: total
A16163833
B1642633
C6464146129

Enter a way as 1 clean and invalidate, 2 coherent port, 3 no upkeep.

EntryYour decision
STALE_ARun A with no upkeep: how many words does the engine read stale?
STALE_BRun B with no upkeep: how many stale words?
UPKEEP_ARun A: cycles of upkeep for clean and invalidate?
UPKEEP_BRun B: cycles of upkeep for clean and invalidate?
ENGINE_PORTRun A: cycles of the engine through the coherent port?
CHEAPER_AWhich way is cheaper in run A?
CHEAPER_BWhich way is cheaper in run B?
FASTEST_WRONGWhich way has the lowest total in run A, and the wrong answer?
SNOOP_HITS_BRun B through the port: how many reads find a dirty copy in the cache?
FORGOT_INVALIDATEThe driver cleans but forgets the invalidate. Which value does the hart read for the result? 1 the right CRC, 2 the old copy.
CHEAPER_WAYA 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

Report a problem with this page

Your code SystemVerilogSaved locally
Ln 1, Col 1Tab indents · Ctrl/⌘ + Enter runs samples
Not run yet

STALE A

Input
Run A with no upkeep: how many words does the engine read stale?
Expected output
matches = 1

All 16 are new in the cache and old in SRAM.

Run samples executes all 3 public checks. Check all tests runs 11 checks on the server.

Icarus Verilog · server