aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorJack Koenig2016-12-05 12:24:04 -0800
committerGitHub2016-12-05 12:24:04 -0800
commita34f2265c9bfed4eb1d72d611e435df5d57e86e3 (patch)
tree884e00c51c9012ec960b3165533172eec56acb68 /src/main
parentad36788b79f8b63be59d9612134889aef874c286 (diff)
Add check for muxing between clocks (#360)
Also run CheckTypes after ExpandWhens Fixes #330
Diffstat (limited to 'src/main')
-rw-r--r--src/main/scala/firrtl/LoweringCompilers.scala1
-rw-r--r--src/main/scala/firrtl/passes/Checks.scala4
2 files changed, 5 insertions, 0 deletions
diff --git a/src/main/scala/firrtl/LoweringCompilers.scala b/src/main/scala/firrtl/LoweringCompilers.scala
index eb873232..c29ce01a 100644
--- a/src/main/scala/firrtl/LoweringCompilers.scala
+++ b/src/main/scala/firrtl/LoweringCompilers.scala
@@ -64,6 +64,7 @@ class HighFirrtlToMiddleFirrtl extends CoreTransform {
passes.CheckInitialization,
passes.ResolveKinds,
passes.InferTypes,
+ passes.CheckTypes,
passes.ResolveGenders,
passes.InferWidths,
passes.CheckWidths)
diff --git a/src/main/scala/firrtl/passes/Checks.scala b/src/main/scala/firrtl/passes/Checks.scala
index 0d16ef00..769f68a9 100644
--- a/src/main/scala/firrtl/passes/Checks.scala
+++ b/src/main/scala/firrtl/passes/Checks.scala
@@ -250,6 +250,8 @@ object CheckTypes extends Pass {
s"$info: [module $mname] Must mux between passive types.")
class MuxCondUInt(info: Info, mname: String) extends PassException(
s"$info: [module $mname] A mux condition must be of type UInt.")
+ class MuxClock(info: Info, mname: String) extends PassException(
+ s"$info: [module $mname] Firrtl does not support muxing clocks.")
class ValidIfPassiveTypes(info: Info, mname: String) extends PassException(
s"$info: [module $mname] Must validif a passive type.")
class ValidIfCondUInt(info: Info, mname: String) extends PassException(
@@ -371,6 +373,8 @@ object CheckTypes extends Pass {
case _: UIntType =>
case _ => errors append new MuxCondUInt(info, mname)
}
+ if ((e.tval.tpe == ClockType) || (e.fval.tpe == ClockType))
+ errors.append(new MuxClock(info, mname))
case (e: ValidIf) =>
if (!passive(e.tpe))
errors append new ValidIfPassiveTypes(info, mname)