A set of research utilities in C++ for modeling and verifying parametron circuits (majority/inverter gates with delays), plus numerical simulation of parametric oscillators. The project is built with CMake and contains several standalone CLI tools.
The build produces the following binaries (see CMakeLists.txt):
parametron_ode— numerical integration of ODEs for two coupled parametric oscillators.parametron_logic— reference 8‑bit logic adder implementation (majority/inverter) + self‑test.parametron_tick— tick‑based model of an 8‑bit parametron adder (with delays and tracing).phazeride_adc— universal N‑bit adder with flags (C,V,Z,N) using either the logic model or the tick simulator.circuit_tick— library (internal core) used byparametron_tickandphazeride_adc.
Also included:
cli.sh— interactive REPL wrapper aroundphazeride_adcandparametron_tick.test.sh— script comparingphazeride_adcagainst a C reference (exhaustive for 8‑bit, randomized for other widths).- GitHub Actions: build (
.github/workflows/build.yml) and CI with tests (.github/workflows/test.yml).
- CMake ≥ 3.16
- C++20 compiler
bashforcli.shandtest.sh
cmake -S . -B build
cmake --build build -jBinaries will appear in build/.
./cli.shThe REPL supports adder runs, tracing, and simulation settings (see below).
./test.shThe script:
- builds the project,
- compiles a C reference,
- checks all combinations for width 8,
- runs random tests across selected widths.
Test parameters:
./test.sh --rand 5000 --seed 123456789 --widths "1 2 4 8 16 32 64"An N‑bit adder with flags. It can:
- compute
a + b + cin, - compute flags
C,V,Z,N, - run in two models:
logic(combinational) andtick(delay simulation), - print in
dec|hex|bin|all.
Example:
./build/phazeride_adc --a 250 --b 13 --cin 1 --width 8 --model tick --trace 1Key parameters:
--a,--b— inputs (decimal, hex0x.., bin0b.., negatives supported).--cin— input carry (0/1).--width— width (1..64).--model—logicortick.--signed— affects decimal printing only.--fmt—dec|hex|bin|all.--maj_delay,--not_delay,--ticks,--p_flip,--seed,--trace— tick simulator parameters.--strict 1— exit with error if result differs from reference.
Output includes:
- input values,
- sum,
- flags
C V Z N, - reference
ref_sumandref_cout.
Tick‑based simulation of an 8‑bit parametron adder with delays and tracing. Includes a full test mode.
Examples:
./build/parametron_tick --a 13 --b 250 --cin 1
./build/parametron_tick --a 13 --b 250 --cin 1 --maj_delay 2 --not_delay 1 --ticks 40
./build/parametron_tick --test --maj_delay 1 --not_delay 1Parameters:
--ticks— number of ticks (0 = critical).--maj_delay,--not_delay— element delays.--p_flip— flip‑error probability.--seed— RNG seed.--trace— enable trace output.
Logic (combinational) 8‑bit adder implementation. Useful as a reference.
Examples:
./build/parametron_logic --a 13 --b 250 --cin 1
./build/parametron_logic --testNumerical ODE solver for two coupled parametric oscillators (RK4). Modes:
run— standard run with phase/amplitude tracking.wave— outputs raw sinusoidal signals.sweep— sweeps overhrange to evaluate bistability.
Examples:
./build/parametron_ode --mode run --k_1to2 0.08 --k_2to1 0 --handoff_t 0.05 --k21_off 0 --k12_off 0 --kick_amp2 0 --kick_dur2 0
./build/parametron_ode --mode wave --t 0.001 --dt 1e-6 --out_every 1 --csv 1 > wave.csv
./build/parametron_ode --mode sweep --k 0.05 --h_from 0.2 --h_to 1.1 --h_step 0.02Key parameters:
--f0,--dt,--t,--zeta,--h,--alpha_ratio,--det_tau,--noise--k12,--k21or--k(set both couplings)--handoff_t,--k12_off,--k21_off--kick_*(shape and durations of startup “kicks”)--out_every,--csv--h_from,--h_to,--h_step,--amp_min--seed
cli.sh is a convenient shell for phazeride_adc and parametron_tick.
Supports:
add,tracecommands,- width/model/format and simulation parameters,
- automatic builds.
Example session:
phaserider repl. type 'help'.
> width 8
> model tick
> add 13 250 1
> trace 13 250 1
> exit
Supported settings:
width 1..64model tick|logicfmt dec|hex|bin|allsigned auto|0|1maj_delay,not_delay,ticks,p_flip,seedcompare on|off(fortickmodel: compare vs logic)sat off|unsigned|signed(foradc)json 0|1(JSON‑only output foradc)
In logic.cpp, basic gates are built from majority and inverter:
maj3(a,b,c)→ 1 if majority of inputs are 1.inv1(x)→ inversion.and2,or2,xor2are composed frommaj3andinv1.
The adder is a ripple‑carry chain of full adders (8‑bit).
The “ticker” builds a graph of nodes with delays:
kind=0— constant,kind=1— input,kind=2— majority gate,kind=3— inverter.
Each node has a pipeline of length delay, which is the discrete delay. Simulation proceeds by ticks:
- compute next values,
- shift pipelines.
circuit_tick_crit_ticks(...) computes the minimal number of ticks required for output stabilization.
Combines:
- logic adder (
model=logic), - tick simulator (
model=tick), - flag computation
C V Z N, - comparison against arithmetic reference.
GitHub Actions:
build.yml— build only.test.yml— build + runtest.sh.
.
├── CMakeLists.txt
├── cli.sh
├── test.sh
├── src/
│ ├── adc.cpp
│ ├── circuit_tick.cpp
│ ├── circuit_tick.h
│ ├── logic.cpp
│ ├── ode.cpp
│ └── tick.cpp
└── .github/workflows/
├── build.yml
└── test.yml
phazeride_adcandcli.shsupport negative numbers and multiple formats (dec/hex/bin).- Adder width is limited to 64 bits.
- For the tick model,
maj_delay,not_delay, and number of ticks are important; if the result doesn’t converge, increaseticksor usep_flip=0.
MIT