|
jmce - 1_02 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface CPU
This interface rappresent one CPU.
Field Summary | |
---|---|
static int |
BIG_ENDIAN
Big endian cpu - higghest byte first |
static java.lang.String |
IO_MEMORY
Name used for i/o memory |
static int |
LITTLE_ENDIAN
Little endian cpu - lowest byte first |
static java.lang.String |
MAIN_MEMORY
Name used for main memory |
Method Summary | |
---|---|
void |
abort(java.lang.String s)
Abort the cpu execution. |
void |
addCycleListener(CycleListener l)
Register listener so that it will receive cycle event. |
Decoder |
addDecoder(Decoder d)
Add a new decoder. |
void |
addExceptionListener(ExceptionListener l)
Add a new listener called when one new exception is detected |
BreakPoint |
addExecBreakPoint(int m,
int a)
Add a new exec break point. |
void |
addInterrupt(Interrupt isr)
Add a new interrupt to this CPU |
void |
addIOReadListener(int a,
MemoryReadListener l)
Add a MemoryReadListener to the I/O memory. |
void |
addIOReadListener(MemoryReadListener l)
Add a global MemoryReadListener to the I/O memory, |
void |
addIOWriteListener(int a,
MemoryWriteListener l)
Add a Memory write listener to the I/O memory. |
void |
addIOWriteListener(MemoryWriteListener l)
Add a global MemoryWriteListener to the I/O memory, |
void |
addMemoryWriteListener(MemoryWriteListener l)
Add a memory write listener to the system memory. |
BreakPoint |
addReadBreakPoint(int m,
int a)
Add a new read break point. |
Register |
addRegister(Register r)
Add a Register |
void |
addResetListener(ResetListener l)
Add a new reset listener. |
void |
addTimerCycle(Timer t)
Add a new timer as clock the machine cycle. |
void |
addTimerMs(Timer t)
Add a new timer as clock sec/1000 but using the machine cycle. |
void |
addTraceListener(TraceListener t)
Add a new trace listener. |
BreakPoint |
addWriteBreakPoint(int m,
int a)
Add a new write break point. |
java.lang.String |
decodeAt(int pc)
Decode the istruction at the specified address. |
void |
dumpStatistics(java.lang.String filename)
Create a file with the cpu usage statistics |
int |
fetch(int pc)
Fecth a byte from the memory for exec istructions. |
int |
fireISR(Interrupt isr)
Fire a new ISR |
int |
fireNMI(Interrupt i)
Fire a new non maskerable interrupt. |
BreakPoint |
getBreakPointAt(int i)
Return the specified break point. |
int |
getBreakPointCount()
Return the number of installed break point. |
int |
getByte(int a)
Return a byte of memory from the main memory. |
long |
getClock()
Return che CPU clock in Hz. |
int |
getClockPerCycle()
Get the number of clock used for cycle |
long |
getCycle()
Return the current clock cycle of the CPU. |
long |
getCycleMillis()
Return the number of cycle per ms. |
Decoder |
getDecoderAt(int i)
Get a decoder. |
int |
getDecoderCount()
Get the number of installed decoder |
int |
getEndian()
Get the cpu 'endianess' |
ExceptionListener |
getExceptionListenerAt(int i)
Return the specified exception listener. |
int |
getExceptionListenerCount()
Return the number of exception listener installed. |
int |
getIOByte(int a)
Get a byte from the I/O memory. |
int |
getLenghtAt(int pc)
Return the lenght in byte of the istruction at the specified address. |
Memory |
getMemory()
Return the main memory |
Memory |
getMemoryAt(int i)
Return the memory at the specified position |
int |
getMemoryCount()
Return the number of memory installed in the cpu |
Memory |
getMemoryForName(java.lang.String name)
Return the memory for name. |
boolean |
getRealTime()
Return the real time emulation mode. |
Register |
getRegisterAt(int i)
Return the specified Register |
int |
getRegisterCount()
Get the number of register present in the CPU |
Register |
getRegisterForName(java.lang.String name)
Search one register for name |
int |
getResetAddress()
Return the value of PC at reset. |
double |
getUsage()
Get CPU usage return the CPU usage of the simulator thread, high value (more than 90.00) means the current java machine is too slow to execute the simulator. |
java.lang.String |
getUsageDesc()
Get CPU usage in string format. |
int |
getWord(int a)
Read one word (16 bit) from the main memory. |
int |
idle()
Release the cpu for few ms. |
boolean |
isBigEndian()
Return true if the byte order of the cpu is Big Endian |
boolean |
isInterruptEnabled()
Return the status of the interrupt enable |
boolean |
isLittleEndian()
Return true if the byte order of the cpu is Little Endian |
boolean |
isRunning()
Return true is the CPU is running. |
void |
load(Memory m,
java.lang.String name,
int base,
LoadInfo info)
Load a program in the specified memory. |
void |
load(java.lang.String name,
int base,
LoadInfo info)
Load a program in the default memory. |
void |
notifyInterrupt(Interrupt isr)
Notity the cpu the specified isr can have changed state. |
int |
pc()
Return the register used as program counter |
void |
pc(int value)
Set the program counter. |
void |
removeBreakPoint(BreakPoint b)
Remove the specified breakpoint |
void |
removeBreakPoint(int i)
Remove the specified break point. |
void |
removeExceptionListener(ExceptionListener l)
Remove one exception listener. |
void |
removeTraceListener(TraceListener t)
Remove the specified trace listener |
void |
setByte(int a,
int v)
Set a byte on the Main memory. |
void |
setClock(long clock)
Set the CPU clock in Hz. |
void |
setClockPerCycle(int n)
Set the number of clock used for cycle during instruction execution. |
void |
setEndian(int n)
Set cpu 'endianess' |
void |
setIOByte(int a,
int v)
Set a byte in the I/O memory. |
void |
setRealTime(boolean mode)
Set the real time emulation mode. |
void |
setResetAddress(int address)
Set the value of the PC at reset. |
void |
setStatusLine(char c)
Set a char on the status line The status line is the last line of the display and is reserved for JMCE message the first part of the line will display the type of cpu, the configured clock, the current clock and the VM usage. |
void |
setTill(int address)
Set the break address. |
void |
setWord(int a,
int v)
Set one word (16 bit) in the main memory |
void |
start()
Start the CPU |
int |
step()
Exec one step and return the number of cycle used. |
void |
stop()
Stop the CPU |
Methods inherited from interface jmce.sim.Hardware |
---|
addHardware, destroy, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareInstances, getHardwareTree, getName, getParent, init, initSwing, removeHardware, removeHardware, reset, setHardware, setHardware, setName |
Methods inherited from interface java.lang.Runnable |
---|
run |
Field Detail |
---|
static final java.lang.String MAIN_MEMORY
static final java.lang.String IO_MEMORY
static final int LITTLE_ENDIAN
static final int BIG_ENDIAN
Method Detail |
---|
void setEndian(int n)
LITTLE_ENDIAN
,
BIG_ENDIAN
int getEndian()
LITTLE_ENDIAN
,
BIG_ENDIAN
boolean isBigEndian()
boolean isLittleEndian()
long getClock()
void setClock(long clock)
void setClockPerCycle(int n)
int getClockPerCycle()
long getCycle()
void addCycleListener(CycleListener l)
This event is fired after the execution of every instructions. Please use only when necessary because can have large impact on simulator performance.
l
- - The listener to register.Register addRegister(Register r)
Register getRegisterAt(int i)
int getRegisterCount()
Register getRegisterForName(java.lang.String name)
Decoder addDecoder(Decoder d)
d
- - DecoderDecoder
int getDecoderCount()
Decoder getDecoderAt(int i)
boolean isRunning()
void start()
isRunning()
void stop()
isRunning()
void addExceptionListener(ExceptionListener l)
void removeExceptionListener(ExceptionListener l)
int getExceptionListenerCount()
ExceptionListener getExceptionListenerAt(int i)
int step() throws SIMException
SIMException
int idle() throws SIMException
SIMException
void setTill(int address)
int pc() throws SIMException
SIMException
void pc(int value) throws SIMException
value
- - New value for the program counter.
SIMException
void setByte(int a, int v) throws SIMException
a
- - Addressv
- - Value.
SIMException
void setWord(int a, int v) throws SIMException
a
- - Addressv
- - value
SIMException
int getWord(int a) throws SIMException
a
- - Address
SIMException
int getByte(int a) throws SIMException
a
- - Address
SIMException
int fetch(int pc) throws SIMException
SIMException
java.lang.String decodeAt(int pc) throws SIMException
SIMException
int getLenghtAt(int pc) throws SIMException
SIMException
void load(Memory m, java.lang.String name, int base, LoadInfo info) throws SIMException
m
- - Memory where to load.name
- - Name of the file.base
- - Base address.info
- - Information filled when return.
SIMException
void load(java.lang.String name, int base, LoadInfo info) throws SIMException
name
- - Name of the file.base
- - Base address.info
- - Information filled when return.
SIMException
void addTimerCycle(Timer t)
After every clock machine the timer is decremented and when reach 0 the timer is fired.
t
- - the timer.Timer
void addTimerMs(Timer t)
After every sec/1000 calculated using the clock machine the timer is decremeted and when reach 0 the timer is fired.
t
- - the timer.Timer
long getCycleMillis()
int fireNMI(Interrupt i) throws SIMException
SIMException
boolean isInterruptEnabled()
double getUsage()
java.lang.String getUsageDesc()
This method is like getUsage() but return one string with nome information.
void addResetListener(ResetListener l)
l
- - Listenerint getMemoryCount()
Memory getMemory()
Memory getMemoryAt(int i)
Memory getMemoryForName(java.lang.String name)
If no memory with the specified name is present return null.
name
- - Name of the memory to be searched.
int getBreakPointCount()
BreakPoint getBreakPointAt(int i)
void removeBreakPoint(int i)
void removeBreakPoint(BreakPoint b)
BreakPoint addExecBreakPoint(int m, int a)
Triggered when the specified location is executed from the cpu.
BreakPoint addReadBreakPoint(int m, int a)
Trigger when the specified location is readed from the cpu.
BreakPoint addWriteBreakPoint(int m, int a)
Triggered when the specified location si written from the cpu.
void addTraceListener(TraceListener t)
When a trace listener is installed it will be called with one or more string with the cpu trace in human reeadable form.
void removeTraceListener(TraceListener t)
void addIOReadListener(int a, MemoryReadListener l)
void addIOReadListener(MemoryReadListener l)
void addIOWriteListener(MemoryWriteListener l)
void addMemoryWriteListener(MemoryWriteListener l)
void addIOWriteListener(int a, MemoryWriteListener l)
void setIOByte(int a, int v) throws SIMException
SIMException
int getIOByte(int a) throws SIMException
SIMException
void setResetAddress(int address) throws SIMException
SIMException
int getResetAddress()
void setRealTime(boolean mode)
If the realtime mode is selected the cpu will run at the current clock. original speed.
mode
- - Real time emulation mode.setClock(long)
boolean getRealTime()
setRealTime(boolean)
void abort(java.lang.String s)
This method can be called from any thread.
void dumpStatistics(java.lang.String filename) throws SIMException
SIMException
void setStatusLine(char c)
The status line is the last line of the display and is reserved for JMCE message the first part of the line will display the type of cpu, the configured clock, the current clock and the VM usage. The last char of the line display a character with the last I/O operation :
The status line will display the last status till do not change.
int fireISR(Interrupt isr) throws SIMException
SIMException
void notifyInterrupt(Interrupt isr)
notifyInterrupt
in interface InterruptManager
void addInterrupt(Interrupt isr)
addInterrupt
in interface InterruptManager
|
jmce - 1_02 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |