xlsynth

Crates.ioxlsynth
lib.rsxlsynth
version0.0.16
sourcesrc
created_at2024-05-30 17:08:18.175398
updated_at2024-07-08 16:43:52.676484
descriptionAccelerated Hardware Synthesis (XLS/XLSynth) via Rust
homepagehttps://github.com/xlsynth/xlsynth-crate
repositoryhttps://github.com/xlsynth/xlsynth-crate
max_upload_size
id1257077
size66,292
Chris Leary (cdleary)

documentation

https://docs.rs/xlsynth

README

XLS (AKA XLSynth) Rust Crate

Rust bindings to the functionality in the "Accelerated Hardware Synthesis" library.

extern crate xlsynth;

use xlsynth::{IrValue, IrPackage, IrFunction, XlsynthError};

fn sample() -> Result<IrValue, XlsynthError> {
    let package: IrPackage = xlsynth::convert_dslx_to_ir(
        "fn id(x: u32) -> u32 { x }",
        std::path::Path::new("/memfile/sample.x"))?;
    let mangled = xlsynth::mangle_dslx_name("sample", "id")?;
    let f: IrFunction = package.get_function(&mangled)?;
    let ft: IrValue = IrValue::parse_typed("bits[32]:42")?;
    f.interpret(&[ft])
}

fn main() {
    assert_eq!(sample().unwrap(), IrValue::parse_typed("bits[32]:42").unwrap());
}
Commit count: 44

cargo fmt