Implement a sequential digital dice circuit that captures a number from 1 to 6 when the R button is pressed. The captured number must remain stored until the button is pressed again.
Constraints
A ring counter is a shift register whose last output is connected back to its first input.
Only one HIGH bit normally moves through the register.
3-Bit Architecture
For a 3-bit ring counter:
D0 = Q2D1 = Q0D2 = Q1Fig. 1: 3-bit Ring Counter

Working
Assume the initial state is 001.
At every active clock edge, the HIGH bit moves to the next position.
Table 1: Ring-Counter Sequence
| Clock | Q2Q1Q0 |
|---|---|
| 0 | 001 |
| 1 | 010 |
| 2 | 100 |
| 3 | 001 |
A valid initial value must contain one HIGH bit. The state 000 cannot start the ring sequence by itself.
A Johnson counter is a shift register in which the inverted last output is connected back to the first input.
It is also called a:
3-Bit Architecture
For a 3-bit Johnson counter:
D0 = ~Q2D1 = Q0D2 = Q1Fig. 2: 3-bit Johnsons Counter

Working
A 3-bit Johnson counter produces six different states.
Table 2: Johnson-Counter Sequence
| Clock | Q2Q1Q0 |
|---|---|
| 0 | 000 |
| 1 | 001 |
| 2 | 011 |
| 3 | 111 |
| 4 | 110 |
| 5 | 100 |
| 6 | 000 |
For an n-bit Johnson counter:
Number of states = 2n
A ring counter needs an initial data pattern before shifting can begin.
Data can be loaded using:
In synchronous loading, data is loaded only at the active clock edge.
A 2-to-1 multiplexer is connected before every D input.
The control input LD selects between:
LD = 1: Load parallel dataLD = 0: Shift the stored dataFig. 3: Ring Counter with Synchronous Data Loading

Connections
For parallel data P2P1P0:
D0 = LD · P0 + ~LD · Q2
D1 = LD · P1 + ~LD · Q0
D2 = LD · P2 + ~LD · Q1Table 3: Synchronous Loading Operation
| LD | Operation |
|---|---|
| 0 | Ring shifting |
| 1 | Load P2P1P0 |
Working
P2P1P0.LD = 1.LD = 0.
Asynchronous loading uses active-LOW PRESET and CLEAR inputs.
The data is loaded without waiting for a clock edge.
Table 4: Asynchronous Bit Loading
| Required Bit | ~PRE | ~CLR | Result |
|---|---|---|---|
| Shift mode | 1 | 1 | Normal operation |
| Load 0 | 1 | 0 | Output becomes 0 |
| Load 1 | 0 | 1 | Output becomes 1 |
| Invalid | 0 | 0 | Not allowed |
Fig. 4: Ring Counter with Asynchronous Data Loading

Working
To load 101:
Q2 = 1: ~PRE2 = 0, ~CLR2 = 1Q1 = 0: ~PRE1 = 1, ~CLR1 = 0Q0 = 1: ~PRE0 = 0, ~CLR0 = 1After loading:
~PRE = 1~CLR = 1
A controlled counter can work as either a ring counter or a Johnson counter.
A control input C selects the feedback signal.
3-Bit Connections
P0 = Q2 ⊕ C
P1 = Q0
P2 = Q1Fig. 5: Ring/Johnsons Counter with Control Input C

Table 5: Counter Selection
| C | Feedback to D0 | Operation |
|---|---|---|
| 0 | Q2 | Ring counter |
| 1 | ~Q2 | Johnson counter |
Data Loading
A 3-bit parallel data input can be used to set the initial state.
001.000.Working
When C = 0
The XOR output follows Q2.
D0 = Q2
The stored bit pattern circulates through the three stages.
When C = 1
The XOR output becomes ~Q2.
D0 = ~Q2
The circuit follows the Johnson-counter sequence.
Registers and counters can be combined to store data, count clock cycles and control circuit operation.
The clock-gating circuit produces a fixed number of output clock edges.
Inputs and Output
Inputs:
SEND3-bit CYCLESClockOutput:
CLK_OUTFig. 6: Programmable Clock Gating Circuit

Main Blocks
The circuit contains:
Edge Detection
When SEND changes from 1 → 0, the edge detector produces one pulse:
SEND_EDGE = 1
This pulse is connected to the J input of the JK flip-flop.
Counter Control
The counter uses:
LD = 1: Load CYCLESLD = 0: Count downThe connection is:
LD = ~ENABLE
Therefore:
ENABLE = 0: Load modeENABLE = 1: Count modeStop Detection
The counter reaches zero when:
Q2Q1Q0 = 000
The STOP equation is:
STOP = ~(Q0 + Q1 + Q2)STOP is connected to the K input of the JK flip-flop.
Clock Output
CLK_OUT = ENABLE · ClockWorking
ENABLE = 0.CYCLES.SEND changes from HIGH to LOW, SEND_EDGE = 1.ENABLE = 1.LD becomes 0, so the counter starts counting down.000, STOP = 1.ENABLE = 0.Table 6: Clock-Gating Operation
| Condition | ENABLE | Counter Mode | CLK_OUT |
|---|---|---|---|
| Idle | 0 | Load | 0 |
| Transmission active | 1 | Count down | Clock |
| Counter reaches 000 | 0 | Load | 0 |
The number of output clock edges is controlled by the value stored in CYCLES.
The digital dice combines:
Fig. 7: Digital Dice

