-
Notifications
You must be signed in to change notification settings - Fork 437
Expand file tree
/
Copy pathprocesses.mlir
More file actions
110 lines (102 loc) · 3.39 KB
/
processes.mlir
File metadata and controls
110 lines (102 loc) · 3.39 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// RUN: circt-opt %s -canonicalize | FileCheck %s
// CHECK-LABEL: hw.module @EmptyProcess(
hw.module @EmptyProcess() {
llhd.process {
llhd.halt
}
llhd.combinational {
llhd.yield
}
// CHECK-NEXT: hw.output
}
// CHECK-LABEL: hw.module @DontRemoveEmptyProcessWithResults(
hw.module @DontRemoveEmptyProcessWithResults(in %a: i42, out z: i42) {
// CHECK-NEXT: llhd.process -> i42 {
// CHECK-NEXT: llhd.halt
// CHECK-NEXT: }
// CHECK-NEXT: hw.output
%0 = llhd.process -> i42 {
llhd.halt %a : i42
}
hw.output %0 : i42
}
// CHECK-LABEL: hw.module @InlineCombinational(
hw.module @InlineCombinational(in %a: i42, in %b: i42, in %c: i8917, out u: i42, out v: i9001) {
// CHECK-NEXT: [[TMP1:%.+]] = comb.xor %a, %b
// CHECK-NEXT: [[TMP2:%.+]] = comb.concat %a, %b, %c
// CHECK-NEXT: hw.output [[TMP1]], [[TMP2]]
%0, %1 = llhd.combinational -> i42, i9001 {
%2 = comb.xor %a, %b : i42
%3 = comb.concat %a, %b, %c : i42, i42, i8917
llhd.yield %2, %3 : i42, i9001
}
hw.output %0, %1 : i42, i9001
}
// CHECK-LABEL: hw.module @InlineCombinationalVerif(
hw.module @InlineCombinationalVerif(in %a: i1, in %b: i1, in %c: i1, out u: i1, out
v: i3) {
// CHECK-NEXT: [[TMP1:%.+]] = comb.xor %a, %b
// CHECK-NEXT: verif.assert [[TMP1]] label "" : i1
// CHECK-NEXT: [[TMP2:%.+]] = comb.concat %a, %b, %c
// CHECK-NEXT: hw.output [[TMP1]], [[TMP2]]
%0, %1 = llhd.combinational -> i1, i3 {
%2 = comb.xor %a, %b : i1
verif.assert %2 label "" : i1
%3 = comb.concat %a, %b, %c : i1, i1, i1
llhd.yield %2, %3 : i1, i3
}
hw.output %0, %1 : i1, i3
}
// CHECK-LABEL: hw.module @IgnoreMultiBlockHalt
hw.module @IgnoreMultiBlockHalt(in %a : i1, in %b : i1, out v1 : i1, out v2 : i1) {
// CHECK: llhd.halt %a, %a
%0:2 = llhd.process -> i1, i1 {
^bb0:
cf.br ^bb1
^bb1:
cf.cond_br %b, ^bb1, ^bb2
^bb2:
%true = hw.constant true
llhd.halt %a, %a : i1, i1
}
hw.output %0#0, %0#1 : i1, i1
}
// CHECK-LABEL: hw.module @DeduplicateHaltOperands0
hw.module @DeduplicateHaltOperands0(in %a : i1, in %b : i1,
out v1 : i1, out v2 : i1, out v3 : i1, out v4 : i1) {
// CHECK: %0:2 = llhd.process -> i1, i1 {
// CHECK-NEXT: llhd.halt %a, %b : i1, i1
// CHECK-NEXT: }
// CHECK-NEXT: hw.output %0#0, %0#1, %0#0, %0#1
%false = hw.constant false
%0:6 = llhd.process -> i1, i1, i1, i1, i1, i1 {
%true = hw.constant true
llhd.halt %false, %a, %b, %a, %true, %b : i1, i1, i1, i1, i1, i1
}
hw.output %0#1, %0#2, %0#3, %0#5 : i1, i1, i1, i1
}
// CHECK-LABEL: hw.module @CanonProcessHalt0
hw.module @CanonProcessHalt0(out v1 : i1, out v2 : i1) {
// CHECK-NOT: llhd.halt
// CHECK: hw.output %false, %true
%false = hw.constant false
%0:2 = llhd.process -> i1, i1 {
%true = hw.constant true
llhd.halt %false, %true : i1, i1
}
hw.output %0#0, %0#1 : i1, i1
}
// CHECK-LABEL: hw.module @CanonProcessHalt1
hw.module @CanonProcessHalt1(in %a : i1, in %b : i1,
out v1 : i1, out v2 : i1, out v3 : i1, out v4 : i1) {
// CHECK: %0:2 = llhd.process -> i1, i1 {
// CHECK-NEXT: llhd.halt %a, %b : i1, i1
// CHECK-NEXT: }
// CHECK-NEXT: hw.output %0#1, %false, %0#0, %true
%0:4 = llhd.process -> i1, i1, i1, i1 {
%false = hw.constant false
%true = hw.constant true
llhd.halt %false, %a, %true, %b : i1, i1, i1, i1
}
hw.output %0#3, %0#0, %0#1, %0#2 : i1, i1, i1, i1
}