llhd icon indicating copy to clipboard operation
llhd copied to clipboard

Update llhd-conv output mlir with cf dialect.

Open DeepFlyingSky opened this issue 2 years ago • 1 comments

Change br, cond_br to cf.br, cf.cond_br when convert to mlir format.


The test file borrow from moore repos.

The llhd format can run safely under rust/llhd-sim. I wonder if convert to mlir can also happen in circt/llhd-sim.

Failed due to cf dialect and lack declaration of llhd.sig. Current output will be

llhd.proc @foo.initial.15.0() -> (%x: !llhd.sig<i32> ) {
    cf.br ^0
^0:
    %1 = hw.constant 42 : i32
    %2 = llhd.constant_time #llhd.time<0s, 0d, 1e>
    llhd.drv %x, %1 after %2 : !llhd.sig<i32>
    llhd.halt
}

llhd.entity @foo() -> (%x: !llhd.sig<i32> ) {
    llhd.inst "inst" @foo.initial.15.0() -> (%x) : () -> (!llhd.sig<i32>)
}

and it works in circt/llhd-sim follow.

llhd.proc @foo.initial.15.0() -> (%x: !llhd.sig<i32> ) {
    cf.br ^0
^0:
    %1 = hw.constant 42 : i32
    %2 = llhd.constant_time #llhd.time<0ns, 0d, 1e>
    llhd.drv %x, %1 after %2 : !llhd.sig<i32>
    llhd.halt
}

llhd.entity @foo() -> (%x: !llhd.sig<i32> ) {
  %10 = hw.constant 0 : i32
  %11 = llhd.sig "s1" %10 : i32
  llhd.inst "inst" @foo.initial.15.0() -> (%11) : () -> (!llhd.sig<i32>)
}


Maybe can add it next.

DeepFlyingSky avatar Apr 20 '22 09:04 DeepFlyingSky

It has been so long ...

cepheus69 avatar Apr 26 '24 07:04 cepheus69