S11.4.1 Size the Sensor Hub

HardImplement22 minIcarus Verilog · serverReview the topic

Fill in the sizing sheet of a sensor hub with new sensors, a shorter batch and a slower host link, the way lesson S11.10 does.

Hardware context: Small SoCs reviewed before design: a sensor hub and a logger, sized and checked column by column. Size the clocks, buffers, interrupt count and memory of a sensor hub from its sensor streams.

This is the hub of lesson S11.10 with other numbers. Use its rules: a 2-byte tag on each record, a ring holding one batch plus what arrives during the read, and the slowest core clock that keeps the load under its cap.

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
SensorBusSampleRate
AccelerometerSPI6 bytes800 a second
GyroscopeSPI6 bytes200 a second
MagnetometerI2C6 bytes50 a second
Pressure sensorI2C3 bytes10 a second
Design inputValue
Record tag2 bytes with every sample
Batchthe host reads one batch every 1000 ms, over a SPI link of 4,000,000 bits a second
Watermarkthe accelerometer and gyroscope raise one request every 20 samples; the other two, one for each sample
Core work400 cycles for each sample, plus 60 cycles for each request
Core clock25 MHz divided by 1, 2, 4, 8 or 16; the load must stay at or under 25 percent
SRAMstorage plus 2048 bytes of stack and 1024 of driver data, rounded up to a power of two
DMA rulethe host link needs DMA when the core has fewer than 20 cycles for each byte
Sensor SPI busone sample read takes (1 + 6) bytes at 500,000 bits a second; the accelerometer is always served first

Round a time or a byte count up, and a percentage or cycles for each byte down. Enter KiB as a number: 16 for 16 KiB. Enter 1 for yes and 0 for no.

EntryYour decision
RECORD_RATEBytes stored each second, tags included.
BATCH_BYTESBytes in one batch.
SAMPLESSamples taken each second, by all four sensors.
HOST_READ_USMicroseconds to send one batch over the host link.
ARRIVE_BYTESBytes that arrive while the host reads a batch.
RING_BYTESBytes of the ring buffer.
DOUBLE_BYTESBytes of a double buffer.
SRAM_KIB_RINGKiB of SRAM with the ring.
SRAM_KIB_DOUBLEKiB of SRAM with the double buffer.
IRQ_WATERMARKRequests each second, with the watermark of 20.
CORE_DIVIDERThe divider of the slowest core clock that keeps the load at or under 25 percent.
LOAD_PCTThe load at that clock, in percent, rounded down.
CYCLES_PER_BYTECore cycles for each byte of the host link, rounded down.
DMA_NEEDEDDoes the host link need DMA? 1 for yes, 0 for no.
ACC_FIFO_MAXThe most samples the accelerometer FIFO ever holds.
IRQ_AT_WThe accelerometer and gyroscope now raise one request for every W samples. The other two sensors still raise one for each sample. How many requests a second in all?

Examples

Example 1

RECORD RATE
Input
Bytes stored each second, tags included.
Output
matches = 1

8 × 800 + 8 × 200 + 8 × 50 + 5 × 10.

Example 2

BATCH BYTES
Input
Bytes in one batch.
Output
matches = 1

One second of records.

Example 3

SAMPLES
Input
Samples taken each second, by all four sensors.
Output
matches = 1

800 + 200 + 50 + 10. Without watermarks, each is one request.

Constraints and Contract

  • Keep the parameter and named constants. Use the numeric codes and units on this page.
  • For IRQ_AT_W, enter a constant expression using W. Only this entry changes with the parameter. The supported integer range is 5 through 40, inclusive.
  • Replace each unfinished 65535 with your number.

Hints

Hint 1

Add the tag to each sample before multiplying by the rate.

Hint 2

A ring holds one batch plus what arrives during the read; the SRAM is a power of two.

Hint 3

Find the cycles a second, divide by the cap, and pick the slowest divider that is fast enough. Then check the host link.

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

16 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

RECORD RATE

Input
Bytes stored each second, tags included.
Expected output
matches = 1

8 × 800 + 8 × 200 + 8 × 50 + 5 × 10.

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

Icarus Verilog · server