Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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

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

If you're not sure about the file name format, learn more about wheel file names.

zuspec_be_sw-0.0.1.21536659564rc0-py3-none-any.whl (77.0 kB view details)

Uploaded Python 3

File details

Details for the file zuspec_be_sw-0.0.1.21536659564rc0-py3-none-any.whl.

File metadata

File hashes

Hashes for zuspec_be_sw-0.0.1.21536659564rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 6595024df8183d81d346169a00ec46bb701c2291a7a3c7f8cf8db63c5b27d284
MD5 7fc32703e7ceddde4c9d26de3932f86d
BLAKE2b-256 91f348d2208b8458e7b2ea9e80941cc71a92eae67b80e3a4dda7b64e35a5086b

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.0

1 file

0.0.9

15 files

0.0.8

15 files

0.0.7

15 files

0.0.5

5 files

0.0.4

5 files

This release

0.0.1.21536659564rc0 This release

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page