Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • How to Use This Course
  • Reading Paths
  • Quick Start: Your First Green Build
  • Part 1: How Chips Get Made6
  • Part 2: Your Workstation5
  • Part 3: Specify and Architect3
    • Writing a Testable Spec
    • From Spec to Microarchitecture
    • Golden Model and Register Contract
  • Part 4: The Design Loop6
  • Part 5: The Verification Ladder6
  • Part 6: Automation and Reproducibility5
  • Part 7: Hand-Off to the Back-End3
  • Part 8: When Things Go Wrong3
  • Part 9: Project and Next Steps3
  • Reference4
Loading lesson

‹Part 3: Specify and Architect
  1. Topics
  2. Start Here: RTL and Verification
  3. Part 3: Specify and Architect
  4. From Spec to Microarchitecture

Part 3 · Specify and Architect · Foundation (F)

From Spec to Microarchitecture

Sketch the microarchitecture before writing RTL: datapath and control, the cycle contract, and the next-count selection for the event counter.

On this page

    Note

    Level: Foundation (F) · Answers: Before writing RTL, what do you decide, and how do you sketch it?

    Before this: Writing a Testable Spec

    Before writing RTL, what do you decide, and how do you sketch it?

    The spec says what each clock edge must produce. It does not say which boxes produce it. The step between them is the microarchitecture, which means the structure that meets the spec: where data is held, how it is combined, and what decides when.

    You draw that structure before you code it. A sketch on paper forces the timing decisions out in the open, where the spec author can still correct them. Code written first hides those decisions inside syntax, where nobody reviews them.

    Datapath holds and combines, control decides

    A microarchitecture splits into two halves. The datapath is where data is held and combined: registers that keep values and logic such as an adder that makes new ones. Control is what decides when: which value the datapath keeps on each edge.

    For the counter, the datapath is small: one 4-bit register holding the count, and an adder making count plus 1 with wrap from 15 to 0. Control is the priority order from the spec: reset first, then clear, then count, then hold. On every rising edge, control selects one of three candidates, 0, count plus 1, or the current count, and the register captures the choice.

    The figure below draws that sketch. Trace the loop first: the register output feeds back into the priority logic, so each decision sees the current count. Then check the three input arrows on the left and the clock arrow on top of the register.

    Datapath and control of the event counter. Trace the feedback loop first: the register output returns to the priority logic every cycle.

    The cycle contract pins every edge down

    The sketch needs one more piece before anyone codes: the cycle contract, which means the agreement about when inputs are sampled, when outputs change, and how many cycles each result takes. For this block the contract has three lines: inputs are sampled at the rising edge, the count changes only after that edge, and each event is accepted on exactly one edge.

    That contract answers the questions coders would otherwise guess at. A testbench knows it must hold inputs steady around the edge. A designer knows the new count is visible after the edge, never before. A reviewer knows that any output movement between edges breaks the contract, which is how the asynchronous reset mutant in lesson 5.1 gets caught.

    The table below maps each row of the spec behaviour table onto the sketch. It is a worked trace of the design decision, not a measurement: read each row as the priority logic asking its questions from the top down and stopping at the first yes.

    Spec row

    Inputs at the edge

    Priority logic selects

    Register captures

    Reset

    rst_n low, others do not matter

    0

    0

    Clear

    rst_n high, clear_count high

    0

    0

    Count

    rst_n high, clear_count low, event_valid high

    count + 1, wrapping 15 to 0

    count + 1

    Hold

    all control inputs quiet

    current count

    unchanged value

    Two rows select 0, and that sharing is deliberate: reset and clear need no separate paths, only the shared selection of zero with reset checked first. The counting row is the only one that uses the adder, and the hold row feeds the register its own output back unchanged.

    Latency answers when, throughput answers how many

    Latency is the delay from an input to its visible result, counted in clock edges. Throughput is how many inputs the block handles per cycle. The two move independently: a block can be slow to answer yet accept new work every cycle, or answer fast yet take turns.

    This block takes one event per cycle and shows the result after the next rising edge. Its throughput is one event per cycle and its latency is one cycle. Both are derived from the spec, not measured: exactly one increment per edge, visible after that edge.

    Now change the requirement, illustratively, to accepting two events in one cycle. The sketch must change shape: the adder path handles a plus-two candidate, the interface grows a way to offer the second event, and the priority table gains new rows for collisions such as two events arriving with clear. New questions follow, such as whether clear beats one event or both. The point is not the new answer but the new questions: a changed requirement reopens the sketch before it reopens the code.

    Predict the sketch answer before you look

    Predict first Reset is high, clear is low, valid is high, and the current count is 15. What does the priority logic select, and what does the register hold after the edge?

    It selects count plus 1 with wrap, which is 0, and the register holds 0 after the edge. The first two priority questions answer no, the counting question answers yes, and the adder wraps 15 to 0.

    Two mistakes that skip the sketch

    • Starting to code before the cycle contract exists. Without agreed sampling and update times, the designer and the testbench author each invent their own, and the mismatch surfaces as a failure neither side can explain. Write the three contract lines first: when inputs are sampled, when outputs change, how many cycles each result takes.

    • Leaving reset behaviour unstated. A sketch with no reset box leaves the power-on value and the reset priority to chance, and every later stage pays for the gap. Draw where reset enters, state its type and polarity, and give it the top priority row as this sketch does.

    Rule: draw the boxes and the cycle contract before you write a line of RTL.

    Check yourself Point at the figure: where is control and where is datapath?

    Control is the priority logic box with its reset, clear, count, hold order: it decides which candidate wins. Datapath is the 4-bit register plus the adder making count plus 1: it holds the value and builds the candidates. The feedback arrow between them closes the loop the decision needs.

    Check yourself The hold row feeds the register its own output. Why is that a design decision rather than doing nothing?

    A clocked register captures something every edge, so holding still needs a selected value: its own current output. Naming it in the table forces the coder and the testbench to agree that idle keeps a nonzero value instead of drifting to zero.

    Check yourself A new requirement says the block must accept bursts of two events in one cycle, and the result may appear one cycle later. Do you spend your budget on latency or on throughput, and why?

    On throughput. The requirement asks for two events per cycle, which is a throughput demand: the interface and the adder path must handle the wider input. Latency may stay at one cycle since the result is allowed the same delay as before. So you widen the selection to cover the two-event case and add its priority rows, while the register still captures one cycle later.

    Interview

    Asked: "What is the difference between latency and throughput?"

    Weak answer: They both mean speed: a faster block has more of both.

    Strong answer: Latency is the delay from an input to its visible result, and throughput is how many inputs the block handles per cycle. This counter takes one event per cycle with the result visible after the next edge, so its throughput is one event per cycle and its latency is one cycle. A block can accept work every cycle yet answer late, which is high throughput with high latency.

    Follow-ups: (1) What would change in the sketch if the block had to accept two events per cycle? (2) How would you check the latency claim in a testbench?

    Key takeaways

    • Microarchitecture is the structure that meets the spec: datapath holds and combines, control decides.

    • The cycle contract states when inputs are sampled, when outputs change, and how many cycles each result takes.

    • Latency measures delay to the result; throughput measures inputs per cycle; each can change without the other.

    Keep going

    Next: Lesson 3.3, Golden Model and Register Contract. The sketch is drawn. The next lesson builds the answer key the design will be checked against: an independent golden model.

    Related topics

    • RTL Design course

    • RTL course: Simulation and Testbenches

    • Earlier in this part: Writing a Testable Spec

    Previous

    16 / 47

    Next: Golden Model and Register Contract

    Up next

    Up nextGolden Model and Register Contract

    Sign in to save progress

    Practice this lessonReport an error