summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/scala/Chisel/CoreUtil.scala20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/main/scala/Chisel/CoreUtil.scala b/src/main/scala/Chisel/CoreUtil.scala
index aaca404b..7077c9c1 100644
--- a/src/main/scala/Chisel/CoreUtil.scala
+++ b/src/main/scala/Chisel/CoreUtil.scala
@@ -21,7 +21,7 @@ object assert {
* @param cond condition, assertion fires (simulation fails) when false
* @param message optional message to print when the assertion fires
*/
- def apply(cond: Bool, message: String="") {
+ def apply(cond: Bool, message: String) {
when (!Builder.dynamicContext.currentModule.get.reset) {
when(!cond) {
if (message.isEmpty()) {
@@ -33,6 +33,24 @@ object assert {
}
}
}
+
+ /** A workaround for default-value overloading problems in Scala, just
+ * 'assert(cond, "")' */
+ def apply(cond: Bool) {
+ assert(cond, "")
+ }
+
+ /** An elaboration-time assertion, otherwise the same as the above run-time
+ * assertion. */
+ def apply(cond: Boolean, message: String) {
+ apply(Bool(cond), message)
+ }
+
+ /** A workaround for default-value overloading problems in Scala, just
+ * 'assert(cond, "")' */
+ def apply(cond: Boolean) {
+ apply(cond, "")
+ }
}
object printf {