Hardware¶
Hardware abstraction layer for chip emulators and deployment targets.
9 hardware chip emulators: Loihi CUBA, Loihi 2, TrueNorth, BrainScaleS AdEx, SpiNNaker, Akida, DPI, MemristorArray, GenericASIC. Each emulates the target chip's neuron dynamics, precision constraints, and routing limitations.
from sc_neurocore.hardware import LoihiCUBANeuron, TrueNorthNeuron
sc_neurocore.hardware
¶
sc_neurocore.hardware — Neuromorphic Hardware Abstraction Layer.
Provides device specifications, resource estimation, constraint checking, neuron-to-core mapping, and deployment packaging for Loihi, SpiNNaker, BrainScaleS, FPGA, and Akida targets.
DeviceFamily
¶
Bases: Enum
Supported neuromorphic hardware families.
Source code in src/sc_neurocore/hardware/device.py
| Python | |
|---|---|
22 23 24 25 26 27 28 29 30 31 32 | |
DeviceSpec
dataclass
¶
Physical specification of a neuromorphic device.
Attributes:
| Name | Type | Description |
|---|---|---|
family |
DeviceFamily
|
Hardware family identifier. |
cores |
int
|
Number of neuro-cores on the chip. |
neurons_per_core |
int
|
Maximum neurons per core. |
synapses_per_core |
int
|
Maximum synaptic connections per core. |
axons_per_core |
int
|
Maximum input axons per core. |
tick_ns |
float
|
Duration of one simulation tick in nanoseconds. |
precision_bits |
int
|
Weight precision in bits. |
supports_learning |
bool
|
Whether on-chip learning is supported. |
power_per_core_mw |
float
|
Estimated power per active core (mW). |
max_fan_in |
int
|
Maximum fan-in per neuron. |
max_fan_out |
int
|
Maximum fan-out per neuron. |
weight_bits |
int
|
Synaptic weight bit-width. |
delay_bits |
int
|
Synaptic delay bit-width. |
max_delay_ticks |
int
|
Maximum synaptic delay in ticks. |
Source code in src/sc_neurocore/hardware/device.py
| Python | |
|---|---|
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 63 64 65 66 67 68 69 | |
ResourceEstimate
dataclass
¶
Hardware resource estimation result.
Attributes:
| Name | Type | Description |
|---|---|---|
cores_needed |
int
|
Minimum cores to host the network. |
neurons_mapped |
int
|
Total neurons to place. |
synapses_mapped |
int
|
Total synapses to route. |
utilization_pct |
float
|
Average core utilization (%). |
power_mw |
float
|
Estimated total power (mW). |
latency_us |
float
|
Estimated single-tick latency (µs). |
fits |
bool
|
Whether the network fits on the target device. |
Source code in src/sc_neurocore/hardware/resource_estimator.py
| Python | |
|---|---|
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
ResourceEstimator
¶
Estimate hardware cost for deploying an SC-NeuroCore network.
Source code in src/sc_neurocore/hardware/resource_estimator.py
| Python | |
|---|---|
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 107 108 109 110 111 112 113 114 115 | |
estimate(adjacency, device)
¶
Estimate resources from an adjacency matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adjacency
|
ndarray[Any, Any]
|
(N, N) weighted adjacency matrix. |
required |
device
|
DeviceSpec
|
Target device specification. |
required |
Returns:
| Type | Description |
|---|---|
ResourceEstimate
|
ResourceEstimate with core counts, power, etc. |
Source code in src/sc_neurocore/hardware/resource_estimator.py
| Python | |
|---|---|
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 | |
fits(adjacency, device)
¶
Quick check: does the network fit on the device?
Source code in src/sc_neurocore/hardware/resource_estimator.py
| Python | |
|---|---|
101 102 103 104 105 106 107 | |
compare(adjacency, devices)
¶
Compare resource requirements across multiple devices.
Source code in src/sc_neurocore/hardware/resource_estimator.py
| Python | |
|---|---|
109 110 111 112 113 114 115 | |
Violation
dataclass
¶
A single hardware constraint violation.
Attributes:
| Name | Type | Description |
|---|---|---|
neuron_id |
int
|
Index of the offending neuron. |
constraint |
str
|
Name of the violated constraint. |
value |
float
|
Actual value that violates the constraint. |
limit |
float
|
Maximum allowed value. |
message |
str
|
Human-readable description. |
Source code in src/sc_neurocore/hardware/constraints.py
| Python | |
|---|---|
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
HardwareConstraints
dataclass
¶
Constraint set for a target device.
Derived from a DeviceSpec, or specified manually.
Source code in src/sc_neurocore/hardware/constraints.py
| Python | |
|---|---|
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
from_device(device)
classmethod
¶
Derive constraints from a device specification.
Source code in src/sc_neurocore/hardware/constraints.py
| Python | |
|---|---|
57 58 59 60 61 62 63 64 65 66 | |
ConstraintChecker
¶
Check and optionally fix hardware constraint violations.
Source code in src/sc_neurocore/hardware/constraints.py
| Python | |
|---|---|
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 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 179 180 181 182 183 184 185 186 187 188 | |
check(adjacency, constraints, weights=None, delays=None)
¶
Check all constraints. Returns list of violations (empty if clean).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adjacency
|
ndarray[Any, Any]
|
(N, N) connectivity matrix (nonzero = connected). |
required |
constraints
|
HardwareConstraints
|
Hardware constraint set. |
required |
weights
|
ndarray[Any, Any] | None
|
Optional (N, N) weight matrix to check precision. |
None
|
delays
|
ndarray[Any, Any] | None
|
Optional (N, N) delay matrix in ticks. |
None
|
Source code in src/sc_neurocore/hardware/constraints.py
| Python | |
|---|---|
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 | |
auto_fix(adjacency, constraints)
¶
Attempt automatic fixes: prune weakest connections to satisfy fan-in/out.
Returns a modified adjacency matrix.
Source code in src/sc_neurocore/hardware/constraints.py
| Python | |
|---|---|
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 | |
NeuronPlacement
dataclass
¶
Placement of a single neuron on hardware.
Source code in src/sc_neurocore/hardware/mapping.py
| Python | |
|---|---|
24 25 26 27 28 29 30 | |
Mapper
¶
Map neurons to cores using different strategies.
Source code in src/sc_neurocore/hardware/mapping.py
| Python | |
|---|---|
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 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 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 | |
map_greedy(adjacency, device)
¶
Greedy sequential mapping: fill cores one by one.
Simple but fast. Good baseline.
Source code in src/sc_neurocore/hardware/mapping.py
| Python | |
|---|---|
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
map_balanced(adjacency, device)
¶
Balanced mapping: distribute neurons evenly across cores.
Neurons are assigned round-robin to minimize load imbalance.
Source code in src/sc_neurocore/hardware/mapping.py
| Python | |
|---|---|
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 | |
map_locality(adjacency, device)
¶
Locality-aware mapping: cluster connected neurons on same core.
Uses a simple greedy clustering: start from the most connected neuron, pack its neighbors into the same core until full.
Source code in src/sc_neurocore/hardware/mapping.py
| Python | |
|---|---|
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 | |
DeploymentPackage
dataclass
¶
Self-contained deployment artifact for neuromorphic hardware.
Attributes:
| Name | Type | Description |
|---|---|---|
device |
DeviceSpec
|
Target device specification. |
placements |
list[NeuronPlacement]
|
Neuron-to-core mapping. |
config_blob |
bytes
|
Binary configuration data for the target. |
metadata |
dict[str, Any]
|
Additional deployment metadata. |
Source code in src/sc_neurocore/hardware/deployment.py
| Python | |
|---|---|
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
Deployer
¶
Create and validate deployment packages.
Source code in src/sc_neurocore/hardware/deployment.py
| Python | |
|---|---|
44 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 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 | |
package(adjacency, device, placements, weights=None)
¶
Create a deployment package.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adjacency
|
ndarray[Any, Any]
|
(N, N) network connectivity matrix. |
required |
device
|
DeviceSpec
|
Target device. |
required |
placements
|
list[NeuronPlacement]
|
Neuron-to-core mapping. |
required |
weights
|
ndarray[Any, Any] | None
|
Optional weight matrix (defaults to adjacency values). |
None
|
Returns:
| Type | Description |
|---|---|
DeploymentPackage
|
DeploymentPackage ready for deployment. |
Source code in src/sc_neurocore/hardware/deployment.py
| Python | |
|---|---|
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 | |
validate(package)
¶
Validate a deployment package for consistency.
Checks: - All neuron IDs are unique - No core_id exceeds device capacity - Config blob is non-empty - All local IDs are within neurons_per_core
Source code in src/sc_neurocore/hardware/deployment.py
| Python | |
|---|---|
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
summary(package)
¶
Human-readable deployment summary.
Source code in src/sc_neurocore/hardware/deployment.py
| Python | |
|---|---|
111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
get_device(family)
¶
Look up a device specification by family name or enum.
Source code in src/sc_neurocore/hardware/device.py
| Python | |
|---|---|
214 215 216 217 218 219 220 221 | |