-
Notifications
You must be signed in to change notification settings - Fork 319
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ExportVerilog] Add a lowering option to fix up empty modules (#7454)
This commit adds a new lowering option to sanitize empty modules by creating a dummy wire in it.
- Loading branch information
Showing
5 changed files
with
52 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// RUN: circt-opt --test-apply-lowering-options='options=fixUpEmptyModules' --export-verilog %s | FileCheck %s --check-prefixes=CHECK | ||
|
||
// CHECK-LABEL: module empty1 | ||
hw.module @empty1() { | ||
// CHECK-NEXT: /* This wire is added to avoid emitting empty modules. See `fixUpEmptyModules` lowering option in CIRCT. */ | ||
// CHECK-NEXT: wire _GEN = 1'h1; | ||
} | ||
|
||
// CHECK-LABEL: module empty2 | ||
hw.module @empty2(in %in: i1, in %in2: i32) { | ||
// CHECK: /* This wire is added to avoid emitting empty modules. See `fixUpEmptyModules` lowering option in CIRCT. */ | ||
// CHECK-NEXT: wire _GEN = 1'h1; | ||
} | ||
|
||
// CHECK-LABEL: module not_empty | ||
hw.module @not_empty(in %in: i1, out out: i1) { | ||
// CHECK: assign out = in; | ||
hw.output %in : i1 | ||
} |