S8.2.1 The TAP Controller

MediumImplement24 minIcarus Verilog · serverReview the topic

Build the clocked controller that lets the same pins select an instruction or scan a data register.

Hardware context: Two TAPs on the ap_soc board scan chain. Identifying devices on an assembled board

A board monitor logs the current TAP state using the exercise codes below. Drive that code after every rising TCK edge.

Signals in the Timeline

SignalWidthRole
row12input of each check
Full specification
State codeNameTMS 0 leads toTMS 1 leads to
0ResetIdleReset
1IdleIdleSelect-DR
2Select-DRCapture-DRSelect-IR
3Capture-DRShift-DRExit1-DR
4Shift-DRShift-DRExit1-DR
5Exit1-DRPause-DRUpdate-DR
6Pause-DRPause-DRExit2-DR
7Exit2-DRShift-DRUpdate-DR
8Update-DRIdleSelect-DR
9Select-IRCapture-IRReset
10Capture-IRShift-IRExit1-IR
11Shift-IRShift-IRExit1-IR
12Exit1-IRPause-IRUpdate-IR
13Pause-IRPause-IRExit2-IR
14Exit2-IRShift-IRUpdate-IR
15Update-IRIdleSelect-DR

A falling trst_n resets the controller immediately, even between clocks. Hold Reset while trst_n is low. Releasing reset alone leaves the state unchanged.

Examples

Example 1

Reset Pulse
Input
Assert and release trst_n
Output
state = 0

The asynchronous input establishes the starting state.

Example 2

Release to Idle
Input
TMS low at the next rise
Output
state = 1

The first low takes the idle branch.

Example 3

Select a Scan
Input
TMS high from Idle
Output
state = 2

From Idle a high opens the data branch.

Constraints and Contract

  • Use module tap_control. Only a rising TCK edge samples TMS. A pause lasts as many edges as the host requests.

Hints

Hint 1

Give each row a name or code.

Hint 2

Separate the state storage from your transition decisions.

Hint 3

Trace both exits from each pause.

What the grader checks: Both outgoing arcs, asynchronous reset and between-edge stability are exercised from all sixteen states.

104 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 3 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

Reset Pulse

Input
Assert and release trst_n
Expected output
state = 0

The asynchronous input establishes the starting state.

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

Icarus Verilog · server