Crates.io | xlsynth |
lib.rs | xlsynth |
version | 0.0.16 |
source | src |
created_at | 2024-05-30 17:08:18.175398 |
updated_at | 2024-07-08 16:43:52.676484 |
description | Accelerated Hardware Synthesis (XLS/XLSynth) via Rust |
homepage | https://github.com/xlsynth/xlsynth-crate |
repository | https://github.com/xlsynth/xlsynth-crate |
max_upload_size | |
id | 1257077 |
size | 66,292 |
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());
}