com.cmpware.cmp.models
Class NIOS2

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

public class NIOS2
extends Processor

This is the model for the NIOS2 processor from Altera.

Copyright (c) 2004, 2005 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, pc, prevInstr, prevInstrCode, r, runningPower, sr, stall, stallCount
 
Fields inherited from class com.cmpware.cmp.Memory
BIG, LITTLE
 
Constructor Summary
NIOS2()
          The constructor
 
Method Summary
 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.
 int getPC()
          This method returns the current Program Counter.
 void reset()
          This method resets the NIOS II processor.
 void setPC(int pc)
          This method sets the current Program Counter.
 
Methods inherited from class com.cmpware.cmp.Processor
advancePC, branch, branchNoDelay, defineBranchDelay, defineBreakpoint, defineInstructionSize, defineName, defineNoop, defineOpcodeNames, defineRegisterNames, defineRegisters, defineSpecialRegisterNames, defineSpecialRegisters, fetch, 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, 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

NIOS2

public NIOS2()
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.

reset

public void reset()
This method resets the NIOS II processor. Note that super.reset() must me called to completely intialize the processor.

Overrides:
reset in class Processor