Clock
Inputs
| Pin | Type | Description |
|---|
This element has no inputs.
Outputs
| Pin | Type | Description |
|---|---|---|
| Q | bit | Toggles between 0 and 1 on each simulation step |
How It Works
The Clock is an automatic timing generator that produces a continuous square wave: 0 → 1 → 0 → 1 → …
On each simulation step, the Clock toggles its output state. This means:
- Step 1: Q = 1 (rising edge)
- Step 2: Q = 0 (falling edge)
- Step 3: Q = 1 (rising edge)
- Step 4: Q = 0 (falling edge)
- … and so on
In tickMode (levels 11+), you control the clock through the Clock Control panel (▶ Play / ⏸ Pause / ⏭ Single Step). The panel manages all Clock elements simultaneously and ensures coordinated timing across the entire circuit.
In non-tickMode levels, the Clock toggles automatically on each call to runStep() or the simulation solver.
Usage
The Clock is required for all sequential circuits. It is used in the following levels:
- Level 11: D Flip-Flop — first clocked element.
- Level 12: 8-bit Register.
- Level 14: Program Counter.
- Level 16: CPU — the Clock drives the entire Harvard processor.
- Levels 17–18, 20: instruction-level operation.
- Levels 24–29: I/O peripheral clocking.
Connect the Q output to the Clock input of all sequential elements. The Clock itself has no configuration — its behavior is governed by the Clock Control panel in tickMode levels.