when

chisel3.when
object when

Attributes

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

Members list

Value members

Concrete methods

def apply(cond: => Bool)(block: => Any)(implicit sourceInfo: SourceInfo): WhenContext

Create a when condition block, where whether a block of logic is executed or not depends on the conditional.

Create a when condition block, where whether a block of logic is executed or not depends on the conditional.

Value parameters

block

logic that runs only if cond is true

cond

condition to execute upon

Attributes

Example
when ( myData === 3.U ) {
 // Some logic to run when myData equals 3.
} .elsewhen ( myData === 1.U ) {
 // Some logic to run when myData equals 1.
} .otherwise {
 // Some logic to run when myData is neither 3 nor 1.
}
Source
When.scala
def cond: Bool

Returns the current when condition

Returns the current when condition

This is the conjunction of conditions for all whens going up the call stack

when (a) {
 when (b) {
   when (c) {
   }.otherwise {
     when.cond // this is equal to: a && b && !c
   }
 }
}

Attributes

Source
When.scala