summaryrefslogtreecommitdiff
path: root/chiselFrontend
diff options
context:
space:
mode:
Diffstat (limited to 'chiselFrontend')
-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)
+ }
+}