summaryrefslogtreecommitdiff
path: root/chiselFrontend/src/main/scala/chisel3/core/Assert.scala
diff options
context:
space:
mode:
authorJack Koenig2017-02-16 11:02:21 -0800
committerGitHub2017-02-16 11:02:21 -0800
commit563f348ca3e4a984ad23caba9e980dab8fa808bb (patch)
tree46dfe1e3a0a76b2f106a48332e55237ef237f441 /chiselFrontend/src/main/scala/chisel3/core/Assert.scala
parentd00a3fe9a3df5ce888b5c461181aadbd4a293bf3 (diff)
Add support for clock and reset scoping (#509)
withClockAndReset, withReset, and withClock allow changing the implicit clock and reset. Module.clock and Module.reset provide access to the current implicit clock and reset.
Diffstat (limited to 'chiselFrontend/src/main/scala/chisel3/core/Assert.scala')
-rw-r--r--chiselFrontend/src/main/scala/chisel3/core/Assert.scala8
1 files changed, 4 insertions, 4 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Assert.scala b/chiselFrontend/src/main/scala/chisel3/core/Assert.scala
index 4782a845..5673e298 100644
--- a/chiselFrontend/src/main/scala/chisel3/core/Assert.scala
+++ b/chiselFrontend/src/main/scala/chisel3/core/Assert.scala
@@ -51,12 +51,12 @@ object assert { // scalastyle:ignore object.name
}
def apply_impl_do(cond: Bool, line: String, message: Option[String], data: Bits*)(implicit sourceInfo: SourceInfo) {
- when (!(cond || Builder.forcedModule.reset)) {
+ when (!(cond || Builder.forcedReset)) {
message match {
case Some(str) => printf.printfWithoutReset(s"Assertion failed: $str\n at $line\n", data:_*)
case None => printf.printfWithoutReset(s"Assertion failed\n at $line\n", data:_*)
}
- pushCommand(Stop(sourceInfo, Node(Builder.forcedModule.clock), 1))
+ pushCommand(Stop(sourceInfo, Node(Builder.forcedClock), 1))
}
}
@@ -76,8 +76,8 @@ object assert { // scalastyle:ignore object.name
object stop { // scalastyle:ignore object.name
/** Terminate execution with a failure code. */
def apply(code: Int)(implicit sourceInfo: SourceInfo): Unit = {
- when (!Builder.forcedModule.reset) {
- pushCommand(Stop(sourceInfo, Node(Builder.forcedModule.clock), code))
+ when (!Builder.forcedReset) {
+ pushCommand(Stop(sourceInfo, Node(Builder.forcedClock), code))
}
}