Next: Preliminary Experimental Results
Up: A General Method for
Previous: Code Generation
While the algorithm presented in the previous section generates
working code, we have found a number of optimizations that are useful
to produce a more efficient simulation.
- Continuous assignment optimizations - Continuous
assignments represent assignments to wires where the left hand side
continuously reflects the current state of the variables on the right
hand side. Rather than treating them as separate events we can inline
them directly into the code, thus drastically reducing the number of
events we need to schedule. Such inlining must be done in moderation,
however, to limit the increase in code size. This optimization is
performed on the event graph before scheduling takes place.
- Sensitization optimization - If an event immediately
sensitizes itself after execution, and is sensitive at the beginning
of simulation, it will always be sensitive. Thus it is not necessary
to test for sensitivity in the generated code. In many models, this
is the case for the majority of events.
- Levelization - During the course of event-driven
simulation, it is possible to execute events multiple times as values
propagate through the model. These multiple executions are not
required for the correct answer and adversely impact simulation
performance. Through proper ordering of event execution unnecessary
events can be eliminated. This process is generally called levelization and is used in levelized compiled code simulators
[2][1].
One can add a form of levelization to an event-driven simulator by
being intelligent about which events are retrieved from the event
queue. We implement this in our compiler by assigning a level
to each event in the graph based on its maximum length path from the
start event. Then, when the
function chooses events
from
, it chooses the event with the lowest level number.
Next: Preliminary Experimental Results
Up: A General Method for
Previous: Code Generation