- A Logic Circuit Simulation Library in C++ |
The simulation results from a libLCS simulation can be exported into a VCD file. This VCD file can then be loaded into a VCD viewer to check the simulation results. Currently, libLCS supports dumping of bus line states into a VCD file. Dumping state changes into a VCD file is done using the lcs::ChangeMonitor
class. For example, if you are using a bus with name b
in your simulation and would like to dump its values into the VCD file of the simulation, then initialise a lcs::ChangeMonitor
object as follows.
lcs::ChangeMonitor<w> busMonitor(b, "bus", lcs::DUMP_ON); // w is the width of the bus b
The first argument to the lcs::ChangeMonitor
constructor is the bus object whose line states you want to dump. The second argument to the constructor is a unique name for the bus object. This name should be a string of ASCII characters without spaces. The third argument to the constructor indicates that the line states of the bus b
should be dumped into a VCD file. If this argument is ommitted, then the bus lines states will not dumped. Dumping can also be explicitly omitted by passing lcs::DUMP_OFF
as the third argument to the lcs::ChangeMonitor
constructor.
By default, the VCD file for the simulation has the name "dump.vcd". One can set a different name using the function lcs::Simulation::setDumpFileName
. One can also set a unit for the system time. By default, micro-second is set as the unit for the system time. This unit can be changed using the function lcs::Simulation::setTimeUnit
.
NOTE: See the Getting Started section for more information on the lcs::ChangeMonitor
class.