Skip to content

Commit

Permalink
wrap floating point mul namespace with calyx.ieee754
Browse files Browse the repository at this point in the history
  • Loading branch information
jiahanxie353 committed Nov 3, 2024
1 parent 3d758ab commit 8bda83f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion include/circt/Dialect/Calyx/CalyxPrimitives.td
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ def AddFNOp : ArithBinaryFloatingPointLibraryOp<"addFN"> {
}];
}

def MulFNOp : ArithBinaryFloatingPointLibraryOp<"mulFN"> {
def MulFNOp : ArithBinaryFloatingPointLibraryOp<"ieee754.mul"> {
let results = (outs I1:$clk, I1:$reset, I1:$go, I1:$control,
AnyFloat:$left, AnyFloat:$right, AnySignlessInteger:$roundingMode, AnyFloat:$out,
AnySignlessInteger:$exceptionalFlags, I1:$done);
Expand Down
15 changes: 9 additions & 6 deletions test/Conversion/SCFToCalyx/convert_simple.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,16 @@ module {

// Test floating point mul

// CHECK: %mulf_0_reg.in, %mulf_0_reg.write_en, %mulf_0_reg.clk, %mulf_0_reg.reset, %mulf_0_reg.out, %mulf_0_reg.done = calyx.register @mulf_0_reg : f32, i1, i1, i1, f32, i1
// CHECK-DAG: %std_ieee754.mul_0.clk, %std_ieee754.mul_0.reset, %std_ieee754.mul_0.go, %std_ieee754.mul_0.control, %std_ieee754.mul_0.left, %std_ieee754.mul_0.right, %std_ieee754.mul_0.roundingMode, %std_ieee754.mul_0.out, %std_ieee754.mul_0.exceptionalFlags, %std_ieee754.mul_0.done = calyx.std_ieee754.mul @std_ieee754.mul_0 : i1, i1, i1, i1, f32, f32, i3, f32, i5, i1
// CHECK-DAG: %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 : f32, i1, i1, i1, f32, i1
// CHECK: calyx.group @bb0_0 {
// CHECK-DAG: calyx.assign %std_mulFN_0.left = %in0 : f32
// CHECK-DAG: calyx.assign %std_mulFN_0.right = %cst : f32
// CHECK-DAG: calyx.assign %mulf_0_reg.in = %std_mulFN_0.out : f32
// CHECK-DAG: calyx.assign %mulf_0_reg.write_en = %std_mulFN_0.done : i1
// CHECK-DAG: %0 = comb.xor %std_mulFN_0.done, %true : i1
// CHECK-DAG: calyx.assign %std_mulFN_0.go = %0 ? %true : i1
// CHECK-DAG: calyx.assign %std_ieee754.mul_0.left = %in0 : f32
// CHECK-DAG: calyx.assign %std_ieee754.mul_0.right = %cst : f32
// CHECK-DAG: calyx.assign %mulf_0_reg.in = %std_ieee754.mul_0.out : f32
// CHECK-DAG: calyx.assign %mulf_0_reg.write_en = %std_ieee754.mul_0.done : i1
// CHECK-DAG: %0 = comb.xor %std_ieee754.mul_0.done, %true : i1
// CHECK-DAG: calyx.assign %std_ieee754.mul_0.go = %0 ? %true : i1
// CHECK-DAG: calyx.group_done %mulf_0_reg.done : i1
// CHECK-DAG: }
module {
Expand Down

0 comments on commit 8bda83f

Please sign in to comment.