G5.3.1 Catch the Glitchy Circuits

MediumBreak ItIcarus · browser samples / server checks4 hidden designsReview the topic

Write input sequences that make four timed gate circuits glitch: a static-1, a static-0, a dynamic and a function hazard.

Hardware context: Four control circuits whose outputs feed edge-sensitive pins on a board, each logically correct. Write ten or fewer input vectors that expose all four hazards.

A board review found four control circuits whose outputs feed edge-sensitive pins. Each one is logically correct, and each one can glitch. Before anyone redesigns them, the reviewer wants a test that shows every glitch on a simulator.

This is a Break it problem. In the task stimulus, call apply once for each input vector {a, b, c}, at most ten times. The bench plays your vectors into all four circuits at once.

Inputs that change in one step do not change at the same instant. a goes first, then b one time unit later, then c. Circuits 1 to 3 must glitch on a step that changes one input. Circuit 4 must glitch on a step that changes more.

Signals in the Timeline

SignalWidthRole
hidden_circuit8input of each check
Full specification
The four circuits. Every gate takes 1 time unit
// Circuit 1: y = a'c' + ab + bc
module circuit1 (input wire a, b, c, output wire y);
  wire na, nc, t1, t2, t3;
  not #1 g1 (na, a);
  not #1 g2 (nc, c);
  and #1 g3 (t1, na, nc);
  and #1 g4 (t2, a, b);
  and #1 g5 (t3, b, c);
  or  #1 g6 (y, t1, t2, t3);
endmodule

// Circuit 2: y = (a + b')(b + c)(a' + c)
module circuit2 (input wire a, b, c, output wire y);
  wire na, nb, s1, s2, s3;
  not #1 g1 (na, a);
  not #1 g2 (nb, b);
  or  #1 g3 (s1, a, nb);
  or  #1 g4 (s2, b, c);
  or  #1 g5 (s3, na, c);
  and #1 g6 (y, s1, s2, s3);
endmodule

// Circuit 3: y = c + (c'a + cb)', an inverted mux on c ORed with c
module circuit3 (input wire a, b, c, output wire y);
  wire nc, t1, t2, m, mn;
  not #1 g1 (nc, c);
  and #1 g2 (t1, a, nc);
  and #1 g3 (t2, b, c);
  or  #1 g4 (m, t1, t2);
  not #1 g5 (mn, m);
  or  #1 g6 (y, c, mn);
endmodule

// Circuit 4: y = ab + bc + ac (majority), every prime implicant present
module circuit4 (input wire a, b, c, output wire y);
  wire t1, t2, t3;
  and #1 g1 (t1, a, b);
  and #1 g2 (t2, b, c);
  and #1 g3 (t3, a, c);
  or  #1 g4 (y, t1, t2, t3);
endmodule
What you write
task automatic stimulus();
  apply(3'b000);   // {a, b, c}: the first call sets the start
  apply(3'b100);   // each later call is one step
endtask
RuleDetail
VectorsAt least 2 and at most 10 calls of apply. The first sets the starting inputs.
SkewIn one step, a changes first, b one time unit later, c one time unit after that. Unchanged inputs are skipped.
SettleAfter its last input change, each step waits 12 time units.
GlitchIn one step, the output moved twice or more where its settled value stayed, or three times or more where it changed.
CaughtCircuits 1 to 3 count a glitch only in a step that changes exactly one input. Circuit 4 counts one only in a step that changes two or more.

Examples

Run samples checks your input rules. Check all tests runs every faulty copy on the server. The worked bug examples below describe full grading results.

Example 1

Your Vectors Follow the Rules
Input
stimulus() makes 2 to 10 calls of apply
Output
inputs_legal = yes

The first row checks the number of vectors only. Any three-bit vector is allowed.

Example 2

Circuit 1 Is Caught
Input
Your vectors, run on circuit 1
Output
caught = yes

Circuit 1 counts as caught when one of your steps makes its output move more than its settled values need. The expected result is caught = 1.

Example 3

Circuit 2 Is Caught
Input
Your vectors, run on circuit 2
Output
caught = yes

The same test for circuit 2. Every circuit needs its own caught = 1.

Constraints and Contract

  • Call apply at least twice and at most ten times inside stimulus.
  • Each vector is three bits {a, b, c}.

Hints

Hint 1

For a two-level circuit, draw its K-map. A static hazard sits between two touching groups that share no cell, and only one direction of the change glitches.

Hint 2

Find which term turns off first. In a sum of products, the term with the true literal reacts first. The term that waits for the inverter reacts one gate delay later.

Hint 3

Circuit 4 has every prime, so one input at a time never glitches it. Change two inputs in one step so that, with a going first, the inputs pass through a row of the other value.

What the grader checks: Your vectors are recorded, then played into the four gate netlists shown above, in one simulation. Every gate takes one time unit, and inputs that change in one step go in one time unit apart. Each circuit row reports whether its output glitched in a step of the kind its row counts.

5 checks on Icarus · browser samples / server checks. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain public samples only. A passing result establishes the tested cases, not a proof for all possible inputs.

See all 1 steps and the final capstone

Report a problem with this page

Your code SystemVerilogSaved locally
Ln 1, Col 1Tab indents · Ctrl/⌘ + Enter runs samples
Not run yet

Your Vectors Follow the Rules

Input
stimulus() makes 2 to 10 calls of apply
Expected output
inputs_legal = yes

The first row checks the number of vectors only. Any three-bit vector is allowed.

Run samples executes all 1 public checks. Check all tests runs 5 checks on the server.

Icarus · browser samples / server checks