diff options
| author | Jim Lawson | 2016-06-24 16:10:38 -0700 |
|---|---|---|
| committer | Jim Lawson | 2016-06-24 16:10:38 -0700 |
| commit | 3c6cf9dfd546332b90c43ede0e2e2f85a90bc54d (patch) | |
| tree | 69e329f3fcf427e4786e0e9bde43b98d75564be5 | |
| parent | 47a8b0c8318a3bfe6e86da3398cd67dbfadd8758 (diff) | |
| parent | 2e9b41cafe9158f20ecb03ae9eabecb82e557829 (diff) | |
Merge branch 'master' into renamechisel3
| -rw-r--r-- | chiselFrontend/src/main/scala/chisel3/core/Assert.scala | 14 | ||||
| -rw-r--r-- | src/main/scala/chisel3/compatibility.scala | 1 |
2 files changed, 15 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) + } +} diff --git a/src/main/scala/chisel3/compatibility.scala b/src/main/scala/chisel3/compatibility.scala index 139e9431..c0e933e0 100644 --- a/src/main/scala/chisel3/compatibility.scala +++ b/src/main/scala/chisel3/compatibility.scala @@ -22,6 +22,7 @@ package object Chisel { type Bundle = chisel3.core.Bundle val assert = chisel3.core.assert + val stop = chisel3.core.stop type Element = chisel3.core.Element type Bits = chisel3.core.Bits |
