For each instantiation of an ExtModule the interpreter needs a separate instance of a BlackBoxImplementation.
For each instantiation of an ExtModule the interpreter needs a separate instance of a BlackBoxImplementation. This factory provides it.
class ExampleBBFactory extends BlackBoxFactory { override def createInstatnce(instanceName: String, blackBoxName: String): Option[BlackBoxImplementation] = { instanceName match { case "bb1" => Some(add(new BB1Impl)) case "bb2" => Some(add(new BB2Impl)) case "bb3" => Some(add(new BB3Impl)) case _ => throw Exeception(s"ExampleBBBFactory does not know how to create $instanceName}") } } }
This is the template for writing scala functions that implement the behaviour of a black box i.e.
This is the template for writing scala functions that implement the behaviour of a black box i.e. firrtl.ir.ExtModule. Implementing classes should add internal variables to hold any state information.
During dependency graph processing one of these will be created for each output of each instantiated black box in the circuit
During dependency graph processing one of these will be created for each output of each instantiated black box in the circuit
The name of the output without module name prefix
The implementation instance of the parent black box
The names of the inputs that this output depends on
the concrete return type of this output
Holds the state of the circuit at a particular time State is kept for input, output and registers
Holds the state of the circuit at a particular time State is kept for input, output and registers
a map to current concrete value
a map to current concrete value
a map to current concrete value
A runtime instance of a SInt
A runtime instance of a SInt
the BigInt value of this UInt,
the number of bits in this value, must be big enough to contain value plus 1 for sign bit
A runtime instance of a UInt
A runtime instance of a UInt
the BigInt value of this UInt, must be non-negative
the number of bits in this value, must be big enough to contain value
A (probably overly complex) map of the names to expressions that occur in @circuit This is used by the expression evaluator to follow dependencies It also maintains lists or sets of ports, registers, memories, stop and printf statements.
A (probably overly complex) map of the names to expressions that occur in @circuit This is used by the expression evaluator to follow dependencies It also maintains lists or sets of ports, registers, memories, stop and printf statements. The above information is created by the companion object which does the actual work of traversing the circuit and discovering the various components and expressions
This is the Firrtl interpreter.
This is the Firrtl interpreter. It is the top level control engine that controls the simulation of a circuit running.
It coordinates updating of the circuit's inputs (other elements, nodes, registers, etc can be forced to values) and querying the circuits outputs (or optionally other circuit components)
This mainly involves updating of a circuit state instance by using a expression evaluator on a dependency graph.
Created by chick on 4/21/16.
Works a lot like the chisel classic tester compiles a firrtl input string and allows poke, peek, expect and step
Works a lot like the chisel classic tester compiles a firrtl input string and allows poke, peek, expect and step
pokes invalidate the underlying circuit peek, expect and step, recompute (re-validate) the circuit before executing
Important note: port names in LoFirrtl have replaced dot notation with underscore notation so that io.a.b must be referenced as io_a_b
This is the evaluation engine for the FirrtlTerp it requires the previousState of the system
provides a black box implementation of a circuit memory presenting read, write and read/write interfaces
provides a black box implementation of a circuit memory presenting read, write and read/write interfaces
Assumptions: Zero read_latency latches data straight to memory(address): IGNORES enable
This tracks the running average, variance min, max, and a histogram of series of values
This tester runs a VCD file against a circuit expressed in a firrtl file.
This tester runs a VCD file against a circuit expressed in a firrtl file. The VCD file should have been produced by running a test harness against the circuit. This test can be used to generate circuit behavior while running symbolic or concolic testing. It can also be used to determine if later changes to a circuit have changed since some original correct **golden** run of the circuit For example use the main below to run the VcdAdder files contained in the src/test/resources directory
sbt 'run-main firrtl_interpreter.VcdReplayTester -fs src/test/resources/VcdAdder.fir \
-vcd src/test/resources/VcdAdder.vcd'
contains the constructor for a dependency graph.
contains the constructor for a dependency graph. The code for traversing a circuit and discovering the components and the expressions lives here
Created by chick on 4/21/16.
Utility function that computes bits required for a number
Utility function that computes bits required for a number
number of interest
computes the smallest and largest values that will fit in an SInt
computes the smallest and largest values that will fit in an SInt
width of SInt
tuple(minVale, maxValue)
computes the smallest and largest values that will fit in a UInt
computes the smallest and largest values that will fit in a UInt
width of SInt
tuple(minVale, maxValue)
return the smallest number of bits required to hold the given number in an SInt Note: positive numbers will get one minimum width one higher than would be required for a UInt
return the smallest number of bits required to hold the given number in an SInt Note: positive numbers will get one minimum width one higher than would be required for a UInt
number to find width for
minimum required bits for an SInt
return the smallest number of bits required to hold the given number in an UInt Note: positive numbers will get one minimum width one higher than would be required for a UInt
return the smallest number of bits required to hold the given number in an UInt Note: positive numbers will get one minimum width one higher than would be required for a UInt
number to find width for
minimum required bits for an SInt