ModuleChoice

chisel3.choice.ModuleChoice
object ModuleChoice

Attributes

Source
ModuleChoice.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Inherited methods

def apply[T <: Data](default: => FixedIOBaseModule[T], choices: Seq[(Case, () => FixedIOBaseModule[T])])(using SourceInfo): T

A wrapper method for Module instantiation based on option choices. (necessary to help Chisel track internal state).

A wrapper method for Module instantiation based on option choices. (necessary to help Chisel track internal state).

Value parameters

choices

the mapping from cases to module generators

default

the Module to instantiate if no module is specified

Attributes

Returns

the input module m with Chisel metadata properly set

Throws
java.lang.IllegalArgumentException

if the cases do not belong to the same option.

See also

chisel3.choice.Group on how to declare the options for the alternatives. Example:

val module = ModuleChoice(new DefaultModule)(Seq(
 Platform.FPGA -> new FPGATarget,
 Platform.ASIC -> new ASICTarget
))
Inherited from:
ModuleChoice$Intf (hidden)
Source
ModuleChoiceIntf.scala