0

I would like to find out how it is possible to initialize a Module, depending on a value. So I have a config.extend value which will decide if the core will instantiate of the Core or ExtendedCore module.

However I am getting the error "value := is not a member of Sodor.core".

val extend = 1

val core = Module(new Core(data_address))

if(extend==1){
   core := Module(new ExtendedCore(data_address))
}

What is the proper way to intialize a Module depending on the statement, like in this case? Thanks.

Mrchacha
  • 197
  • 1
  • 17

1 Answers1

2

:= is the connection operator in Chisel. It is used for connecting Wires and Registers. What you really want to do is conditionally instantiate different Modules at elaboration time (ie. with Scala constructs not Chisel constructs).

Try the following:

val extend = 1

val core = if (extend == 1) Module(new ExtendedCore(data_address))
           else Module(new Core(data_address))
Jack Koenig
  • 5,840
  • 15
  • 21