summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman2016-06-23 12:14:34 -0700
committerAndrew Waterman2016-06-23 12:14:34 -0700
commit2e9b41cafe9158f20ecb03ae9eabecb82e557829 (patch)
tree68d1cad622fa2248fb78c08fe80e799eedca4f0b
parent70a41e5aed5dc3bc52133aecf46049a5946d33fe (diff)
Expose FIRRTL stop construct
-rw-r--r--chiselFrontend/src/main/scala/chisel/core/Assert.scala14
-rw-r--r--src/main/scala/chisel/compatibility.scala1
2 files changed, 15 insertions, 0 deletions
diff --git a/chiselFrontend/src/main/scala/chisel/core/Assert.scala b/chiselFrontend/src/main/scala/chisel/core/Assert.scala
index 00cb00f4..f665843b 100644
--- a/chiselFrontend/src/main/scala/chisel/core/Assert.scala
+++ b/chiselFrontend/src/main/scala/chisel/core/Assert.scala
@@ -71,3 +71,17 @@ object assert { // scalastyle:ignore object.name
Predef.assert(cond, "")
}
}
+
+object stop { // scalastyle:ignore object.name
+ /** Terminate execution with a failure code. */
+ def apply(code: Int)(implicit sourceInfo: SourceInfo): Unit = {
+ when (!Builder.dynamicContext.currentModule.get.reset) {
+ pushCommand(Stop(sourceInfo, Node(Builder.dynamicContext.currentModule.get.clock), code))
+ }
+ }
+
+ /** Terminate execution, indicating success. */
+ def apply()(implicit sourceInfo: SourceInfo): Unit = {
+ stop(0)
+ }
+}
diff --git a/src/main/scala/chisel/compatibility.scala b/src/main/scala/chisel/compatibility.scala
index 56088562..af5daef7 100644
--- a/src/main/scala/chisel/compatibility.scala
+++ b/src/main/scala/chisel/compatibility.scala
@@ -22,6 +22,7 @@ package object Chisel {
type Bundle = chisel.core.Bundle
val assert = chisel.core.assert
+ val stop = chisel.core.stop
type Element = chisel.core.Element
type Bits = chisel.core.Bits