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

[LLHD] Add llhd.delay operation #7505

Merged
merged 1 commit into from
Aug 10, 2024
Merged
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
16 changes: 16 additions & 0 deletions include/circt/Dialect/LLHD/IR/SignalOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -307,3 +307,19 @@ def LLHD_RegOp : LLHD_Op<"reg", [

let hasVerifier = 1;
}

def DelayOp : LLHD_Op<"delay", [Pure, SameOperandsAndResultType]> {
let summary = "specifies value propagation delay";
let description = [{
This operation propagates all value changes of the input to the output after
the specified time delay.
Reference values are not supported (e.g., pointers, inout, etc.)
since the store-like operation used for those types should encode a delayed
store.
}];

let arguments = (ins HWNonInOutType:$input, LLHD_TimeAttr:$delay);
let results = (outs HWNonInOutType:$result);

let assemblyFormat = "$input `by` $delay attr-dict `:` type($result)";
}
9 changes: 9 additions & 0 deletions test/Dialect/LLHD/IR/basic.mlir
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// RUN: circt-opt %s | circt-opt | FileCheck %s

// CHECK-LABEL: @basic
// CHECK-SAME: (in [[IN0:%.+]] : i32, out out0 : i32)
hw.module @basic(in %in0 : i32, out out0 : i32) {
// CHECK: %{{.*}} = llhd.delay [[IN0]] by <0ns, 1d, 0e> : i32
%0 = llhd.delay %in0 by <0ns, 1d, 0e> : i32
hw.output %0 : i32
}
7 changes: 7 additions & 0 deletions test/Dialect/LLHD/IR/errors.mlir
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// RUN: circt-opt %s --split-input-file --verify-diagnostics

hw.module @errors(in %in0: i32, out out0: i8) {
// expected-error @below {{requires the same type for all operands and results}}
%0 = "llhd.delay"(%in0) {delay = #llhd.time<0ns, 1d, 0e>} : (i32) -> i8
hw.output %0 : i8
}
Loading