mirror of https://github.com/llvm/circt.git
[FIRRTLToHW] Copy "output_file" attr on FModuleOp
Copy an "output_file" attribute from a FIRRTL module to a HW module if such an attribute exists. This enables FIRRTL transforms to set output file information in a FIRRTL pass, which may be necessary if such information is available in an annotation that that pass consumes. Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
This commit is contained in:
parent
db084be5b9
commit
0938ce4508
|
@ -726,7 +726,11 @@ FIRRTLModuleLowering::lowerModule(FModuleOp oldModule, Block *topLevelModule,
|
|||
OpBuilder builder(topLevelModule->getParent()->getContext());
|
||||
builder.setInsertionPointToEnd(topLevelModule);
|
||||
auto nameAttr = builder.getStringAttr(oldModule.getName());
|
||||
return builder.create<hw::HWModuleOp>(oldModule.getLoc(), nameAttr, ports);
|
||||
auto newModule =
|
||||
builder.create<hw::HWModuleOp>(oldModule.getLoc(), nameAttr, ports);
|
||||
if (auto outputFile = oldModule->getAttr("output_file"))
|
||||
newModule->setAttr("output_file", outputFile);
|
||||
return newModule;
|
||||
}
|
||||
|
||||
/// Given a value of analog type, check to see the only use of it is an attach.
|
||||
|
|
|
@ -406,6 +406,18 @@ firrtl.circuit "Simple" attributes {annotations = [{class =
|
|||
%baz = firrtl.instance @bar {lowerToBind = true, name = "baz"} : !firrtl.uint<1>
|
||||
}
|
||||
|
||||
|
||||
// CHECK-LABEL: hw.module @output_fileTest
|
||||
// CHECK-SAME: directory = "output_fileTest/dir", exclude_from_filelist = true
|
||||
// CHECK-SAME: exclude_replicated_ops = true, name = "output_fileTest.sv"
|
||||
firrtl.module @output_fileTest() attributes {output_file = {
|
||||
directory = "output_fileTest/dir",
|
||||
exclude_from_filelist = true,
|
||||
exclude_replicated_ops = true,
|
||||
name = "output_fileTest.sv"
|
||||
}} {
|
||||
}
|
||||
|
||||
// https://github.com/llvm/circt/issues/314
|
||||
// CHECK-LABEL: hw.module @issue314
|
||||
firrtl.module @issue314(in %inp_2: !firrtl.uint<27>, in %inpi: !firrtl.uint<65>) {
|
||||
|
|
Loading…
Reference in New Issue