G6.3.1 The Ripple Counter's False Counts

EasyImplementIcarus · browser samples / server checksReview the topic

Find the false values a 4-bit ripple down counter shows between counts, its settle time, and which decoded count glitches.

Hardware context: A low-power timer whose 4-bit ripple down counter feeds a comparator that fires on counts it never reached. Work out the false counts, settle time and glitching decodes of a ripple down counter.

A low-power timer counts down with a 4-bit ripple counter. A comparator watches its outputs, and it fired on a count the timer never reached. You must list the values the outputs really pass through.

This is an Implement problem with numbers as answers. Each answer is a constant in the answer module. The first three are worked examples, already filled in.

Signals in the Timeline

SignalWidthRole
question8input of each check
Full specification
The counterValue
Bitsq3 q2 q1 q0, written as 4 binary digits
Stage 0toggles at every active clock edge
Stage i (1 to 3)toggles when stage i-1 rises from 0 to 1, so the counter counts down
Delayeach stage changes 3 ns after the event that toggles it

A false value is a value the outputs show for a moment between the old count and the new one. Times are in ns from the clock edge.

The answer module (starter)
// answer: one constant per question. Replace each value with the number you worked out.
module answer;
  localparam logic [7:0]  SETTLE_5_TO_4   = 8'd3;   // worked example: ns after the edge until 0101 becomes 0100 (only bit 0 changes)
  localparam logic [3:0]  FALSE_6_TO_5    = 4'd7;   // worked example: the one false value between 0110 and 0101 (bit 0 rises, so bit 1 toggles next)
  localparam logic [3:0]  COUNT_6_TO_5    = 4'd1;   // worked example: how many false values appear between 0110 and 0101
  localparam logic [3:0]  F1_8_TO_7       = 4'd0;   // the first false value between 1000 and 0111
  localparam logic [3:0]  F2_8_TO_7       = 4'd0;   // the second false value between 1000 and 0111
  localparam logic [3:0]  F3_8_TO_7       = 4'd0;   // the third false value between 1000 and 0111
  localparam logic [7:0]  SETTLE_8_TO_7   = 8'd0;   // ns after the edge until 1000 becomes 0111
  localparam logic [3:0]  COUNT_12_TO_11  = 4'd0;   // how many false values appear between 1100 and 1011
  localparam logic [3:0]  LAST_0_TO_15    = 4'd0;   // the last false value before 0000 wraps to 1111
  localparam logic [3:0]  GLITCH_15_STEPS = 4'd0;   // how many of the 16 steps down make a decoder for 1111 glitch
  localparam logic [7:0]  MIN_PERIOD      = 8'd0;   // shortest clock period in ns if every count must be settled 8 ns before the next edge
endmodule

Examples

Example 1

Worked: 0101 To 0100
Input
ns after the edge until 0101 becomes 0100 (only bit 0 changes)
Output
settle_5_to_4 = 3

Bit 0 falls from 1 to 0. A fall does not borrow, so no other stage toggles. The count settles 3 ns after the edge.

Example 2

Worked: The False Value Between 0110 and 0101
Input
the one false value between 0110 and 0101 (bit 0 rises, so bit 1 toggles next)
Output
false_6_to_5 = 'b0111

Bit 0 rises first, giving 0111 at 3 ns. That rise toggles stage 1, which falls: 0101 at 6 ns.

Example 3

Worked: How Many False Values
Input
how many false values appear between 0110 and 0101
Output
count_6_to_5 = 1

Only 0111 appears between 0110 and 0101, so the count is 1.

Constraints and Contract

  • Write each value as a whole number (binary literals are fine, for example 4'b1001).
  • Keep the module name answer and the constant names.

Hints

Hint 1

Only stage 0 sees the clock. Flip bit 0 first. If it went from 0 to 1, stage 1 flips 3 ns later. Go on until a stage falls or you run out of stages.

Hint 2

Take 0100 as an example. Bit 0 rises (0101), so bit 1 flips; it rises too (0111), so bit 2 flips. Bit 2 falls (0011), so the ripple stops.

Hint 3

A decoder for 1111 glitches on a step whose false values include 1111. Walk the steps whose low bits are 0 and see where the rises stop.

What the grader checks: Each constant is compared with a JavaScript model of the ripple down counter. The same transitions are measured on Icarus with 3 ns stages in tools/probes/digital/g6-probes.mjs.

11 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

Worked: 0101 To 0100

Input
ns after the edge until 0101 becomes 0100 (only bit 0 changes)
Expected output
settle_5_to_4 = 3

Bit 0 falls from 1 to 0. A fall does not borrow, so no other stage toggles. The count settles 3 ns after the edge.

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

Icarus · browser samples / server checks