Hardware-Aware SNN NAS¶
NSGA-II evolutionary search over SNN architectures under FPGA resource budgets.
Searches {neuron model, layer width, bitstream length, delay range} jointly — the first NAS that optimizes hardware parameters alongside topology.
Search Space¶
sc_neurocore.nas.search_space
¶
Define the architecture search space for hardware-aware SNN NAS.
Search dimensions
- n_layers: number of hidden layers
- widths: neurons per layer
- neuron_type: per-layer neuron model
- bitstream_length: per-layer SC precision (L)
- delay_range: maximum synaptic delay per layer
Each architecture encodes one point in this joint space. FPGA constraints (LUT, BRAM budgets) prune infeasible points.
Architecture
dataclass
¶
One point in the NAS search space.
Source code in src/sc_neurocore/nas/search_space.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
SearchSpace
dataclass
¶
Configurable NAS search space.
Parameters¶
n_inputs : int Input dimension. n_outputs : int Output dimension (width of final layer). min_layers, max_layers : int Range of hidden layer count. width_choices : list of int Candidate widths per layer. neuron_choices : list of str Candidate neuron models. L_choices : list of int Candidate bitstream lengths. delay_choices : list of int Candidate max-delay values.
Source code in src/sc_neurocore/nas/search_space.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
space_size
property
¶
Approximate total architectures in the search space.
random_architecture(rng)
¶
Sample a random architecture from the space.
Source code in src/sc_neurocore/nas/search_space.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
mutate(arch, rng)
¶
Mutate one random gene in the architecture.
Source code in src/sc_neurocore/nas/search_space.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
crossover(a, b, rng)
¶
Uniform crossover between two architectures of equal layer count.
Source code in src/sc_neurocore/nas/search_space.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
Search Engine¶
sc_neurocore.nas.search
¶
NSGA-II evolutionary search over SNN architectures under FPGA constraints.
Searches {neuron model, layer width, bitstream length, delay range} jointly, evaluating each candidate for accuracy (simulated) and hardware cost (via the energy estimator). Returns a Pareto front of non-dominated architectures.
No equivalent exists: SpikeNAS searches only software architectures. This is the first NAS that searches hardware parameters (L, delays, LUTs) alongside network topology.
NASResult
dataclass
¶
Result of a NAS run.
Source code in src/sc_neurocore/nas/search.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
best_accuracy()
¶
Architecture with highest accuracy on the Pareto front.
Source code in src/sc_neurocore/nas/search.py
39 40 41 42 43 | |
best_efficiency()
¶
Architecture with lowest energy on the Pareto front.
Source code in src/sc_neurocore/nas/search.py
45 46 47 48 49 | |
nas(space, target='ice40', population_size=50, generations=20, max_luts=None, accuracy_fn=None, seed=42)
¶
Run hardware-aware NAS using NSGA-II.
Parameters¶
space : SearchSpace Architecture search space definition. target : str FPGA target for hardware cost evaluation. population_size : int Number of architectures per generation. generations : int Number of evolutionary generations. max_luts : int, optional Hard LUT budget. Architectures exceeding this are penalized. If None, uses the target's total LUT count. accuracy_fn : callable, optional Function(Architecture) -> float accuracy in [0, 1]. If None, uses a proxy based on network capacity. seed : int Random seed.
Returns¶
NASResult Pareto front + all evaluated architectures.
Source code in src/sc_neurocore/nas/search.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | |
Formal Equivalence¶
sc_neurocore.nas.equiv
¶
Generate and run formal equivalence proofs between Python and Verilog models.
Uses SymbiYosys (sby) for bounded model checking. The miter circuit drives both the DUT and a reference Verilog model with symbolic inputs. If outputs match for ALL input sequences up to depth N, equivalence is proved.
Pre-built proofs live in hdl/equiv/. This module generates new proofs for arbitrary neuron configurations and optionally runs them.
EquivResult
dataclass
¶
Result of a formal equivalence check.
Source code in src/sc_neurocore/nas/equiv.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
check_equivalence(dut_verilog='sc_lif_neuron', ref_verilog='sc_lif_reference', depth=30, run=False)
¶
Check formal equivalence between DUT and reference.
Parameters¶
dut_verilog : str DUT module name (must exist in hdl/). ref_verilog : str Reference module name (must exist in hdl/equiv/). depth : int BMC depth (number of clock cycles to check). run : bool If True, actually run SymbiYosys. Requires sby + z3 installed. If False, generate proof files and return without running.
Returns¶
EquivResult
Source code in src/sc_neurocore/nas/equiv.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
generate_miter(dut_module, ref_module, top_name, data_width=16, fraction=8)
¶
Generate a Verilog miter circuit for two modules.
Both modules must have identical port signatures: clk, rst_n, leak_k, gain_k, I_t, noise_in -> spike_out, v_out
Source code in src/sc_neurocore/nas/equiv.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
generate_sby(top_name, verilog_files, depth=30, engine='smtbmc z3')
¶
Generate a SymbiYosys .sby proof script.
Source code in src/sc_neurocore/nas/equiv.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |