diff options
| author | Adam Izraelevitz | 2019-08-12 15:49:42 -0700 |
|---|---|---|
| committer | GitHub | 2019-08-12 15:49:42 -0700 |
| commit | fddb5943b1d36925a5435d327c3312572e98ca58 (patch) | |
| tree | b22e3a544dbb265dead955544c75bf7abddb7c69 /chiselFrontend/src/main/scala/chisel3/ModuleAspect.scala | |
| parent | 466ffbc9ca4fcca73d56f849df9e2753f68c53a8 (diff) | |
Aspect-Oriented Programming for Chisel (#1077)
Added Aspects to Chisel, enabling a mechanism for dependency injection to hardware modules.
Diffstat (limited to 'chiselFrontend/src/main/scala/chisel3/ModuleAspect.scala')
| -rw-r--r-- | chiselFrontend/src/main/scala/chisel3/ModuleAspect.scala | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/ModuleAspect.scala b/chiselFrontend/src/main/scala/chisel3/ModuleAspect.scala new file mode 100644 index 00000000..3edf0a22 --- /dev/null +++ b/chiselFrontend/src/main/scala/chisel3/ModuleAspect.scala @@ -0,0 +1,27 @@ +// See LICENSE for license details. + +package chisel3 + +import chisel3.internal.Builder +import chisel3.experimental.RawModule + +/** Used by Chisel Aspects to inject Chisel code into modules, after they have been elaborated. + * This is an internal API - don't use! + * + * It adds itself as an aspect to the module, which allows proper checking of connection and binding legality. + * + * @param module Module for which this object is an aspect of + * @param moduleCompileOptions + */ +abstract class ModuleAspect private[chisel3] (module: RawModule) + (implicit moduleCompileOptions: CompileOptions) extends RawModule { + + Builder.addAspect(module, this) + + override def circuitName: String = module.toTarget.circuit + + override def desiredName: String = module.name + + override val _namespace = module._namespace +} + |
