S9.8.2 Is the Accelerator Worth It

MediumImplement22 minIcarus Verilog · serverReview the topic

Use cycles measured on the real ap_rv32 to decide when the CRC engine pays, and which way of attaching it wins.

Hardware context: A CRC engine of ap_soc attached as a register-mapped subordinate, a stream fed by the DMA and a bus manager, beside the real ap_rv32. Accelerator integration and offload decisions

These are the windows that the real five-stage ap_rv32 read from mcycle for the programs of lesson S9.8. The engine takes one word in each cycle. Every way gives the same CRC.

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
WordsSoftware CRCSoftware sumRegister-mappedStream via DMABus manager
126911141816
253218221816
379525302316
1642141161344831
641683845251814376

For 16 words the lab counted bus transfers. Register-mapped: 34 by the processor. Stream: 13 by the processor and 32 by the DMA. Bus manager: 8 by the processor and 16 by the engine.

Enter a way as 1 software, 2 register-mapped, 3 stream via DMA, 4 bus manager. Enter ratios cut down to a whole number.

EntryYour decision
FASTEST_16For a CRC of 16 words, which way is fastest?
SPEEDUP_16How many times faster than the software CRC is that way, for 16 words?
RM_PER_WORDHow many cycles does each extra word cost the register-mapped way? Use 16 and 64 words.
MGR_FLOORThe fewest cycles that the bus manager way ever needs, from the table.
CRC_BREAK_EVENFrom how many words on does the bus manager beat the software CRC?
SUM_BREAK_EVENFrom how many words on would the bus manager beat a software sum?
RM_VS_SUMDoes the register-mapped way ever beat the software sum? 1 yes, 0 no.
FREE_TRANSFERSFor 16 words, how many bus transfers does the processor save with the bus manager, against the register-mapped way?
DMA_TRANSFERSFor 16 words, how many bus transfers do the DMA and the engine make together in the stream way?
STREAM_VS_MGRFor 64 words, how many cycles does the stream way lose against the bus manager?
SUM_OR_ENGINEA plain sum of N words takes software 7 × N + 4 cycles. The bus manager takes 16 for N up to 5, and 21 for 8. Which is faster: 1 software, 2 the engine?

Examples

Example 1

FASTEST 16
Input
For a CRC of 16 words, which way is fastest?
Output
matches = 1

31 cycles, against 48, 134 and 4214.

Example 2

SPEEDUP 16
Input
How many times faster than the software CRC is that way, for 16 words?
Output
matches = 1

4214 / 31 = 135.9.

Example 3

RM PER WORD
Input
How many cycles does each extra word cost the register-mapped way? Use 16 and 64 words.
Output
matches = 1

(518 − 134) / 48 = 8: the processor loads the word and stores it into DATA.

Constraints and Contract

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

Hints

Hint 1

Every hardware way pays a fixed set-up before the first word.

Hint 2

Software pays the work; the register-mapped way pays the moving; the engine pays one cycle.

Hint 3

Light work, like a sum, leaves little for the engine to win.

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 2 problems 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

FASTEST 16

Input
For a CRC of 16 words, which way is fastest?
Expected output
matches = 1

31 cycles, against 48, 134 and 4214.

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

Icarus Verilog · server