
Four digital leaky integrate-and-fire (LIF) neurons are wired in a ring. Neuron 0 is driven by the input pins, and every spike "kicks" the next neuron, so spikes travel 0 → 1 → 2 → 3 and back to 0.
Each neuron keeps an 8-bit membrane voltage V and updates it on every clock:
V_next = V - leak + I leak = V >> 4 (V/16), but at least 1 whenever V > 0
I is added to V each cycle. For neuron 0 it is ui[7:0] plus the kick from
neuron 3. For the others it is the kick from the neuron before it.V > 0, so the voltage always decays back to 0 when input stops.V to 0.MODE pin).The kick weight is chosen with uio[1:0]:
uio[1:0] |
Weight | Behaviour |
|---|---|---|
| 0 | 0 | Ring off. Neuron 0 works as a single LIF neuron |
| 1 | 64 | A weak nudge that leaks away between spikes |
| 2 | 128 | A neuron needs several kicks to fire, so it fires less often than the one driving it |
| 3 | 255 | One kick is enough. A spike hops to the next neuron on each clock |
MODE (uio[2]) selects the refractory period. With MODE = 0 (4 cycles) the kick from neuron 3 reaches neuron 0
while it is still refractory, so each wave makes one pass and the input sets the rhythm. With MODE = 1 (3 cycles)
and weight 255, a single spike keeps circulating with a period of 4 clocks and no further input.
Setting BIST (uio[3]) to 1 makes the chip test itself. It resets the neurons, then for 1024 clocks an on-chip
pseudo-random generator (an 8-bit LFSR) drives all four neurons directly while a counter steps through every weight
and both refractory modes. Each neuron sees a different view of the LFSR at one of four amplitude levels (quiet,
creep near the threshold, small, full), which rotate every 32 clocks. A 16-bit signature register (MISR) folds in
all four voltages and spikes on every clock. At the end the signature is compared with the value a healthy design
produces (0x53DF, taken from the Python golden model).
Start a run with BIST low or straight after a reset; raising BIST restarts the test from the beginning. DONE
rises exactly 1025 clocks after BIST goes high. The ring keeps running during and after the test, so the spike
pins uio[7:5] stay active. Setting BIST back to 0 resets the neurons on the next clock, so normal operation
starts from rest. Signature bits 7:6 are compared on-chip but are not shown on any page.
While BIST is 1 the uo pins show the result instead of neuron 0:
uio[4:3] |
uo[7:0] |
|---|---|
| 00 | Neuron 0: V[7:1] on uo[7:1], spike on uo[0] |
| 01 | Self-test: uo[0] = DONE, uo[1] = PASS, uo[7:2] = signature bits 5:0 |
| 11 | Self-test: signature bits 15:8 |
| 10 | Reserved, reads 0 |
rst_n is an active-low reset that clears every neuron and the self-test. The design is checked in simulation
against a Python golden model, cycle by cycle, using cocotb.
Hold rst_n low for a few clock cycles, then release it. Set ui[7:0] and uio[2:0] to 0.
Single neuron: apply a constant input on ui[7:0], for example 30. V of neuron 0 (shown on uo[7:1]) climbs
until it crosses the threshold, then uo[0] pulses high for one cycle. Input 30 gives one spike every 13 clocks.
Travelling wave: set uio[1:0] = 3. Every spike on uo[0] is followed by spikes on uio[5], uio[6] and
uio[7] on the next three clocks.
Rate division: set uio[1:0] = 2. Neuron 1 (uio[5]) fires less often than neuron 0.
Self-sustaining oscillator: set uio[2:0] = 7, apply ui[7:0] = 255 for one clock, then 0. A spike keeps
circulating: each of the four spike pins pulses once every 4 clocks. Clear uio[2] and it stops.
Self-test: set uio[4:3] = 01 and run the clock for at least 1025 cycles. uo[0] (DONE) goes high, and
uo[1] (PASS) is high on a working chip, so uo[1:0] reads 3. Set uio[4:3] back to 00 to return to normal
operation.
Slow the clock down to see the pattern on LEDs.
None. LEDs or a logic analyzer on uo[0] and uio[7:5] show the spike pattern.
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | I0 (neuron 0 input current bit 0) | SPIKE0 (neuron 0 spike), or BIST DONE in self-test | W0 (input: ring weight select bit 0) |
| 1 | I1 | V1 (neuron 0 membrane voltage bit 1), or BIST PASS in self-test | W1 (input: ring weight select bit 1) |
| 2 | I2 | V2, or signature bit in self-test | MODE (input: 0 = refractory 4, 1 = refractory 3) |
| 3 | I3 | V3, or signature bit in self-test | BIST (input: 1 = run the built-in self-test) |
| 4 | I4 | V4, or signature bit in self-test | PAGE (input: with BIST = 1, show the signature high byte on uo; with BIST = 0, uo reads 0) |
| 5 | I5 | V5, or signature bit in self-test | SPIKE1 (output: neuron 1 spike) |
| 6 | I6 | V6, or signature bit in self-test | SPIKE2 (output: neuron 2 spike) |
| 7 | I7 (neuron 0 input current bit 7) | V7 (neuron 0 membrane voltage MSB), or signature bit in self-test | SPIKE3 (output: neuron 3 spike) |