Zuspec C/C++ software backend
Project description
Zuspec Software Backend
The Zuspec Software (SW) Backend transforms Zuspec hardware component models into executable C/C++ code for simulation, testing, and modeling.
Features
- Component Translation: Zuspec Components → C structs and functions
- Async/Sync: Transforms async methods with optional sync conversion
- Protocol Interfaces: Generates C API structs for Protocol types
- Type Mapping: Maps Zuspec types to C types
- Validation: Pre-generation compatibility checks
- Compilation: Built-in GCC compiler interface
- Test Execution: Automated test runner
- Type Specialization: Optional monomorphization (experimental)
Installation
pip install zuspec-be-sw
Quick Start
import zuspec.dataclasses as zdc
from zuspec.be.sw import CGenerator, CValidator, CCompiler, TestRunner
from pathlib import Path
@zdc.dataclass
class Counter(zdc.Component):
count: int = zdc.field(default=0)
def increment(self):
self.count += 1
def get_count(self) -> int:
return self.count
# Build → Validate → Generate → Compile → Run
factory = zdc.DataModelFactory()
ctxt = factory.build(Counter)
validator = CValidator()
assert validator.validate(ctxt)
gen = CGenerator(Path("output"))
sources = gen.generate(ctxt)
compiler = CCompiler(Path("output"))
exe = compiler.compile(sources, Path("output/test"))
runner = TestRunner()
result = runner.run(exe)
Generated C Code
typedef struct Counter {
int count;
} Counter;
void Counter_init(Counter *self);
void Counter_increment(Counter *self);
int Counter_get_count(Counter *self);
Documentation
Requirements
- Python >= 3.7
- zuspec-dataclasses
- C compiler (GCC)
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zuspec_be_sw-0.0.1.21613769656rc0-py3-none-any.whl.
File metadata
- Download URL: zuspec_be_sw-0.0.1.21613769656rc0-py3-none-any.whl
- Upload date:
- Size: 77.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5746dbeb08efec25f6e7f1b071130dec4d618d5e5a34be81da7b5bd61fb6910e
|
|
| MD5 |
bb92e89344da27c75cd937a46bd014cf
|
|
| BLAKE2b-256 |
b3ccb642484d0172f25253b8c95048bd363f590a6ba1621d3926698ef4fa1afd
|