§ 1.2. Time and Delay¶
Every part in CircuitSim changes its outputs some time after its inputs change. This page explains where those delays come from, what one unit of simulated time means, and how the rest of the site states timing. Component pages do not repeat it. Where a part's timing has something of its own to show (a carry chain, a setup time, an access chain), its page ends the implementation with a Timing paragraph and the few paths that matter.
Simulated time¶
The simulator keeps one global time, counted in ticks. A change on a wire is an event at a tick; a part that sees an input change computes its new outputs and schedules them for a later tick. Nothing moves between events, and there is one clock domain: every clock is a signal in the same time line.
Timing profiles¶
A timing profile decides how long each leaf part takes and what a tick is. A leaf part is one with no gate-level form of its own: the logic gates, the bus splitter, and the memory primitives that stand for electrical behavior (bitlines, sense amplifiers, charge storage). Every larger part takes its timing from its gates.
| Profile | A tick is | Gate delays | Use |
|---|---|---|---|
unit |
An abstract step | Every gate one tick | Default; all example tables on this site |
embedded |
1 ps | 65 nm logic, an inverter driving four copies of itself (FO4) in 30 ps | Microcontroller-class chips |
desktop |
1 ps | 32 nm logic, FO4 21 ps | Desktop-class chips |
The realistic profiles scale each gate by its fanout-of-four delay in FO4
units, from the logical-effort method: NAND 1.35 FO4, NOR 1.55 FO4, XOR 4
FO4, and AND or OR as a NAND or NOR followed by an inverter. Wires and the
splitter cost nothing in every profile. (unit charged the splitter one tick
until 2026-10-27; it is wiring, and with that tick a regrouping of the same
gates into word gates timed differently.)
Delay of each leaf part (the parts with no gate-level form), per timing profile.
| Leaf part | unitticks | embeddedps | desktopps |
|---|---|---|---|
NOT | 1 | 30 | 21 |
NAND | 1 | 41 | 28 |
NOR | 1 | 47 | 33 |
AND | 1 | 50 | 35 |
OR | 1 | 52 | 36 |
XOR | 1 | 120 | 84 |
| Splitter | 0 | 0 | 0 |
| Memory primitive | 1 | 30 | 21 |
unit gives every gate one tick instead. Values from the generated timing data.One profile is active for a whole run. Programs and tools read it from the
environment variable CIRCUITSIM_TIMING_PROFILE (default unit). The
interactive simulator has a Timing selector beside the
scenario, kept in the page address as ?timing=embedded; it shows times in
ps, ns, µs or ms when the profile's tick has a length, and in ticks for
unit. The example tables on component pages are recorded in unit, so
their times count gate delays.
Gates¶
A gate publishes its new output one gate delay after an input changes. The delay is inertial: if the inputs change back before a pending output has been published, the pending change is withdrawn. A pulse shorter than the gate's delay therefore does not pass through it, as in a real gate.
A part built from gates has no declared delay of its own. Its outputs settle when the last gate on the path that changed settles, so the time depends on the data: an adder whose carry stops after two positions settles sooner than one whose carry runs the full width.
Compact parts¶
Fidelity and timing are properties of a concrete component configuration. For a word component (a word gate, a mux or a chapter 2 unit), width, operation contract and adder topology identify that configuration. A structural family without a matching behavioral factory cannot select the compact form; a delay table for one width or topology does not describe another.
Most parts exist in two forms with the same pins and the same values: the structural form built from smaller parts down to gates, and a behavioral (compact) form that computes the result directly and is much faster to simulate. A compact part must not be faster than its gates, so it carries the delays proven on its gate-level form.
Proven delay table. For every input → output path, the analysis of the
gate-level form gives the earliest and the latest time the output can
change. A part with a control input (an ALU's operation, for example) has
one set of paths per control value. A clocked part adds clock → output
times, a setup time for each input, and the shortest clock period it can
take internally. The tables are generated for every profile by
part_delay_tables and checked against the gates. The full table of the
8-bit adder, for example:
Proven delays of word.ripple-carry-adder.8.behavioral (proven on word.ripple-carry-adder.8.structural). A delay twin times it from its current values within these bounds.
| Path | unitticks, minimum–maximum | embeddedps, minimum–maximum | desktopps, minimum–maximum |
|---|---|---|---|
| A → C_OUT | 2–17 | 102–936 | 71–652 |
| A → OUT | 2–16 | 222–954 | 155–665 |
| B → C_OUT | 2–17 | 102–936 | 71–652 |
| B → OUT | 2–16 | 222–954 | 155–665 |
| C_IN → C_OUT | 16 | 816 | 568 |
| C_IN → OUT | 1–15 | 120–834 | 84–581 |
Delay twin. Most compact parts also carry a flat list of their own gates. When their inputs change they walk that list once with the current values and find when each output is really final: a gate with an input at its deciding value (0 into AND, 1 into OR) does not wait for its other input. The part then publishes at that time, never later than its table allows. Parts whose gate-level form contains loops, self-timed memory cells, or too many gates use the table alone.
The delay rule. A compact part never publishes before its gates do, and
it should not be much later. The DelayRuleTest comparison runs both forms
of every part through the same situations and requires the gates' time to
be at least 70 % of the compact time on average and 90 % in the worst
measured case for each output, or a recorded exception with its measured
share. Parts that time themselves (DRAM, NOR flash, the SRAM device and their
controllers) are compared at the clock instead: same period, same cycles.
The compact form computes the final value once, so it does not reproduce the
short pulses (glitches) gates can make on the way. The option
CIRCUITSIM_STRICT_SETTLING=1 shows X on such an output from the earliest
time it can move until its gates are final.
Clocked parts¶
Storage is built from a gated latch pair: the D flip-flop and everything built from it. Its timing contract cannot be found by path analysis alone, because its gates form loops, so it is measured: every case is tried under the profile's gate delays.
Measured contract of the gate-level D flip-flop, per timing profile.
| Flip-flop contract | unitticks | embeddedps | desktopps |
|---|---|---|---|
| Setup before the rising edge | 6 | 231 | 160 |
| Hold after the rising edge | 1 | 0 | 0 |
| Clock to Q, earliest | 3 | 132 | 91 |
| Clock to Q, latest | 4 | 175 | 120 |
| Shortest clock high phase | 2 | 52 | 36 |
| Shortest clock low phase | 6 | 231 | 160 |
The SRAM cell is a loop of two inverters and is measured the same way:
Measured contract of the gate-level SRAM cell, per timing profile.
| SRAM cell contract | unitticks | embeddedps | desktopps |
|---|---|---|---|
| Earliest output change after a write | 2 | 71 | 49 |
| Latest output change after a write | 3 | 112 | 77 |
| Shortest spacing between writes | 2 | 42 | 29 |
A compact clocked part checks its own setup times while it runs: an input that changed less than its setup time before a rising clock edge is counted as a setup violation. Experiments on the cores require zero violations.
Memories¶
Memories contain electrical behavior that gates cannot express: a bitline
discharging, a sense amplifier deciding, a DRAM cell restoring its charge, a
flash cell being programmed. Each such interval is a delay line whose
length comes from the profile, and grows with the number of rows where the
physics does (longer bitlines are slower). External chips take their
intervals from datasheets in the realistic profiles: SDRAM (Micron
MT48LC16M16A2) in embedded, DDR4 (Micron MT40A1G8) in desktop, and NOR
flash (Infineon S29GL256S) in both. Large memories cannot be built from
gates (the limit is 4,096 cells), so their tables are grown from the proven
64- and 128-word forms and say that they are estimates. The memory chapter
describes each technology's access in its
Memory Timing section, with measured latencies per
profile.
Clocks¶
A clocked circuit works only if every flip-flop's input is stable for its setup time before each rising edge and for its hold time after it. The safe-clock analysis reads the whole circuit, every gate or the proven table of every compact part, and certifies the shortest clock period for which every setup, hold and pulse-width requirement is met. A circuit it cannot bound (for example a part that changes outputs at times of its own, with no clock around it) gets no certificate.
The certified periods of the three RV32I cores with flip-flop memory:
Certified clock period of each core with flip-flop memory, per timing profile.
| Core | unitticks | embeddedps (MHz) | desktopps (MHz) |
|---|---|---|---|
| Single-cycle | 142 | 7,164 (140) | 4,986 (201) |
| Baseline pipeline | 68 | 3,354 (298) | 2,334 (428) |
| Advanced pipeline | 80 | 4,104 (244) | 2,858 (350) |
The cores, their memory systems and caches are certified at these clocks; 4.2 Clock analysis gives the details.
What is not modelled¶
- Wire delay between gates (except the long global wires of large memory arrays) and fan-out loading beyond the FO4 assumption.
- Process, voltage and temperature variation; every gate of one kind has the same delay.
- Power, analog noise, and metastability: a synchronizer that samples a changing input keeps its previous value instead of resolving at random.
- More than one clock domain.