SIRC
SIRC - Digital Logic and Circuit Simulation Engine
SIRC is a lightweight, fully typed Python library for simulating digital logic at the transistor level. It models Nodes, Devices, and Transistors and computes stable LogicValues through fixed-point iteration and dynamic connectivity.
📦 Installation
Install from PyPI:
pip install sirc
Import the device simulator:
from sirc.simulator import DeviceSimulator
🚀 Quick Start
"""
CMOS Inverter Example:
[VDD]
|
|
S
+--| G [PMOS] D --+
| |
[INPUT]-->[PORT]--+ +--[PORT]-->[PROBE]
| |
+--| G [NMOS] D --+
S
|
|
[GND]
"""
from sirc.core import LogicValue
from sirc.simulator import DeviceSimulator
sim = DeviceSimulator()
# Create Devices and Transistors
vdd = sim.create_vdd()
gnd = sim.create_gnd()
inp = sim.create_input()
probe = sim.create_probe()
inp_port = sim.create_port()
out_port = sim.create_port()
pmos = sim.create_pmos()
nmos = sim.create_nmos()
# Connect Components
sim.connect(inp.node, inp_port.node)
sim.connect(inp_port.node, pmos.gate)
sim.connect(inp_port.node, nmos.gate)
sim.connect(vdd.node, pmos.source)
sim.connect(gnd.node, nmos.source)
sim.connect(pmos.drain, out_port.node)
sim.connect(nmos.drain, out_port.node)
sim.connect(out_port.node, probe.node)
# Build Topology
sim.build_topology()
# Simulate and Sample Output
inp.set_value(LogicValue.ONE)
sim.tick()
print(repr(probe.sample()))
# Change Input and Resimulate
inp.set_value(LogicValue.ZERO)
sim.tick()
print(repr(probe.sample()))
# Expected Output:
# LogicValue.ZERO
# LogicValue.ONE
🔧 Features
Core Devices
VDDGNDInputProbePort
Transistors
NMOSPMOS
Fully Typed
from sirc.core import LogicValue
from sirc.simulator import DeviceSimulator
📂 Project Structure
src/
sirc/
core/
Logic_device.py
logic_value.py
node.py
transistor.py
simulator/
device_dep.py
device_sim.py
stats/
main.py
tests/
sirc/
core/
test_logic_device.py
test_logic_value.py
test_node.py
test_transistor.py
simulator/
test_device_dep.py
test_device_sim.py
🧪 Testing
Run the full test suite:
pytest
📝 License
MIT License
🔗 Links
- PyPI: https://pypi.org/project/sirc/
- Source Code: https://github.com/CRISvsGAME/sirc
Metadata
Release files for sirc 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sirc-1.3.0.tar.gz | 12.1 kB | Without provenance | Details for sirc-1.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sirc-1.3.0-py3-none-any.whl | Python 3 | none | any | Details for sirc-1.3.0-py3-none-any.whl |
Total release size: 28.2 kB
Release files / sirc-1.3.0.tar.gz
| Download URL | sirc-1.3.0.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
86fe0258cf5fbfa0229f8b0ca1c29768945470b7a119db9c09e10ed029277c0b
|
|
BLAKE2b-256 checksum How to use checksums |
0648610c2a58b4afc9860bb6611f3a3da52fb384712014cac315f360a7f79518
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / sirc-1.3.0-py3-none-any.whl
| Download URL | sirc-1.3.0-py3-none-any.whl |
|---|---|
| Size | 16.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8a2632d3139b0f14a6c7a8ef9a4dd710cab719bd4b6be6dc858d7d128274a59c
|
|
BLAKE2b-256 checksum How to use checksums |
4c10569f203fd381c79143a0d9cfab3779f18b54f6d74c9fe214dbb5320e419f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for sirc 1.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.