summaryrefslogtreecommitdiff
path: root/chiselFrontend/src
diff options
context:
space:
mode:
authorHoward Mao2016-06-20 16:00:19 -0700
committerAndrew Waterman2016-06-20 16:00:19 -0700
commit70a41e5aed5dc3bc52133aecf46049a5946d33fe (patch)
treef36e4aeb6f3a61dc63dd26846d60e01f453b0591 /chiselFrontend/src
parent077aa80ea61b8517ef13f72d1fa3bec2aaa3063b (diff)
fix BlackBox setRefs to correctly handle arbitrarily nested bundles as ports (#223)
Diffstat (limited to 'chiselFrontend/src')
-rw-r--r--chiselFrontend/src/main/scala/chisel/core/BlackBox.scala14
1 files changed, 11 insertions, 3 deletions
diff --git a/chiselFrontend/src/main/scala/chisel/core/BlackBox.scala b/chiselFrontend/src/main/scala/chisel/core/BlackBox.scala
index 2126ebce..0e4c7a0c 100644
--- a/chiselFrontend/src/main/scala/chisel/core/BlackBox.scala
+++ b/chiselFrontend/src/main/scala/chisel/core/BlackBox.scala
@@ -28,13 +28,21 @@ abstract class BlackBox extends Module {
// Do not do reflective naming of internal signals, just name io
override private[core] def setRefs(): this.type = {
- for ((name, port) <- ports) {
- port.setRef(ModuleIO(this, _namespace.name(name)))
- }
// setRef is not called on the actual io.
// There is a risk of user improperly attempting to connect directly with io
// Long term solution will be to define BlackBox IO differently as part of
// it not descending from the (current) Module
+ for ((name, port) <- ports) {
+ port.setRef(ModuleIO(this, _namespace.name(name)))
+ }
+ // We need to call forceName and onModuleClose on all of the sub-elements
+ // of the io bundle, but NOT on the io bundle itself.
+ // Doing so would cause the wrong names to be assigned, since their parent
+ // is now the module itself instead of the io bundle.
+ for (id <- _ids; if id ne io) {
+ id.forceName(default="T", _namespace)
+ id._onModuleClose
+ }
this
}