summaryrefslogtreecommitdiff
path: root/chiselFrontend/src
diff options
context:
space:
mode:
authorEdward Wang2019-04-10 00:16:48 -0700
committeredwardcwang2019-04-19 13:02:34 -0700
commit32acdcf63ab74e7d47d7600f2211a72dd19280c3 (patch)
treee4ff45be46e9353a06814aeecb9207284df388e8 /chiselFrontend/src
parentfe5571d5218149ead6df36c82485bce8e31a223f (diff)
Fix wrong directionality for Vec(Flipped())
Create Chisel IR Port() in a way that Converter is happy with. Also add more extensive test suite for future-proofing. Close #1063
Diffstat (limited to 'chiselFrontend/src')
-rw-r--r--chiselFrontend/src/main/scala/chisel3/core/RawModule.scala19
1 files changed, 18 insertions, 1 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/RawModule.scala b/chiselFrontend/src/main/scala/chisel3/core/RawModule.scala
index 00e78295..b1cae1b7 100644
--- a/chiselFrontend/src/main/scala/chisel3/core/RawModule.scala
+++ b/chiselFrontend/src/main/scala/chisel3/core/RawModule.scala
@@ -85,7 +85,24 @@ abstract class RawModule(implicit moduleCompileOptions: CompileOptions)
id._onModuleClose
}
- val firrtlPorts = getModulePorts map {port => Port(port, port.specifiedDirection)}
+ val firrtlPorts = getModulePorts map { port: Data =>
+ // Special case Vec to make FIRRTL emit the direction of its
+ // element.
+ // Just taking the Vec's specifiedDirection is a bug in cases like
+ // Vec(Flipped()), since the Vec's specifiedDirection is
+ // Unspecified.
+ val direction = port match {
+ case v: Vec[_] => v.specifiedDirection match {
+ case SpecifiedDirection.Input => SpecifiedDirection.Input
+ case SpecifiedDirection.Output => SpecifiedDirection.Output
+ case SpecifiedDirection.Flip => SpecifiedDirection.flip(v.sample_element.specifiedDirection)
+ case SpecifiedDirection.Unspecified => v.sample_element.specifiedDirection
+ }
+ case _ => port.specifiedDirection
+ }
+
+ Port(port, direction)
+ }
_firrtlPorts = Some(firrtlPorts)
// Generate IO invalidation commands to initialize outputs as unused,