-
Notifications
You must be signed in to change notification settings - Fork 589
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Scala 2 veneer for Module.scala
- Loading branch information
1 parent
b4b0cc1
commit 67196d8
Showing
2 changed files
with
35 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package chisel3 | ||
|
||
import scala.language.experimental.macros | ||
|
||
import chisel3.experimental.{BaseModule, SourceInfo} | ||
import chisel3.internal.sourceinfo.InstTransform | ||
|
||
object Module extends ObjectModuleImpl with SourceInfoDoc { | ||
|
||
/** A wrapper method that all Module instantiations must be wrapped in | ||
* (necessary to help Chisel track internal state). | ||
* | ||
* @param bc the Module being created | ||
* | ||
* @return the input module `m` with Chisel metadata properly set | ||
*/ | ||
def apply[T <: BaseModule](bc: => T): T = macro InstTransform.apply[T] | ||
|
||
/** @group SourceInfoTransformMacro */ | ||
def do_apply[T <: BaseModule](bc: => T)(implicit sourceInfo: SourceInfo): T = _applyImpl(bc) | ||
} | ||
|
||
/** Abstract base class for Modules, which behave much like Verilog modules. | ||
* These may contain both logic and state which are written in the Module | ||
* body (constructor). | ||
* This abstract base class includes an implicit clock and reset. | ||
* | ||
* @note Module instantiations must be wrapped in a Module() call. | ||
*/ | ||
abstract class Module extends ModuleImpl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters