forked from llvm/circt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Handshake] Add control operand to
handshake.instance
operation (ll…
…vm#2055) When lowering a `handshake.instance` operation, we need to be able to decide when the instance is activated; or in other words, when the input control signal is asserted. Lowering from a CDFG to handshake, this will be whenever control flow arrived to the basic block of the source `builtin.call` operation, which the `handshake.instance` op originated from. With this new operand, we are able to be explicit about the activation of the `handshake.instance` op, and be able to implement lowering of the operation to FIRRTL.
- Loading branch information
Showing
6 changed files
with
139 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// RUN: handshake-runner %s 3 2 1 | FileCheck %s | ||
// RUN: circt-opt -lower-std-to-handshake %s > handshake.mlir | ||
// RUN handshake-runner handshake.mlir 3 2 1 | FileCheck %s | ||
// CHECK: 5 | ||
|
||
func @add(%arg0 : i32, %arg1: i32) -> i32 { | ||
%0 = arith.addi %arg0, %arg1 : i32 | ||
return %0 : i32 | ||
} | ||
|
||
func @sub(%arg0 : i32, %arg1: i32) -> i32 { | ||
%0 = arith.subi %arg0, %arg1 : i32 | ||
return %0 : i32 | ||
} | ||
|
||
func @main(%arg0 : i32, %arg1 : i32, %cond : i1) -> i32 { | ||
cond_br %cond, ^bb1, ^bb2 | ||
^bb1: | ||
%0 = call @add(%arg0, %arg1) : (i32, i32) -> i32 | ||
br ^bb3(%0 : i32) | ||
^bb2: | ||
%1 = call @sub(%arg0, %arg1) : (i32, i32) -> i32 | ||
br ^bb3(%1 : i32) | ||
^bb3(%res : i32): | ||
return %res : i32 | ||
} |