-
Notifications
You must be signed in to change notification settings - Fork 437
Expand file tree
/
Copy pathmacro_instance.mlir
More file actions
39 lines (32 loc) · 1.34 KB
/
macro_instance.mlir
File metadata and controls
39 lines (32 loc) · 1.34 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
// RUN: circt-opt %s | circt-opt | FileCheck %s
// RUN: circt-opt %s --export-verilog | FileCheck %s --check-prefix=VERILOG
// CHECK-LABEL: hw.module @ModuleA
hw.module @ModuleA(in %a: i1, in %b: i4, out c: i5) {
%0 = comb.concat %a, %b : i1, i4
hw.output %0 : i5
}
// CHECK-LABEL: hw.module @ModuleB
hw.module @ModuleB(in %a: i1, in %b: i4, out c: i5) {
%0 = comb.concat %a, %b : i1, i4
hw.output %0 : i5
}
// CHECK-LABEL: sv.macro.decl @WHICH_MODULE
sv.macro.decl @WHICH_MODULE
// CHECK-LABEL: hw.module @Top
hw.module @Top(in %a: i1, in %b: i4, out c: i5) {
// CHECK: %inst.c = sv.macro_instance "inst" @WHICH_MODULE [@ModuleA, @ModuleB](a: %a: i1, b: %b: i4) -> (c: i5)
%0 = sv.macro_instance "inst" @WHICH_MODULE [@ModuleA, @ModuleB] (a: %a: i1, b: %b: i4) -> (c: i5)
hw.output %0 : i5
}
// CHECK-LABEL: hw.module @TopWithSym
hw.module @TopWithSym(in %a: i1, in %b: i4, out c: i5) {
// CHECK: %inst2.c = sv.macro_instance "inst2" sym @inst_sym @WHICH_MODULE [@ModuleA, @ModuleB](a: %a: i1, b: %b: i4) -> (c: i5)
%0 = sv.macro_instance "inst2" sym @inst_sym @WHICH_MODULE [@ModuleA, @ModuleB] (a: %a: i1, b: %b: i4) -> (c: i5)
hw.output %0 : i5
}
// VERILOG-LABEL: module ModuleA
// VERILOG-LABEL: module ModuleB
// VERILOG-LABEL: module Top
// VERILOG: `WHICH_MODULE inst (
// VERILOG-LABEL: module TopWithSym
// VERILOG: `WHICH_MODULE inst2 (