diff options
| author | Justin Deters | 2020-08-11 18:28:12 -0500 |
|---|---|---|
| committer | GitHub | 2020-08-11 23:28:12 +0000 |
| commit | e0c805171ddb9707b0f9fe93e5d85ef9cdcab044 (patch) | |
| tree | 8b331390b99204b72c7abfab67351845b685f06c /core/src/main/scala/chisel3/internal/BiConnect.scala | |
| parent | 3668532fabc4ba4eaf70cf0ad1a55522aa33cdb3 (diff) | |
Bug fix for manipulating submodules in aspects (#1538)
* Fixed the aspect as parent bug in Data and MonoConnect
* refactored and cleaned up finding an aspect parent
* Added aspect fix to the BiConnect class
* added unit test for manipulating submodules via aspects
* Refactored to move determination of proper parent to Builder and made logic simpler in MonoConnect, Data, and BiConnect
* Removed unused function and provided Scaladoc for retrieveParent
Diffstat (limited to 'core/src/main/scala/chisel3/internal/BiConnect.scala')
| -rw-r--r-- | core/src/main/scala/chisel3/internal/BiConnect.scala | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/core/src/main/scala/chisel3/internal/BiConnect.scala b/core/src/main/scala/chisel3/internal/BiConnect.scala index 8cc4bbaf..49cfeb75 100644 --- a/core/src/main/scala/chisel3/internal/BiConnect.scala +++ b/core/src/main/scala/chisel3/internal/BiConnect.scala @@ -222,12 +222,14 @@ private[chisel3] object BiConnect { val left_mod: BaseModule = left.topBinding.location.getOrElse(context_mod) val right_mod: BaseModule = right.topBinding.location.getOrElse(context_mod) + val left_parent = Builder.retrieveParent(left_mod, context_mod).getOrElse(None) + val right_parent = Builder.retrieveParent(right_mod, context_mod).getOrElse(None) + val left_direction = BindingDirection.from(left.topBinding, left.direction) val right_direction = BindingDirection.from(right.topBinding, right.direction) // CASE: Context is same module as left node and right node is in a child module - if( (left_mod == context_mod) && - (right_mod._parent.map(_ == context_mod).getOrElse(false)) ) { + if((left_mod == context_mod) && (right_parent == context_mod)) { // Thus, right node better be a port node and thus have a direction hint ((left_direction, right_direction): @unchecked) match { // CURRENT MOD CHILD MOD @@ -244,8 +246,7 @@ private[chisel3] object BiConnect { } // CASE: Context is same module as right node and left node is in child module - else if( (right_mod == context_mod) && - (left_mod._parent.map(_ == context_mod).getOrElse(false)) ) { + else if((right_mod == context_mod) && (left_parent == context_mod)) { // Thus, left node better be a port node and thus have a direction hint ((left_direction, right_direction): @unchecked) match { // CHILD MOD CURRENT MOD @@ -288,9 +289,7 @@ private[chisel3] object BiConnect { // CASE: Context is the parent module of both the module containing left node // and the module containing right node // Note: This includes case when left and right in same module but in parent - else if( (left_mod._parent.map(_ == context_mod).getOrElse(false)) && - (right_mod._parent.map(_ == context_mod).getOrElse(false)) - ) { + else if((left_parent == context_mod) && (right_parent == context_mod)) { // Thus both nodes must be ports and have a direction hint ((left_direction, right_direction): @unchecked) match { // CHILD MOD CHILD MOD |
