Skip to content

Commit

Permalink
[SCFToCalyx] Add test for multiple return values
Browse files Browse the repository at this point in the history
  • Loading branch information
mortbopet committed Sep 23, 2021
1 parent 184db22 commit 533cbc6
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions test/Conversion/SCFToCalyx/convert_simple.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,39 @@ module {
return %2 : i32
}
}

// -----

// Test multiple return values.

// CHECK: module {
// CHECK-NEXT: calyx.program "main" {
// CHECK-NEXT: calyx.component @main(%in0: i32, %in1: i32, %clk: i1 {clk}, %reset: i1 {reset}, %go: i1 {go}) -> (%out0: i32, %out1: i32, %done: i1 {done}) {
// CHECK-NEXT: %true = hw.constant true
// CHECK-NEXT: %ret_arg1_reg.in, %ret_arg1_reg.write_en, %ret_arg1_reg.clk, %ret_arg1_reg.reset, %ret_arg1_reg.out, %ret_arg1_reg.done = calyx.register "ret_arg1_reg" : i32, i1, i1, i1, i32, i1
// CHECK-NEXT: %ret_arg0_reg.in, %ret_arg0_reg.write_en, %ret_arg0_reg.clk, %ret_arg0_reg.reset, %ret_arg0_reg.out, %ret_arg0_reg.done = calyx.register "ret_arg0_reg" : i32, i1, i1, i1, i32, i1
// CHECK-NEXT: calyx.wires {
// CHECK-NEXT: calyx.assign %out1 = %ret_arg1_reg.out : i32
// CHECK-NEXT: calyx.assign %out0 = %ret_arg0_reg.out : i32
// CHECK-NEXT: calyx.group @ret_assign_0 {
// CHECK-NEXT: calyx.assign %ret_arg0_reg.in = %in0 : i32
// CHECK-NEXT: calyx.assign %ret_arg0_reg.write_en = %true : i1
// CHECK-NEXT: calyx.assign %ret_arg1_reg.in = %in1 : i32
// CHECK-NEXT: calyx.assign %ret_arg1_reg.write_en = %true : i1
// CHECK-NEXT: %0 = comb.and %ret_arg0_reg.done, %ret_arg1_reg.done : i1
// CHECK-NEXT: calyx.group_done %true, %0 ? : i1
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: calyx.control {
// CHECK-NEXT: calyx.seq {
// CHECK-NEXT: calyx.enable @ret_assign_0
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: }
module {
func @main(%a0 : i32, %a1 : i32) -> (i32, i32) {
return %a0, %a1 : i32, i32
}
}

0 comments on commit 533cbc6

Please sign in to comment.