Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update llhd-conv output mlir with cf dialect. #156

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

DeepFlyingSky
Copy link

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.

@cepheus69
Copy link

It has been so long ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants