|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthades.simulator.SimObject
hades.models.pic.SmartPic16F84
A HADES simulation model for the Arizona Microchip PIC16x84 microcontroller. We use the hades.models.pic.PicExec with its helper classes for the processor core.
To reduce HADES event count for the PIC x4 input clock, this model uses an internally generated clock signal with regular wakeup events for the synchronisation with the simulation engine. As long as no external I/O activity occurs, this generates one HADES event per processor instruction cycle (which is much more efficient than using an external component like hades.models.io.ClockGen to feed the PIC clock input at 12 HADES events per processor instruction cycle).
However, note that the processor ignores its Clkin pin, and that internal processor cycles may desynchronize up to 1 clk-period with the rest of the external simulation. For example, sampling of the Port A/B inputs may occur 1/4 cycle too early, and also the timing of Port B interrupts detection differs a little from the real device. If exact timing is a requirement for your system, use the hades.models.Pic16C84 instead of the SmartPic16C84.
As performance experiments indicated, that up to 70% of total simulation time was spent in the HADES interfacing in older versions of the Pic processor model, the current version uses several data structures to reduce costly and time-consuming interaction with HADES. These consist of four variables that store the last input values to the processor core and the last values written to the port A/B output registers by the processor itself.
These arrays/values are initialized on object construction and again on each elaborate() call. During simulation, the portInputA/B variables are updated on each evaluate() call, and the portOutputA/B variables are updated once the processor writes to its PORTA/B registers or the corresponding TRISA/B registers.
Field Summary | |
(package private) static boolean[] |
_StdLogic1164ToBooleanTable
|
int[] |
currentPortInputsA
|
int[] |
currentPortInputsB
|
int[] |
currentPortOutputsA
|
int[] |
currentPortOutputsB
|
int |
lastClk
|
int |
lastOsc2
|
int[] |
lastPortInputsB
|
int |
lastT0cki
|
int |
n_cycles
|
int |
n_dirty_pa
|
int |
n_dirty_pb
|
int |
n_dirty_ta
|
int |
n_dirty_tb
|
int |
n_handledPortChanges
|
int |
n_inputPortChanges
|
PicExec |
pic
|
PortStdLogic1164[] |
portA
|
PortStdLogic1164[] |
portB
|
PortStdLogic1164 |
portClkin
|
PortStdLogic1164 |
portClkout
|
PortStdLogic1164 |
portMclr
|
PicPortReg |
regPortA
|
PicPortReg |
regPortB
|
PicWordReg |
regTrisA
|
PicWordReg |
regTrisB
|
boolean |
resetActive
|
StringDialog |
sd
|
ShowPic2 |
show
|
Signal[] |
signalA
|
Signal[] |
signalB
|
Signal |
signalClkin
|
Signal |
signalClkout
|
Signal |
signalMclr
|
double |
t_delay
|
(package private) double |
t_now
|
StdLogic1164 |
value_0
|
StdLogic1164 |
value_1
|
StdLogic1164 |
value_Z
|
Fields inherited from class hades.simulator.SimObject |
classloader, console, debug, editor, name, parent, ports, propertySheet, simulator, symbol, versionId, visible |
Constructor Summary | |
SmartPic16F84()
|
Method Summary | |
void |
configure()
create and display a 'ConfigDialog' to set the parameters for a SimObject. |
boolean |
convertToBoolean(int value)
|
boolean |
convertToBoolean(StdLogic1164 value)
|
void |
createClockPeriodGUI()
|
void |
createPicExec()
|
void |
createPorts()
|
void |
doCheckBreakpoint()
|
void |
doCheckIncrementTMR0()
|
void |
doCheckPortsForInterrupt()
|
void |
doPrintPortRegDirtyStatistics()
|
void |
doReadPortsRaw()
|
void |
doReset()
|
void |
doSamplePorts()
|
void |
doSetClkout(StdLogic1164 value,
double t)
|
void |
doSetPorts()
|
void |
doUpdateShowPic()
|
void |
elaborate(java.lang.Object arg)
elaborate: initialize the SmartPic16C84 model. |
void |
evaluate(java.lang.Object arg)
evaluate(): called by the simulation engine on all events that concern this object. |
void |
finalize()
|
java.lang.String[] |
getExternalResources()
return a String[] array of length 1 with the program ROM init file. |
java.awt.Component |
getPropertySheet()
return a reference to the 'property sheet' or configuration window for this SimObject. |
java.lang.String |
getToolTip(java.awt.Point position,
long millis)
construct a tool tip message (with the timing parameters) |
boolean |
initialize(java.lang.String s)
initialize PicEprom from a String. |
void |
instructionCycle()
|
boolean |
needsExternalResources()
we use one external resource: the program ROM initialization file. |
boolean |
nextExternalEventIsLate()
|
boolean |
nextExternalEventIsLateOLD()
|
void |
printPortBackupArrays()
|
void |
readInputPorts()
read the values of all StdLogic1164 signals connected to ports A/B and initialize the currentPortInputsA/B arrays. |
java.lang.String |
toString()
toString: generate a text description for this SimObject. |
void |
wakeup(java.lang.Object event)
wakeup: either the main clock-period or the watchdog-timer period has elapsed. |
void |
write(java.io.PrintWriter ps)
write FastPIC configuration data to a HADES design file: versionID, clk4Period (instruction cycle time), program EPROM resource name |
Methods inherited from class hades.simulator.SimObject |
constructDynamicSymbol, copy, getBindkey, getClassLoader, getDebug, getEditor, getFullName, getName, getParent, getPort, getPorts, getResourceAsStream, getSimulator, getSymbol, getSymbolResourceName, getVersionId, isVisible, keyPressed, message, mousePressed, needsDynamicSymbol, setClassLoader, setConsole, setDebug, setEditor, setName, setParent, setPorts, setSimulator, setSymbol, setVersionId, setVisible, tearDown |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface hades.simulator.Simulatable |
message |
Field Detail |
public ShowPic2 show
public StringDialog sd
public PicExec pic
public PicPortReg regPortA
public PicPortReg regPortB
public PicWordReg regTrisA
public PicWordReg regTrisB
public PortStdLogic1164 portClkin
public PortStdLogic1164 portClkout
public PortStdLogic1164 portMclr
public PortStdLogic1164[] portA
public PortStdLogic1164[] portB
public StdLogic1164 value_Z
public StdLogic1164 value_0
public StdLogic1164 value_1
public Signal signalClkin
public Signal signalClkout
public Signal signalMclr
public Signal[] signalA
public Signal[] signalB
public int[] currentPortInputsA
public int[] currentPortInputsB
public int[] lastPortInputsB
public int[] currentPortOutputsA
public int[] currentPortOutputsB
public int n_inputPortChanges
public int n_handledPortChanges
double t_now
public int n_cycles
public int n_dirty_pa
public int n_dirty_ta
public int n_dirty_pb
public int n_dirty_tb
public int lastClk
public int lastOsc2
public int lastT0cki
public boolean resetActive
public double t_delay
static boolean[] _StdLogic1164ToBooleanTable
Constructor Detail |
public SmartPic16F84()
Method Detail |
public void createPicExec()
public boolean needsExternalResources()
needsExternalResources
in class SimObject
public java.lang.String[] getExternalResources()
getExternalResources
in class SimObject
public java.lang.String toString()
SimObject
toString
in class SimObject
public java.lang.String getToolTip(java.awt.Point position, long millis)
getToolTip
in interface ContextToolTip
getToolTip
in class SimObject
public void createPorts()
public boolean initialize(java.lang.String s)
1001 /home/rink/hades/models/pic/echo232.rom
initialize
in class SimObject
public void write(java.io.PrintWriter ps)
write
in class SimObject
public void elaborate(java.lang.Object arg)
elaborate
in interface Simulatable
elaborate
in class SimObject
public void wakeup(java.lang.Object event)
wakeup
in interface Wakeable
public boolean nextExternalEventIsLate()
public boolean nextExternalEventIsLateOLD()
public void printPortBackupArrays()
public void evaluate(java.lang.Object arg)
Simulatable
evaluate
in interface Simulatable
evaluate
in class SimObject
arg
- an arbitrary object argumentpublic void doReset()
public void readInputPorts()
public void doCheckPortsForInterrupt()
public void doCheckIncrementTMR0()
public void doReadPortsRaw()
public void doSamplePorts()
public void doSetPorts()
public void doPrintPortRegDirtyStatistics()
public void finalize() throws java.lang.Throwable
java.lang.Throwable
public void doCheckBreakpoint()
public void doUpdateShowPic()
public void doSetClkout(StdLogic1164 value, double t)
public void instructionCycle()
public java.awt.Component getPropertySheet()
SimObject
getPropertySheet
in class SimObject
public void configure()
SimObject
configure
in class SimObject
public final boolean convertToBoolean(int value)
public boolean convertToBoolean(StdLogic1164 value)
public void createClockPeriodGUI()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |