diff options
| author | Jim Lawson | 2017-04-25 08:44:35 -0700 |
|---|---|---|
| committer | GitHub | 2017-04-25 08:44:35 -0700 |
| commit | 4a6396ca5ff9dfba9019552012bce459ef3c3b1e (patch) | |
| tree | 940018ca04febec6f3e18b1f03700fa3f203708e /chiselFrontend/src/main/scala/chisel3/core/Assert.scala | |
| parent | d439ac0144826bb170c43ae71df9782cdd0d5749 (diff) | |
Remove explicit import of NotStrict - fixes #492 (#494)
* Remove explicit import of NotStrict - fixes #492
* Provide macro for MemBase.apply().
* Provide macro for MemBase.apply().
Since a macro cannot override an abstract method, provide a concrete
apply method n VecLike() that we can override with a macro.
* Remove concrete apply() in VecLike.
Since MemBase no longer extends the trait VecLike, we do not require a concrete method to which we can apply a macro to extract the appropriate CompileOptions.
Diffstat (limited to 'chiselFrontend/src/main/scala/chisel3/core/Assert.scala')
| -rw-r--r-- | chiselFrontend/src/main/scala/chisel3/core/Assert.scala | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Assert.scala b/chiselFrontend/src/main/scala/chisel3/core/Assert.scala index e3fef5f9..8616154b 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/Assert.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/Assert.scala @@ -31,26 +31,26 @@ object assert { // scalastyle:ignore object.name * that */ // Macros currently can't take default arguments, so we need two functions to emulate defaults. - def apply(cond: Bool, message: String, data: Bits*)(implicit sourceInfo: SourceInfo): Unit = macro apply_impl_msg_data - def apply(cond: Bool)(implicit sourceInfo: SourceInfo): Unit = macro apply_impl + def apply(cond: Bool, message: String, data: Bits*)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Unit = macro apply_impl_msg_data + def apply(cond: Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Unit = macro apply_impl - def apply_impl_msg_data(c: Context)(cond: c.Tree, message: c.Tree, data: c.Tree*)(sourceInfo: c.Tree): c.Tree = { + def apply_impl_msg_data(c: Context)(cond: c.Tree, message: c.Tree, data: c.Tree*)(sourceInfo: c.Tree, compileOptions: c.Tree): c.Tree = { import c.universe._ val p = c.enclosingPosition val condStr = s"${p.source.file.name}:${p.line} ${p.lineContent.trim}" val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("apply_impl_do")) - q"$apply_impl_do($cond, $condStr, _root_.scala.Some($message), ..$data)($sourceInfo)" + q"$apply_impl_do($cond, $condStr, _root_.scala.Some($message), ..$data)($sourceInfo, $compileOptions)" } - def apply_impl(c: Context)(cond: c.Tree)(sourceInfo: c.Tree): c.Tree = { + def apply_impl(c: Context)(cond: c.Tree)(sourceInfo: c.Tree, compileOptions: c.Tree): c.Tree = { import c.universe._ val p = c.enclosingPosition val condStr = s"${p.source.file.name}:${p.line} ${p.lineContent.trim}" val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("apply_impl_do")) - q"$apply_impl_do($cond, $condStr, _root_.scala.None)($sourceInfo)" + q"$apply_impl_do($cond, $condStr, _root_.scala.None)($sourceInfo, $compileOptions)" } - def apply_impl_do(cond: Bool, line: String, message: Option[String], data: Bits*)(implicit sourceInfo: SourceInfo) { + def apply_impl_do(cond: Bool, line: String, message: Option[String], data: Bits*)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions) { when (!(cond || Builder.forcedReset)) { val fmt = message match { case Some(str) => s"Assertion failed: $str\n at $line\n" @@ -76,14 +76,14 @@ 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 = { + def apply(code: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Unit = { when (!Builder.forcedReset) { pushCommand(Stop(sourceInfo, Node(Builder.forcedClock), code)) } } /** Terminate execution, indicating success. */ - def apply()(implicit sourceInfo: SourceInfo): Unit = { + def apply()(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Unit = { stop(0) } } |
