summaryrefslogtreecommitdiff
path: root/chiselFrontend/src/main/scala/chisel3
diff options
context:
space:
mode:
authorJim Lawson2016-06-24 16:10:38 -0700
committerJim Lawson2016-06-24 16:10:38 -0700
commit3c6cf9dfd546332b90c43ede0e2e2f85a90bc54d (patch)
tree69e329f3fcf427e4786e0e9bde43b98d75564be5 /chiselFrontend/src/main/scala/chisel3
parent47a8b0c8318a3bfe6e86da3398cd67dbfadd8758 (diff)
parent2e9b41cafe9158f20ecb03ae9eabecb82e557829 (diff)
Merge branch 'master' into renamechisel3
Diffstat (limited to 'chiselFrontend/src/main/scala/chisel3')
-rw-r--r--chiselFrontend/src/main/scala/chisel3/core/Assert.scala14
1 files changed, 14 insertions, 0 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Assert.scala b/chiselFrontend/src/main/scala/chisel3/core/Assert.scala
index c4727148..9111a334 100644
--- a/chiselFrontend/src/main/scala/chisel3/core/Assert.scala
+++ b/chiselFrontend/src/main/scala/chisel3/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)
+ }
+}