V5.7.1 Two Cores, One Line

MediumImplement22 minIcarus Verilog · serverReview the topic

Read the recorded runs of the two-cache lab of module S9. Count what sharing costs, tell true sharing from false, and choose how a cache subsystem would be checked.

Hardware context: The two-hart and two-cache lab models of module S9; ap_soc v1.5 has one core and no cache. Counting what sharing costs and choosing a method.

The lab of S9.3 has two caches, A and B, kept coherent by MSI over one bus. Each line holds two bytes, x and y. Its recorded runs are below. ap_soc has one core and no cache, so none of this runs on the chip of this track.

This worksheet uses named constants. The first three entries show how to record your decisions.

Replace each unresolved value of 65535 with your result.

Signals in the Timeline

SignalWidthRole
question8input of each check
Full specification
Recorded by the S9.3 lab on Icarus (content/modules/v3/soc/soc-s93-recordings.json).
RunStepsBus commandsFlushes
shared863
falseSharing443
padded210
falseSharing: A writes x, B writes y, of the same line, in turn.
s1 A write x=01 bus=write-miss from=memory wb=- A=M B=I mem=0000
s2 B write y=02 bus=write-miss from=A wb=A A=I B=M mem=0001
s3 A write x=03 bus=write-miss from=B wb=B A=M B=I mem=0201
s4 B write y=04 bus=write-miss from=A wb=A A=I B=M mem=0203
bus commands=4 flushes=3
CodeHow to check the cache subsystem
1Agent-driven: bus agents in the cores' seats, a reference model of memory fed by their transactions
2Model-driven: an instruction-level model for each core runs real programs
3Both, in that order
CodeKind of sharing
1True sharing: both cores use the same byte
2False sharing: different bytes of the same line
3No sharing
EntryYour decision
SHARED_CMDSBus commands of the shared run.
FALSE_CMDSBus commands of the falseSharing run.
PADDED_CMDSBus commands when x and y sit in different lines (padded).
FALSE_KINDA writes x and B writes y, both in one line.
TRUE_KINDA writes x, then B reads x.
CORNER_WAYYou must make both cores hit one line in the same cycle, again and again.
REAL_WAYYou want to know that real code runs right on the subsystem.
PLAN_WAYThe plan for a whole verification campaign of a cache subsystem.
FALSE_ATBus commands if A and B take turns writing x and y of one line, WRITES writes in all, from no copy. By the MSI rule of the lab, every write misses.

Examples

Example 1

SHARED CMDS
Input
Bus commands of the shared run.
Output
matches = 1

Read the last line of the run.

Example 2

FALSE CMDS
Input
Bus commands of the falseSharing run.
Output
matches = 1

Each write finds the line in the other cache and takes it away.

Example 3

PADDED CMDS
Input
Bus commands when x and y sit in different lines (padded).
Output
matches = 1

Each core keeps its own line; only the first write misses.

Constraints and Contract

  • Keep the parameter and named constants. Use the numeric codes and units on this page.
  • For FALSE_AT, enter a constant expression using WRITES. Only this entry changes with the parameter. The supported integer range is 2 through 10, inclusive.

Hints

Hint 1

The last line of each run holds the counts.

Hint 2

Same byte: true sharing. Same line only: false.

Hint 3

Aim with agents; confirm with models.

What the grader checks: Each check compares the full eight-bit answer. Parameter trials change one condition and keep the other decisions fixed.

13 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

SHARED CMDS

Input
Bus commands of the shared run.
Expected output
matches = 1

Read the last line of the run.

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

Icarus Verilog · server