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

[firtool] Change layer specialization CLI interface #7520

Merged
merged 1 commit into from
Aug 15, 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
4 changes: 2 additions & 2 deletions lib/Dialect/FIRRTL/Import/FIRParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5671,11 +5671,11 @@ ParseResult FIRCircuitParser::parseCircuit(
// a SymbolRefAttr.
auto parseLayerName = [&](StringRef name) {
// Parse the layer name into a SymbolRefAttr.
auto [head, rest] = name.split("::");
auto [head, rest] = name.split(".");
SmallVector<FlatSymbolRefAttr> nestedRefs;
while (!rest.empty()) {
StringRef next;
std::tie(next, rest) = rest.split("::");
std::tie(next, rest) = rest.split(".");
nestedRefs.push_back(FlatSymbolRefAttr::get(getContext(), next));
}
return SymbolRefAttr::get(getContext(), head, nestedRefs);
Expand Down
11 changes: 0 additions & 11 deletions test/firtool/specialize-layers-2.fir

This file was deleted.

21 changes: 21 additions & 0 deletions test/firtool/specialize-layers-cli.fir
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
; RUN: firtool -parse-only %s | FileCheck %s --check-prefixes=NONE
; RUN: firtool -parse-only -disable-layers=A %s | FileCheck %s --check-prefixes=DISABLEA
; RUN: firtool -parse-only -enable-layers=A %s | FileCheck %s --check-prefixes=ENABLEA
; RUN: firtool -parse-only -enable-layers=A.B %s | FileCheck %s --check-prefixes=ENABLEB
; RUN: firtool -parse-only -disable-layers=A,A.B %s | FileCheck %s --check-prefixes=DISABLEBOTH
; RUN: firtool -parse-only -disable-layers=A -enable-layers=A.B %s | FileCheck %s --check-prefixes=BOTH

; Check that the command line options are working correctly.
; https://github.com/llvm/circt/issues/7345

FIRRTL version 4.0.0
; NONE: firrtl.circuit "Foo" {
; DISABLEA: firrtl.circuit "Foo" attributes {disable_layers = [@A]} {
; ENABLEA: firrtl.circuit "Foo" attributes {enable_layers = [@A]} {
; ENABLEB: firrtl.circuit "Foo" attributes {enable_layers = [@A::@B]} {
; DISABLEBOTH: firrtl.circuit "Foo" attributes {disable_layers = [@A, @A::@B]} {
; BOTH: firrtl.circuit "Foo" attributes {disable_layers = [@A], enable_layers = [@A::@B]} {
circuit Foo:
layer A, bind:
layer B, bind:
public module Foo:
Loading