summaryrefslogtreecommitdiff
path: root/chiselFrontend/src/main
diff options
context:
space:
mode:
authorAndrew Waterman2016-06-23 12:14:34 -0700
committerAndrew Waterman2016-06-23 12:14:34 -0700
commit2e9b41cafe9158f20ecb03ae9eabecb82e557829 (patch)
tree68d1cad622fa2248fb78c08fe80e799eedca4f0b /chiselFrontend/src/main
parent70a41e5aed5dc3bc52133aecf46049a5946d33fe (diff)
Expose FIRRTL stop construct
Diffstat (limited to 'chiselFrontend/src/main')
-rw-r--r--chiselFrontend/src/main/scala/chisel/core/Assert.scala14
1 files changed, 14 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)
+ }
+}