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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/mlir/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ impl std::fmt::Display for MLIROpcode {
Opcode::Halt => "llhd.halt",
Opcode::Ret => "return",
Opcode::RetValue => "return",
Opcode::Br => "br",
Opcode::BrCond => "cond_br",
Opcode::Br => "cf.br",
Opcode::BrCond => "cf.cond_br",
Opcode::Wait => "llhd.wait",
Opcode::WaitTime => "llhd.wait",
_ => panic!("No single corresponding op in CIRCT!"),
Expand Down Expand Up @@ -273,7 +273,7 @@ impl<T: Write> Writer<T> {
if data.kind() != UnitKind::Entity {
if let Some(block) = data.first_block() {
write!(uw.writer.sink, " ")?;
write!(uw.writer.sink, "br ")?;
write!(uw.writer.sink, "cf.br ")?;
uw.write_block_name(block, block_args.get(&block).unwrap_or(&Vec::new()))?;
write!(uw.writer.sink, "\n")?;
}
Expand Down
13 changes: 13 additions & 0 deletions tests/mlir/from_moore.llhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
; RUN: llhd-conv -i %s --output-format mlir

proc %foo.initial.15.0 () -> (i32$ %x) {
0:
%1 = const i32 42
%2 = const time 0s 1e
drv i32$ %x, %1, %2
halt
}

entity @foo () -> (i32$ %x) {
inst %foo.initial.15.0 () -> (i32$ %x)
}