Counter Operation
The MOD-6 counter repeatedly counts:
1 → 2 → 3 → 4 → 5 → 6 → 1The counter runs continuously using a high-speed clock.
Roll Input
The push button R produces HIGH when pressed.
An active-HIGH output rising-edge detector generates one pulse when:
R: 0 → 1
The edge-detector output is connected to the clock of the PIPO register.
Working
R.7_Seg_BCD_display.The captured value appears random because the counter changes faster than the user can observe.
The target landing game uses an 11-bit ring counter connected to 11 active-HIGH LEDs.
LED Sequence
White → White → Blue → Blue → Red → Yellow → Red → Blue → Blue → White → WhiteThe illuminated LED shows the landing position and score category.
Inputs:
P – Point buttonR – Reset/Run buttonPOWER – Forces reset modeFig. 8: Target Landing Game Circuit

Reset and Run Control
Button R uses an active-HIGH output rising-edge detector.
Its output R_EDGE clocks a T flip-flop.
Connections:
T = 1PRE = 1Q = RST_NEach press of R toggles RST_N.
Table 7: Reset and Run Modes
| RST_N | Mode | LED Operation |
|---|---|---|
| 0 | Reset mode | All LEDs OFF |
| 1 | Normal mode | Ring counter runs |
POWER keeps the circuit in reset mode regardless of the button inputs.
Starting the Ring
Another active-HIGH output rising-edge detector monitors RST_N.
When RST_N changes from 0 → 1:
RST_EDGE = 1
The first ring-register input is:
D0 = RST_EDGE + Q10
Therefore:
RST_EDGE inserts the first HIGH bit.Q10 provides normal ring feedback.The HIGH bit then moves rapidly through the LEDs.
Stopping the LED
Button P uses another active-HIGH output rising-edge detector.
Its output P_EDGE clocks a D flip-flop.
Connections:
D = 1Clock = P_EDGEQ = OFThe gated ring clock can be represented as:
CLK_RING = Clock · RST_N · ~OFWorking
LEDs remain OFF.R to change RST_N from 0 to 1.RST_EDGE inserts one HIGH bit into the ring counter.HIGH bit moves rapidly through the LEDs.P_EDGE.OF = 1.~OF becomes 0 and blocks the ring clock.LED remains ON.P again does not restart the circuit.R to return to reset mode.R again to start a new round.
The custom UART circuit sends a 4-bit data word with one start bit and one stop bit.
The complete frame contains six bits:
Start Bit + 4 Data Bits + Stop Bit
The transmitter uses a PISO register, and the receiver uses a SIPO register.
Fig. 9: Custom UART Model

Main Inputs and Outputs
Inputs:
Input_Data)SENDClock~RESETOutputs:
D_Out)TXStart Detection
An active-HIGH output falling-edge detector monitors SEND.
When:
SEND: 1 → 0
It produces:
SEND_P = 1
SEND_P is connected to the J input of a positive-edge-triggered JK flip-flop.
Transmission Control
The JK flip-flop output is:
ENABLE = Q
The transmission flag is:
TX = ENABLE
The gated shift clock is:
SHIFT_CLK = ENABLE · Clock
Bit Counter
A 3-bit synchronous up counter counts the transmitted bits.
The counter counts from 0 to 5.
The STOP output becomes HIGH at decimal 5:
STOP = Q2 · ~Q1 · Q0
STOP is connected to the K input of the JK flip-flop.
The counter reset control uses:
~CLR = ENABLE
Therefore:
ENABLE = 0: Counter remains reset.ENABLE = 1: Counter operates normally.Working
~RESET = 0 resets the complete circuit.SEND changes from HIGH to LOW.SEND_P.ENABLE = 1.TX becomes HIGH.5, STOP = 1.ENABLE = 0.TX returns LOW.Table 8: UART Transmission Stages
| Stage | Operation |
|---|---|
| Idle | ENABLE = 0, TX = 0 |
SEND falling edge | SEND_P = 1 |
| Transmission | ENABLE = 1, PISO and SIPO shift |
Count reaches 5 | STOP = 1 |
| Complete | Clock stops and received frame remains stored |
The circuit transmits exactly one 6-bit frame for each valid SEND falling edge.