forked from llvm/circt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexternalize-registers-errors.mlir
More file actions
55 lines (45 loc) · 1.97 KB
/
externalize-registers-errors.mlir
File metadata and controls
55 lines (45 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// RUN: circt-opt --externalize-registers --split-input-file --verify-diagnostics %s
hw.module @two_clks(in %clk_i1: i1, in %in: i32, out out: i32) {
%clk = seq.to_clock %clk_i1
// expected-error @below {{only clocks directly given as block arguments are supported}}
%1 = seq.compreg %in, %clk : i32
hw.output %1 : i32
}
// -----
hw.module @reg_with_indirect_initial(in %clk: !seq.clock, in %in: i32, out out: i32) {
%init = seq.initial () {
%c0_i32 = hw.constant 0 : i32
%sum = comb.add %c0_i32, %c0_i32 : i32
seq.yield %sum : i32
} : () -> !seq.immutable<i32>
// expected-error @below {{registers with initial values not directly defined by a hw.constant op in a seq.initial op not yet supported}}
%1 = seq.compreg %in, %clk initial %init : i32
hw.output %1 : i32
}
// -----
hw.module @reg_with_argument_initial(in %clk: !seq.clock, in %in: i32, in %init: !seq.immutable<i32>, out out: i32) {
// expected-error @below {{registers with initial values not directly defined by a seq.initial op not yet supported}}
%1 = seq.compreg %in, %clk initial %init : i32
hw.output %1 : i32
}
// -----
hw.module @init_emitter(out out: !seq.immutable<i32>) {
%init = seq.initial () {
%c0_i32 = hw.constant 0 : i32
seq.yield %c0_i32 : i32
} : () -> !seq.immutable<i32>
hw.output %init : !seq.immutable<i32>
}
hw.module @reg_with_instance_initial(in %clk: !seq.clock, in %in: i32, out out: i32) {
%init = hw.instance "foo" @init_emitter () -> (out: !seq.immutable<i32>)
// expected-error @below {{registers with initial values not directly defined by a seq.initial op not yet supported}}
%1 = seq.compreg %in, %clk initial %init : i32
hw.output %1 : i32
}
// -----
hw.module @firreg_with_async_reset(in %clk: !seq.clock, in %rst: i1, in %in: i32, out out: i32) {
%c0_i32 = hw.constant 0 : i32
// expected-error @below {{registers with an async reset are not yet supported}}
%1 = seq.firreg %in clock %clk reset async %rst, %c0_i32 : i32
hw.output %1 : i32
}