fabianschuiki / llhd

Low Level Hardware Description — A foundation for building hardware design tools.
http://www.llhd.io
Apache License 2.0
397 stars 30 forks source link

builder example is throwing errors #136

Closed azarmadr closed 4 years ago

azarmadr commented 4 years ago
Verification errors:                                                            
- func @foo: ret %v11: requires function to have return type i32 (but has void) 

this one can be fixed with changing return type

    sig.set_return_type(llhd::void_ty());
    sig.set_return_type(llhd::int_ty(32));
Verification errors:
- proc @bar: %v3 = add i1$ %v0, %v1: argument v1 must be of type i1$ (but is i32$)
- proc @bar: %v4 = eq i1 %v0, %v1: argument types must match (but are i1$, i32$)
- proc @bar: %v5 = neq i1 %v0, %v1: argument types must match (but are i1$, i32$)

i think it is because of add input(32 bit) to clock(1 bit).

//llhd/examples/builder.rs 56
        builder.ins().add(clk, inp);
        builder.ins().eq(clk, inp);
        builder.ins().neq(clk, inp);
fabianschuiki commented 4 years ago

Excellent catch. I think the latter is most easily fixed as you say by making inp 1 bit as well. It would be great if you could open a PR if you have the time! Thanks a lot :smiley:!

fabianschuiki commented 4 years ago

Fixed as part of v0.14.2