S3.13.1 What the Flash Holds

MediumImplement22 minIcarus Verilog · serverReview the topic

Follow bytes of flash through erases and writes, count the erases of two update schemes, and burn one-time bits.

Hardware context: One erase block of a flash memory and eight one-time programmable bits, as test code. Storing settings, counts and keys that must survive with the power off

A flash block holds four bytes. An erase sets every bit of the block to 1. A write can only clear bits: the byte becomes the AND of what it held and what was written. One-time bits go the other way: a burn can only set bits, and nothing clears them.

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

Enter each byte as a number. A hexadecimal literal such as 8'h3c is allowed. Enter counts as whole numbers.

EntryYour decision
AFTER_ERASEWhat does a byte hold just after its block was erased?
FIRST_WRITEAn erased byte is written with 8'h5a. What does it hold?
SECOND_WRITEThat byte, now 8'h5a, is written with 8'ha5 with no erase. What does it hold?
OVERWRITEA byte holds 8'hf0. It is written with 8'h3c with no erase. What does it hold?
SAME_AGAINA byte holds 8'h3c. The same value 8'h3c is written again. What does it hold?
SET_A_BITA byte holds 8'h0f. A program writes 8'hff to set the high bits. What does it hold?
ERASES_SAME_BYTEA count is updated 12 times, always in byte 0, with an erase before each update. How many erases?
ERASES_NEXT_FREEThe same 12 updates go to the next free byte of the block of four. The block is erased only when it is full, and once before the first update. How many erases?
FUSES_AFTEREight one-time bits hold 8'b0000_0101. A program burns 8'b0000_0110. What do they hold?
FLOOR_AFTERA version floor is the number of one-time bits that are 1. What is it after that burn?
ERASES_VARIANTA count is updated UPDATES times with the next-free-byte scheme, in a block of four bytes, with one erase before the first update. Give the number of erases.

Examples

Example 1

AFTER ERASE
Input
What does a byte hold just after its block was erased?
Output
matches = 1

An erase sets all eight bits: ff, which is 255.

Example 2

FIRST WRITE
Input
An erased byte is written with 8'h5a. What does it hold?
Output
matches = 1

ff AND 5a is 5a, which is 90.

Example 3

SECOND WRITE
Input
That byte, now 8'h5a, is written with 8'ha5 with no erase. What does it hold?
Output
matches = 1

0101 1010 AND 1010 0101 share no 1, so the byte is 00.

Constraints and Contract

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

Hints

Hint 1

A write to flash clears bits. A burn of one-time bits sets bits. Neither can go back.

Hint 2

Write both bytes in binary, one under the other, before you combine them.

Hint 3

Ask how many updates one erase can serve.

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

AFTER ERASE

Input
What does a byte hold just after its block was erased?
Expected output
matches = 1

An erase sets all eight bits: ff, which is 255.

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

Icarus Verilog · server