nl-compiler: Frontend Compiler for Safety-Net
Below is a minimal example to get you started:
module and_test (
a,
b,
y
);
input a;
wire a;
input b;
wire b;
output y;
wire y;
AND _0_ (
.A(a),
.B(b),
.Y(y)
);
endmoduleSave the above file to and.v.
cargo run --example roundtrip -- and.v
Also, take a look at some of the tests:
#[test]
fn mux_lut() {
let src = "module lut_test (
a,
b,
c,
y
);
input a;
wire a;
input b;
wire b;
input c;
wire c;
output y;
wire y;
LUT3 #(
.INIT(8'b11001010)
) _0_ (
.I0(a),
.I1(b),
.I2(c),
.O(y)
);
endmodule
"
.to_string();
assert_verilog_eq!(src, roundtrip(&src).unwrap());
}