The project has two orthogonal compute layers:
- Biophysical layer (continuous-time approximation)
- Digital NAND layer (discrete Boolean logic)
These are intentionally independent so each can be evolved and tested without coupling risks.
HodgkinHuxleyNeuronmodels a single-compartment neuron.- Uses forward Euler integration over membrane voltage and gating variables.
- Supports either constant or callable external drive (
drive(t_ms)). - Emits boolean spike events when membrane voltage crosses threshold upward.
Synapsemodels delayed, exponentially decaying event-driven synaptic current.NeuralNetworkorchestrates:- Neuron registration
- Directed synaptic edges
- Step-wise simulation with per-neuron current aggregation
- Trace capture (
V_*,spike_*, and time axis)
- Gather synaptic currents for each postsynaptic neuron.
- Step each neuron once with total current.
- Advance synaptic state using presynaptic spike outputs.
- Record voltage and spike traces.
NandFabricprovides NAND primitive and NAND-derived gates (NOT,AND,OR,XOR,XNOR,NOR).- Tracks operation cost using
gate_count. NandBinaryAddercomposes full adders into ripple-carry n-bit addition.NandComparatorcomposes bitwise logic into n-bitgt/eq/lt.NandALUcombines adder and comparator in one interface.
- All composite operations are expressed solely through
NandFabricmethods. - Integer APIs convert to bit-vectors (LSB-first), operate, then map back to integers.
- Provides demo entrypoint and CLI.
- Supports selective execution:
- HH simulation/plot
- NAND truth tables and scaling plot
- Optional figure saving for reproducible outputs.