diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/scala/firrtl/passes/CheckWidths.scala | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/scala/firrtl/passes/CheckWidths.scala b/src/main/scala/firrtl/passes/CheckWidths.scala index b750196a..28369ff2 100644 --- a/src/main/scala/firrtl/passes/CheckWidths.scala +++ b/src/main/scala/firrtl/passes/CheckWidths.scala @@ -35,6 +35,10 @@ object CheckWidths extends Pass with PreservesAll[Transform] { s"$info : [target $mname] Width $b greater than max allowed width of $MaxWidth bits") class DshlTooBig(info: Info, mname: String) extends PassException( s"$info : [target $mname] Width of dshl shift amount cannot be larger than $DshlMaxWidth bits.") + class MultiBitAsClock(info: Info, mname: String) extends PassException( + s"$info : [target $mname] Cannot cast a multi-bit signal to a Clock.") + class MultiBitAsAsyncReset(info: Info, mname: String) extends PassException( + s"$info : [target $mname] Cannot cast a multi-bit signal to an AsyncReset.") class NegWidthException(info:Info, mname: String) extends PassException( s"$info: [target $mname] Width cannot be negative or zero.") class BitsWidthException(info: Info, mname: String, hi: BigInt, width: BigInt, exp: String) extends PassException( @@ -131,6 +135,10 @@ object CheckWidths extends Pass with PreservesAll[Transform] { errors append new TailWidthException(info, target.serialize, n, bitWidth(a.tpe)) case DoPrim(Dshl, Seq(a, b), _, _) if (hasWidth(a.tpe) && bitWidth(b.tpe) >= DshlMaxWidth) => errors append new DshlTooBig(info, target.serialize) + case DoPrim(AsClock, Seq(a), _, _) if (bitWidth(a.tpe) != 1) => + errors.append(new MultiBitAsClock(info, target.serialize)) + case DoPrim(AsAsyncReset, Seq(a), _, _) if (bitWidth(a.tpe) != 1) => + errors.append(new MultiBitAsAsyncReset(info, target.serialize)) case _ => } e foreach check_width_e(info, target) |
