forked from llvm/circt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[HW][SV] Change referencing for names inside modules (llvm#2032)
Since wires, etc don't really behave like symbols in mlir, don't claim they are symbols. Use a different attribute to name things within a module (effectively a nested symbol table), without breaking module resolution by actually using a nested symbol table. Add a attribute to refer to names inside modules: #hw.innerNameRef. Update bind and verbatim to take moduese or innerNameRefs, and add associated output code. Add an argument attribute to tag a port as having a visible name and update the resolution code in ExportVerilog to be able to resolve innNameRefs to ports. This gives a unified way to name verilog-namable entities.
- Loading branch information
Showing
26 changed files
with
282 additions
and
122 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//===- HWAttributesNaming.td - Attributes for HW dialect ---*- tablegen -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This file defines HW dialect attributes used in other dialects. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
def InnerRefAttr : AttrDef<HWDialect, "InnerRef"> { | ||
let summary = "Refer to a name inside a module"; | ||
let description = [{ | ||
This works like a symbol reference, but to a name inside a module. | ||
}]; | ||
let mnemonic = "innerNameRef"; | ||
let parameters = (ins "::mlir::StringAttr":$module, "::mlir::StringAttr":$name); | ||
let builders = [ | ||
AttrBuilderWithInferredContext<(ins "::mlir::StringAttr":$module, "::mlir::StringAttr":$name),[{ | ||
return get(module.getContext(), module, name); | ||
}]>, | ||
]; | ||
} |
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 |
---|---|---|
|
@@ -174,4 +174,3 @@ def TypeAliasType : HWType<"TypeAlias"> { | |
TypedeclOp getTypeDecl(const SymbolCache &cache); | ||
}]; | ||
} | ||
|
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
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
Oops, something went wrong.