Package

tutorial

lesson2

Permalink

package lesson2

Visibility
  1. Public
  2. All

Type Members

  1. class AnalyzeCircuit extends Transform

    Permalink

    AnalyzeCircuit Transform

    AnalyzeCircuit Transform

    Walks firrtl.ir.Circuit, and records the number of muxes and instances it finds, per module.

    While the Firrtl parser emits a bare form of the IR (located in firrtl.ir._), it is often useful to have more information in these case classes. To do this, the Firrtl compiler has mirror "working" classes for the following IR nodes (which contain additional fields):

    • DefInstance -> WDefInstance
    • SubAccess -> WSubAccess
    • SubIndex -> WSubIndex
    • SubField -> WSubField
    • Reference -> WRef

    Take a look at ToWorkginIR in src/main/scala/firrtl/passes/Passes.scala to see how Firrtl IR nodes are replaced with working IR nodes.

    Future lessons will explain the WIR's additional fields. For now, it is enough to know that the transform firrtl.ResolveAndCheck populates these fields, and checks the legality of the circuit. If your transform is creating new WIR nodes, use the following "unknown" values in the WIR node, and then call firrtl.ResolveAndCheck at the end of your transform:

    • Kind -> ExpKind
    • Flow -> UnknownFlow
    • Type -> UnknownType

    The following firrtl.CircuitForms require WIR instead of IR nodes:

    • HighForm
    • MidForm
    • LowForm

    See the following links for more detailed explanations: IR vs Working IR

    • TODO(izraelevitz)
  2. class Ledger extends AnyRef

    Permalink

    Ledger tracks firrtl.ir.Circuit statistics

    Ledger tracks firrtl.ir.Circuit statistics

    In this lesson, we want to calculate the number of muxes, not just in a module, but also in any instances it has of other modules, etc.

    To do this, we need to update our Ledger class to keep track of this module instance information

    See lesson2.AnalyzeCircuit

Ungrouped