|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthades.simulator.SimKernel
hades.simulator.VhdlSimKernel
A simulation engine with VHDL-like semantics. VhdlSimKernel implements a discrete-event 2-list delta-delay simulation engine that supports VHDL-like semantics: during simulation, the simulator collects all events scheduled at the same simulation time, then executes all pending signal assignments, before continuing with the next simulation cycle.
Similar to RealTimeSimKernel, the simulation will not run faster than (approximately) real time, to allow for visualization and animation.
Nested Class Summary | |
(package private) class |
VhdlSimKernel.DeleteAllEventsFromSourceCommand
internal class to actually delete all events from the specified SimObject 'source' in a thread-safe manner (because executed from the simulation Thread itself). |
(package private) class |
VhdlSimKernel.NOP
adapter class to provide a "no operation" Simulatable suitable to put as a replacement into our pending event arrays |
Field Summary | |
static int |
COLLECT_CYCLE
|
(package private) int |
delta_resync_iterations
|
(package private) double |
eventTime
|
static int |
EXECUTE_CYCLE
|
(package private) int |
global_errors
|
static int |
IDLE_CYCLE
|
(package private) double |
lastSyncTime
|
protected int |
macroState
|
protected int |
microState
|
protected int |
n_max_pending
|
(package private) int |
n_resync_iterations
|
protected int |
PENDING_ARRAY_SIZE
|
protected int |
pendingArrayIndex
|
protected SimEvent[] |
pendingEventArray
|
protected Port[] |
pendingEventTargetArray
|
(package private) double |
realTime
|
protected int |
RECYCLE_ARRAY_SIZE
|
protected SimEvent[] |
recycleEventArray
|
protected int |
recycleIndex
|
static int |
t_sleep
|
(package private) long |
t0
|
(package private) long |
t1
|
(package private) java.lang.String |
versionString
|
Fields inherited from class hades.simulator.SimKernel |
commandQueue, console, controlPanel, debug, design, ELABORATE, endTime, eventList, n_interactive, n_interactive_transferred, n_iterations, n_processed, n_scheduled, n_simulators, name, painter, PAUSED, RESET, runner, RUNNING, shouldStop, simTime, simulatorID, SINGLESTEP, state, STOPPED |
Constructor Summary | |
VhdlSimKernel()
constructor for an so far idle simulation engine |
Method Summary | |
void |
addPendingEvent(SimEvent event,
Port target)
add SimEvents for later execution. |
void |
addRecycleableEvent(SimEvent event)
add a SimEvent to the collection of recycle-able SimEvents. |
(package private) void |
checkInteractiveEvents()
|
(package private) void |
checkResync()
check whether we need to re-synchronize simulation time and real time. |
(package private) void |
collectEvents()
|
void |
deleteAllEventsFromSource(SimObject source)
try to delete all events that originated from SimObject 'source'. |
(package private) void |
executeAllPendingEvents()
|
(package private) void |
executePendingEvent()
execute one pending event (the last one). |
void |
initializeSimulator()
initialize the simulator: stop any running simulation, then create a new eventlist, initialize start and end times, ... |
void |
printStatus()
printStatus(): print a short message about current simulation and real times, as well as the number of scheduled and processed events. |
(package private) void |
reallocatePendingEventArrays()
|
(package private) void |
reallocateRecycleEventArrays()
|
(package private) void |
recycleEvents()
|
void |
resync()
resync: update our 'realTime' variable from the JVM system clock. |
void |
run()
run the simulation until ready or interrupted. |
void |
runForever()
set the simulation end time to Double.MAX_VALUE, then start/continue the simulation from the current time. |
void |
scheduleInteractiveEvent(SimEvent se)
schedule an interactive (=asynchronous) simulation event |
(package private) void |
simulation()
simulation: for each iteration, we first check and handle interactive events. |
void |
sleep()
sleep for t_sleep milliseconds. |
java.lang.String |
toString()
standard identification method |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
java.lang.String versionString
public static final int IDLE_CYCLE
public static final int COLLECT_CYCLE
public static final int EXECUTE_CYCLE
protected int macroState
protected int microState
double realTime
double lastSyncTime
double eventTime
long t0
long t1
int n_resync_iterations
int delta_resync_iterations
int global_errors
protected int PENDING_ARRAY_SIZE
protected int pendingArrayIndex
protected int n_max_pending
protected SimEvent[] pendingEventArray
protected Port[] pendingEventTargetArray
protected int RECYCLE_ARRAY_SIZE
protected int recycleIndex
protected SimEvent[] recycleEventArray
public static int t_sleep
Constructor Detail |
public VhdlSimKernel()
Method Detail |
public void addPendingEvent(SimEvent event, Port target)
addPendingEvent
in class SimKernel
void reallocatePendingEventArrays()
void executePendingEvent()
void executeAllPendingEvents()
public void addRecycleableEvent(SimEvent event)
void reallocateRecycleEventArrays()
void recycleEvents()
public void runForever()
runForever
in class SimKernel
public void initializeSimulator()
SimKernel
initializeSimulator
in class SimKernel
public void run()
Variable 't0' holds the JVM clock at start of the simulation, 't1' is used for the curent JVM clock value.
run
in interface java.lang.Runnable
run
in class SimKernel
void simulation()
Finally, we collect and execute the events.
void checkInteractiveEvents()
public void scheduleInteractiveEvent(SimEvent se)
SimKernel
scheduleInteractiveEvent
in class SimKernel
public void deleteAllEventsFromSource(SimObject source)
Note that the VhdlSimkernel needs to delete events from both the eventlist and its pendingEvent data structures. In order to avoid threading issues, this method schedules a special simulator command that executes from the simulator thread.
deleteAllEventsFromSource
in class SimKernel
void checkResync()
void collectEvents()
public void resync()
public void printStatus()
printStatus
in class SimKernel
public void sleep()
public java.lang.String toString()
toString
in class SimKernel
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |