-
Notifications
You must be signed in to change notification settings - Fork 299
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
[FIRRTL] Add GCT Data/Mem Tap Prefixing to PrefixModules #2031
Conversation
3921cc6
to
a43aecc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
I think next we need to update extern modules in NLAs too.
a43aecc
to
d1e0855
Compare
I tried this with the test case you added for NLAs. The actual logic should be fine, but the rename of external modules needs to clone modules if there are multiple prefixes. I erroneously thought that the prefixes array was "all the prefixes that need to be applied" instead of a list of different prefixes which require duplicating the module. I'll update this and ask for re-review. |
d1e0855
to
6d93382
Compare
I fixed this to actually do the right thing (clone the external module if there are multiple prefixes). I would be surprised if any Grand Central code exercises this, but we'll future proof what we're doing here. This copies the behavior for how normal, non-external modules are duplicated if they have multiple prefixes. I don't think there is any update needed for this to work with NLAs. All the NLA handling logic happens in either firrtl.circuit "NLATop" {
firrtl.nla @nla [@NLATop, @Aardvark, @Zebra] ["test", "test", "Zebra"]
firrtl.nla @nla_1 [@NLATop, @Aardvark, @Zebra] ["test", "test_1", "Zebra"]
firrtl.module @NLATop()
attributes {annotations = [{
class = "sifive.enterprise.firrtl.NestedPrefixModulesAnnotation",
prefix = "T_",
inclusive = true
}]} {
firrtl.instance test {annotations = [{circt.nonlocal = @nla, class = "circt.nonlocal"}, {circt.nonlocal = @nla_1, class = "circt.nonlocal"} ]}@Aardvark()
firrtl.instance test2 @Zebra()
}
firrtl.module @Aardvark()
attributes {annotations = [{
class = "sifive.enterprise.firrtl.NestedPrefixModulesAnnotation",
prefix = "A_",
inclusive = false
}]} {
firrtl.instance test {annotations = [{circt.nonlocal = @nla, class = "circt.nonlocal"}]}@Zebra()
firrtl.instance test1 {annotations = [{circt.nonlocal = @nla_1, class = "circt.nonlocal"}]}@Zebra()
}
firrtl.extmodule @Zebra()
attributes {annotations = [{
class = "sifive.enterprise.grandcentral.DataTapsAnnotation"}],
defname = "DataTap"}
} Produces: module {
firrtl.circuit "T_NLATop" {
firrtl.nla @nla [@T_NLATop, @T_Aardvark, @T_A_Zebra] ["test", "test", "Zebra"]
firrtl.nla @nla_1 [@T_NLATop, @T_Aardvark, @T_A_Zebra] ["test", "test_1", "Zebra"]
firrtl.module @T_NLATop() {
firrtl.instance test {annotations = [{circt.nonlocal = @nla, class = "circt.nonlocal"}, {circt.nonlocal = @nla_1, class = "circt.nonlocal"}]} @T_Aardvark()
firrtl.instance test2 @T_Zebra()
}
firrtl.module @T_Aardvark() {
firrtl.instance test {annotations = [{circt.nonlocal = @nla, class = "circt.nonlocal"}]} @T_A_Zebra()
firrtl.instance test1 {annotations = [{circt.nonlocal = @nla_1, class = "circt.nonlocal"}]} @T_A_Zebra()
}
firrtl.extmodule @T_Zebra() attributes {annotations = [{class = "sifive.enterprise.grandcentral.DataTapsAnnotation"}], defname = "T_DataTap"}
firrtl.extmodule @T_A_Zebra() attributes {annotations = [{class = "sifive.enterprise.grandcentral.DataTapsAnnotation"}], defname = "T_A_DataTap"}
}
} |
Change PrefixModules to rename external modules that are Grand Central data or memory taps. External modules that have more than one prefix will be cloned ("duplicated" in Scala FIRRTL Compiler terminology) to create new external modules for prefixes after the first. This is the same behavior as how PrefixModules works for non-external modules. Note: it is unexpected that Grand Central will produce (or work?) with multiply instantiated Data/Mem taps. However, the behavior added here is sane. This change aligns the prefixing behavior of CIRCT with the Scala FIRRTL Compiler for Grand Central Data/Mem taps. Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
6d93382
to
fa52bf6
Compare
Change PrefixModules to rename external modules that are Grand Central
data or memory taps. This is done to align the behavior of CIRCT with
the Scala FIRRTL Compiler.
Fixes #2027.