com.cmpware.cmp.models
Class Null

java.lang.Object
  extended by com.cmpware.cmp.Memory
      extended by com.cmpware.cmp.Processor
          extended by com.cmpware.cmp.models.Null
All Implemented Interfaces:
ReadWriteInterface

public class Null
extends Processor

This class implements a "null" spacer processor model. This just takes up space in the Processor Array display for formatting purposes. It has no functionality and should consume minimal resources.

Copyright (c) 2007 Cmpware, Inc. All Rights Reserved.

Author:
SAG

Field Summary
static java.lang.String copyright
          Copyright string
 
Fields inherited from class com.cmpware.cmp.Processor
bkpt, branchAddr, branchDelay, breakpointHit, currentBranchDelay, currentInstr, currentInstrCode, cycleCount, elf, idlePower, iMix, instructionSize, name, noop, opcodeName, pc, prevInstr, prevInstrCode, r, regName, runningPower, sr, sregName, stall, stallCount
 
Fields inherited from class com.cmpware.cmp.Memory
BIG, LITTLE
 
Constructor Summary
Null()
          The constructor
 
Method Summary
 void advancePC()
          This method advances the Program Counter.
 java.lang.String dasm(byte[] instr)
          This method disassembles an instruction.
 int decode(int instr)
          A unique code identifying the instruction is returned by this method.
 void execute(int instr)
          This method is called after the fetch() and decode() and represents the execution phase of the instruction.
 void fetch()
          This method fetches an instruction from memory and updates the currentInstr and prevInstr.
 int getPC()
          This method returns the current Program Counter.
 void setPC(int pc)
          This method sets the current Program Counter.
 
Methods inherited from class com.cmpware.cmp.Processor
branch, branchNoDelay, defineBranchDelay, defineBreakpoint, defineInstructionSize, defineName, defineNoop, defineOpcodeNames, defineRegisterNames, defineRegisters, defineSpecialRegisterNames, defineSpecialRegisters, get, getBreakpoint, getBreakpointData, getBreakpoints, getCycleCount, getDebugRegisters, getElf, getIdlePower, getInstruction, getInstructionMix, getInstructionSize, getName, getNoop, getOpcodeNames, getRegister, getRegisterNames, getRegisters, getRunningPower, getSpecialRegister, getSpecialRegisterNames, getSpecialRegisters, getStallCount, isBreakpoint, isStalled, load, postLoad, removeAllBreakpoints, removeBreakpoint, reset, setBreakpoint, setIdlePower, setRegister, setRunningPower, setSpecialRegister, stall, statistics, step
 
Methods inherited from class com.cmpware.cmp.Memory
addInput, addMemory, addOutput, getEndian, getLocalMemory, getMemoryManager, getMmio, getProfile, hexDump, hexDump, isReadable, isValidAddress, isWriteable, profile, read, read, read16, read24, read32, read64, removeMemory, resize, setEndian, size, toInt, toShort, write, write, write16, write24, write32, write64
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

copyright

public static final java.lang.String copyright
Copyright string

See Also:
Constant Field Values
Constructor Detail

Null

public Null()
The constructor

Method Detail

decode

public int decode(int instr)
           throws IllegalOpcodeException
Description copied from class: Processor
A unique code identifying the instruction is returned by this method. In some processors with simple fixed-field opcodes this may be a very simple method to define. Other architectures with more complex decoding will require a more complex implementation.

Specified by:
decode in class Processor
Parameters:
instr - The instruction to be decoded.
Returns:
A unique code identifying the instruction is returned by this method.
Throws:
IllegalOpcodeException - if an illegal opcode is encountered.

execute

public void execute(int instr)
             throws MemoryAccessException,
                    IllegalRegisterException
Description copied from class: Processor
This method is called after the fetch() and decode() and represents the execution phase of the instruction. All update of processor state occurs in this method. This is where most of the processor definition will occur. See examples for suggestions on implementation of this method.

Specified by:
execute in class Processor
Parameters:
instr - The instruction to be executed.
Throws:
MemoryAccessException - A Memory Access Exception is thrown is an illegal memory access is attempted.
IllegalRegisterException - if an attempt is made to access a register illegally.

getPC

public int getPC()
Description copied from class: Processor
This method returns the current Program Counter.

Specified by:
getPC in class Processor
Returns:
This method returns the current Program Counter.

setPC

public void setPC(int pc)
Description copied from class: Processor
This method sets the current Program Counter.

Specified by:
setPC in class Processor

dasm

public java.lang.String dasm(byte[] instr)
Description copied from class: Processor
This method disassembles an instruction. Note that a byte array is provided as the interface. This is to make this method as generic as possible.

Specified by:
dasm in class Processor
Parameters:
instr - The instruction to be disassembled.
Returns:
This method returns the disassembled instruction.

fetch

public void fetch()
           throws MemoryAccessException
Description copied from class: Processor
This method fetches an instruction from memory and updates the currentInstr and prevInstr. Note that breakpoints are taken into account. If the previous instruction executed was a breakpoint, the actual instruction is fetched from the saved value in the breakpoint table.

Overrides:
fetch in class Processor
Throws:
MemoryAccessException

advancePC

public void advancePC()
Description copied from class: Processor
This method advances the Program Counter. It takes into account branches and stalls. This is provided as a seperate method (rather than being included as part of step()) to permit it to be overloaded.

Overrides:
advancePC in class Processor