public abstract class SimulationModel extends java.lang.Object implements ChipModel
For the most part, this allows you to create devices that replace the measurement devices that would normally probe a Device Under Test. Instead these devices will now probe the software model.
Most of the process control code has been moved into this Class, because it is fairly similar between the various simulators.
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
errorFlag
The simulator's error string on the interactive prompt when an error occurs
|
protected java.lang.String |
quitCommand
The simulator's interactive quit command (used when processing output)
|
protected java.lang.String |
simulatorName
The simulator name
|
Constructor and Description |
---|
SimulationModel(java.lang.String simulatorName,
java.lang.String quitCommand,
java.lang.String errorFlag,
java.lang.String outputPrompt)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
assertNodeState(java.lang.String node,
int expectedState)
Assert that a node is at a given state.
|
void |
assertNodeState(java.lang.String node,
int expectedState,
java.lang.String errMsg)
Assert that a node is at a given state.
|
abstract JtagTester |
createJtagSubchainTester(java.lang.String jtagInBus,
java.lang.String jtagOutBus)
Create a subchain tester based on the 8- or 9-wire jtag interface.
|
abstract JtagTester |
createJtagSubchainTester(java.lang.String phi2,
java.lang.String phi1,
java.lang.String write,
java.lang.String read,
java.lang.String sin,
java.lang.String sout)
Create a subchain tester based on the 5-wire jtag interface.
|
JtagTester |
createJtagTester()
Create a
JtagTester that can be used to drive the JtagController on the
Software model of the chip. |
abstract JtagTester |
createJtagTester(java.lang.String tckName,
java.lang.String tmsName,
java.lang.String trstbName,
java.lang.String tdiName,
java.lang.String tdobName)
Create a
JtagTester that can be used to drive the JtagController on the
Software model of the chip. |
abstract LogicSettable |
createLogicSettable(java.util.List portNames)
Create a
LogicSettable that can be used to control a set of ports on
the Software model of the chip. |
abstract LogicSettable |
createLogicSettable(java.lang.String portName)
Create a
LogicSettable that can be used to control a port on
the Software model of the chip. |
abstract void |
disableNode(java.lang.String node)
If supported, disable a node (forces it to 0)
|
abstract void |
enableNode(java.lang.String node)
If supported, enable a node (allows it to be driven)
|
void |
finish()
Tell the Chip Model simulation to end, and stop accepting
input from the test software.
|
static void |
finishAll()
Terminate all models.
|
static java.lang.String |
getElapsedTime(long milliseconds)
Method to describe a time value as a String.
|
BitVector |
getNodeState(BussedIO bus)
Get the state of a bus.
|
abstract int |
getNodeState(java.lang.String node)
Get the state of a node.
|
boolean |
getOptimizedDirectReadsWrites()
|
protected abstract double |
getSimulationTime()
Get the current simulation time, used for error reporting
|
abstract double |
getTimeNS()
Return the current simulation time in nanoseconds
|
protected abstract double |
getVdd()
Get the voltage value for vdd
|
boolean |
isBypassScanning()
Check the state of bypass scanning.
|
protected boolean |
isProcessRunning()
For children of this class to see if the process is currently running
|
protected void |
issueCommand(java.lang.String command)
Issues a command to the process.
|
protected void |
issueCommand(java.lang.String command,
boolean incrPrompt)
Issues a command to the process.
|
abstract void |
releaseNodes(java.util.List nodes)
Release any nodes being forced to a value using set node state
|
void |
setAdditionalCommandLineArgs(java.lang.String args)
Set any additional command line arguments that will be appended
to the simulation command when run
|
void |
setBypassScanning(boolean enabled) |
void |
setNodeState(BussedIO bus,
BitVector state)
Set a bus of nodes to a state.
|
abstract void |
setNodeState(java.lang.String node,
int state)
Force node to a state.
|
void |
setOptimizedDirectReadsWrites(boolean enabled)
Enable optimized direct reads and writes.
|
protected void |
setPrompt(java.lang.String prompt)
Sets the simulator's interactive prompt.
|
void |
start(java.lang.String command,
java.lang.String simFile,
int recordSim)
Start the Chip Model simulation, and have it ready to accept
commands from the test software.
|
void |
start(java.lang.String command,
java.lang.String simFile,
int recordSim,
boolean bypassScanning)
Start the Chip Model simulation, and have it ready to accept
commands from the test software.
|
protected boolean |
startProcess(java.lang.String command,
java.lang.String[] envVars,
java.io.File dir,
java.lang.String logfileName)
Start a simulator's process.
|
abstract void |
wait(float seconds)
Tell the Chip Model simulation to continue simulating for the
time specified
|
abstract void |
waitNS(double nanoseconds)
Wait for the specified number of nanoseconds.
|
abstract void |
waitPS(double picoseconds)
Wait for the specified number of picoseconds.
|
static boolean |
waitSeconds(float seconds)
Tell any Chip Model simulators currently running to wait
for the specified time.
|
protected final java.lang.String simulatorName
protected final java.lang.String quitCommand
protected final java.lang.String errorFlag
public SimulationModel(java.lang.String simulatorName, java.lang.String quitCommand, java.lang.String errorFlag, java.lang.String outputPrompt)
simulatorName
- the name of this simulator (Verilog, Nanosim, etc)quitCommand
- the command used to quit the simulator ($finish;, quit, etc)errorFlag
- the error String found in the simulator's output on erroroutputPrompt
- the prompt from the interactive process. If this contains %%,
then %% will be replaced with the current command count. This can also be set
later with setPrompt()public abstract JtagTester createJtagTester(java.lang.String tckName, java.lang.String tmsName, java.lang.String trstbName, java.lang.String tdiName, java.lang.String tdobName)
JtagTester
that can be used to drive the JtagController on the
Software model of the chip. The arguments specify the port names specific
to the software model that correspond to the Jtag Controller ports.tckName
- name of the input port for TCKtmsName
- name of the input port for TMStrstbName
- name of the input port for TRSTbtdiName
- name of the input port for TDItdobName
- name of the input port for TDObpublic JtagTester createJtagTester()
JtagTester
that can be used to drive the JtagController on the
Software model of the chip. This uses the default port names of
TCK, TMS, TRSTb, TDI, and TDOb.public abstract JtagTester createJtagSubchainTester(java.lang.String jtagInBus, java.lang.String jtagOutBus)
jtagInBus
- the name of the 9-bit wide input bus, i.e. "jtagIn" or "jtagIn[8:0]"jtagOutBus
- the name of the 9-bit wide output bus, i.e. "jtagOut" or "jtagOut[8:0]"public abstract JtagTester createJtagSubchainTester(java.lang.String phi2, java.lang.String phi1, java.lang.String write, java.lang.String read, java.lang.String sin, java.lang.String sout)
phi2
- name of the phi2 signalphi1
- name of the phi1 signalwrite
- name of the write signalread
- name of the read signalsin
- name of the scan data in signalsout
- name of the scan data out signalpublic abstract LogicSettable createLogicSettable(java.lang.String portName)
LogicSettable
that can be used to control a port on
the Software model of the chip.portName
- the name of the port to control.public abstract LogicSettable createLogicSettable(java.util.List portNames)
LogicSettable
that can be used to control a set of ports on
the Software model of the chip. The ports then act as if they have
been tied together.portNames
- a list of Strings of port names to be controlled.public abstract void setNodeState(java.lang.String node, int state)
node
- the hierarchical spice node namestate
- the state to set to, must be 1 or 0.public abstract int getNodeState(java.lang.String node)
node
- the hierarchical spice node namepublic abstract void releaseNodes(java.util.List nodes)
nodes
- a list of node names (strings)protected abstract double getVdd()
protected abstract double getSimulationTime()
public void setNodeState(BussedIO bus, BitVector state)
bus
- the busstate
- the state to set the bus topublic BitVector getNodeState(BussedIO bus)
bus
- the buspublic void assertNodeState(java.lang.String node, int expectedState)
node
- the hierarchical node nameexpectedState
- the expected state, 1 is high and 0 is low.public void assertNodeState(java.lang.String node, int expectedState, java.lang.String errMsg)
node
- the hierarchical node nameexpectedState
- the expected state, 1 is high and 0 is low.errMsg
- additional error messagepublic void setAdditionalCommandLineArgs(java.lang.String args)
args
- the args to appendpublic void start(java.lang.String command, java.lang.String simFile, int recordSim)
command
- the command to start the simulation.simFile
- the file to simulate.recordSim
- the level of simulation recording used.public void start(java.lang.String command, java.lang.String simFile, int recordSim, boolean bypassScanning)
command
- the command to start the simulation.simFile
- the file to simulate.recordSim
- the level of simulation recording used.bypassScanning
- true to bypass scanning in of data. See bypassScanning
.public abstract void wait(float seconds)
public abstract void waitNS(double nanoseconds)
ChipModel
public abstract void waitPS(double picoseconds)
ChipModel
public abstract double getTimeNS()
public abstract void disableNode(java.lang.String node)
node
- the name of the nodepublic abstract void enableNode(java.lang.String node)
node
- the name of the nodepublic void setBypassScanning(boolean enabled)
public void setOptimizedDirectReadsWrites(boolean enabled)
enabled
- true to enable optimized direct reads and writespublic boolean getOptimizedDirectReadsWrites()
public boolean isBypassScanning()
bypassScanning
.public static boolean waitSeconds(float seconds)
seconds
- the time to wait.public void finish()
public static void finishAll()
public static java.lang.String getElapsedTime(long milliseconds)
milliseconds
- the time span in milli-seconds.protected boolean startProcess(java.lang.String command, java.lang.String[] envVars, java.io.File dir, java.lang.String logfileName)
command
- the command to start the processenvVars
- environment variables, or null if nonedir
- working dir, null for currentlogfileName
- name of log file of interaction with processprotected boolean isProcessRunning()
protected void setPrompt(java.lang.String prompt)
prompt
- the promptprotected void issueCommand(java.lang.String command)
command
- the command to send to the process.protected void issueCommand(java.lang.String command, boolean incrPrompt)
command
- the command to send to the process.incrPrompt
- true if this command will increment the interactive prompt