Altifigence Academy

1 / 24 · Concept

Turn an equation into a datapath contract

Specify widths, acceptance events, and valid results alongside the arithmetic.

Specify what the circuit promises

A datapath stores, selects, and computes values. Its controller decides which values move and when. These are separate design responsibilities, but they are not independently running software tasks. At a clock edge, control signals decide register updates; those register values become inputs to combinational logic during the following cycle. An equation without this timing contract can produce the right number for the wrong transaction.

Our small calculator accepts unsigned eight-bit operands a and b and a two-bit operation. Operation 0 adds, 1 subtracts, 2 computes AND, and 3 computes XOR. Arithmetic returns the low eight bits, with a separate addition carry or subtraction borrow. Later projects also carry a tag. A tag does not change the calculation, but it identifies the input that produced a result, so it must travel with that result.

Contract itemChoice in this course
Operand meaningUnsigned integers from 0 through 255
NarrowingLow eight bits, modulo 256
Boundary informationADD carry and SUB borrow
AcceptanceRising edge with valid and ready both asserted
OrderingResults follow accepted-input order
ResetDiscard outstanding work and clear valid state

For a=250, b=10, and ADD, the mathematical sum is 260. The output is 4 with carry=1. Signed interpretation or saturation would give a different contract. Do not let an accidental language conversion choose the policy. Wrapping arithmetic may suit address counters, while a brightness calculation may require saturation.

Transaction path
  1. Accept: Capture operands, operation, and tag
  2. Compute: Apply the specified numeric contract
  3. Deliver: Transfer result and matching tag

An invalid ALU output may still change electrically; it does not represent a transaction. A valid result with an old tag is also incorrect. Inspect data, tag, and valid together. For every output, answer both what the bits mean and when a consumer may trust them. The cycle models here check functionality and ordering, not physical gate delays. Translate the contract into a reference model before choosing register boundaries for a latency or throughput target.

Try it yourself

Record the eight-bit ADD result and carry for a=250 and b=10. Explain the value 4 and why the tag must be stored with the result.

Read the explanation

260=1×256+4, so data=4 and carry=1. The low-eight-bit contract reduces the sum modulo 256. Store the tag under the same acceptance, stall, and delivery conditions as the data so the result remains associated with its input.

Your choice applies to this browser. Change it any time using the footer.