From 533cbc673068f2c4ce668ba63ac78d740246450d Mon Sep 17 00:00:00 2001 From: Morten Borup Petersen Date: Thu, 23 Sep 2021 18:17:29 +0100 Subject: [PATCH] [SCFToCalyx] Add test for multiple return values --- .../Conversion/SCFToCalyx/convert_simple.mlir | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/test/Conversion/SCFToCalyx/convert_simple.mlir b/test/Conversion/SCFToCalyx/convert_simple.mlir index fe8c8d5788c0..1b81e62f7e63 100644 --- a/test/Conversion/SCFToCalyx/convert_simple.mlir +++ b/test/Conversion/SCFToCalyx/convert_simple.mlir @@ -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 + } +}