hicosim.components.backend.processor
Class Processor

java.lang.Object
  extended by hicosim.components.backend.processor.Processor
All Implemented Interfaces:
IProcessor

public class Processor
extends java.lang.Object
implements IProcessor

This class simulates the HICOVEC processor.

Author:
Michael Wager, Andreas Weber, Luca Calchera , 16th May 2009

Nested Class Summary
static class Processor.ScalarRegister
          Enumaration of a ScalarRegister.
 
Field Summary
static Engine engine
           
 
Constructor Summary
Processor(ProcessorConfig newConfig, Engine engine1)
           
 
Method Summary
 java.lang.String decodeInstruction(int instr, boolean isdisas, boolean stepping, int progCounter)
          This method decodes the given 32 bit instruction "instr" and executes the decoded command.
 void deleteBreakpoint(int address)
          this method deletes a breakpoint
 java.util.Vector<java.lang.Integer> getBreakpoints()
           
 int getCarryFlag()
           
 java.lang.String getConfiguration()
           
 int getIP()
           
 int getRegA()
           
 java.lang.String getRegs()
          String representation of the Registers.
 int getRegX()
           
 int getRegY()
           
 IStatistic getStatistics()
           
 int[][] getVectorRegisters()
           
 int getVRegsValue(int i, int j)
          This method is used to get the content of a vecReg.
 int getZeroFlag()
           
 void incIP()
           
 void interrupt()
           
 boolean isHALT()
           
 boolean isObjectFileLoaded()
           
 boolean isRunning()
           
 void reset()
          This method resets the progCounter, all breakpoints, registers and the statistics.
 void resetBr()
          this method deletes ALL breakpoints
 void setBreakpoint(int address)
          setBreakpoint - only if the address is available/used in the instructionRegister
 void setConfig(ProcessorConfig newConfig)
           
 void setHALT(boolean HALT)
           
 void setIP(int newIP)
           
 void setIsRunning(boolean isRunning)
           
 void setOFileNotLoaded()
           
 void setScalarValue(char reg, int value)
           
 void setStatusRegs(boolean zero, int carry)
          To set the new value of the statusregister.
 void setStepping(boolean stepping)
           
 void setUp(IMemory memory, int progCounter)
          Everytime when a new objectfile was loaded, call setUp()
 void setVRegsValue(int i, int j, int value)
          This method is used so set a value in the vectorregister and show that change in GUI if GUI-App is launched.
 void step()
          execute one single instruction
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

engine

public static Engine engine
Constructor Detail

Processor

public Processor(ProcessorConfig newConfig,
                 Engine engine1)
Parameters:
newConfig -
engine1 -
Method Detail

getStatistics

public IStatistic getStatistics()

setUp

public void setUp(IMemory memory,
                  int progCounter)
Everytime when a new objectfile was loaded, call setUp()

Specified by:
setUp in interface IProcessor

setVRegsValue

public void setVRegsValue(int i,
                          int j,
                          int value)
This method is used so set a value in the vectorregister and show that change in GUI if GUI-App is launched.

Specified by:
setVRegsValue in interface IProcessor
Parameters:
i -
j -
value -

getVRegsValue

public int getVRegsValue(int i,
                         int j)
This method is used to get the content of a vecReg.

Specified by:
getVRegsValue in interface IProcessor
Parameters:
i -
j -
Returns:
- int VRegsValue at (i,j)

setStatusRegs

public void setStatusRegs(boolean zero,
                          int carry)
To set the new value of the statusregister.

Specified by:
setStatusRegs in interface IProcessor
Parameters:
zero -
carry -

setIP

public void setIP(int newIP)
Specified by:
setIP in interface IProcessor

incIP

public void incIP()

setScalarValue

public void setScalarValue(char reg,
                           int value)
Specified by:
setScalarValue in interface IProcessor

setIsRunning

public void setIsRunning(boolean isRunning)
Specified by:
setIsRunning in interface IProcessor

isRunning

public boolean isRunning()
Specified by:
isRunning in interface IProcessor

setOFileNotLoaded

public void setOFileNotLoaded()
Specified by:
setOFileNotLoaded in interface IProcessor

isObjectFileLoaded

public boolean isObjectFileLoaded()
Specified by:
isObjectFileLoaded in interface IProcessor

setConfig

public void setConfig(ProcessorConfig newConfig)
Specified by:
setConfig in interface IProcessor

setStepping

public void setStepping(boolean stepping)
Specified by:
setStepping in interface IProcessor

interrupt

public void interrupt()
               throws java.lang.Exception
Specified by:
interrupt in interface IProcessor
Throws:
java.lang.Exception

reset

public void reset()
This method resets the progCounter, all breakpoints, registers and the statistics.

Specified by:
reset in interface IProcessor

getRegs

public java.lang.String getRegs()
String representation of the Registers.

Specified by:
getRegs in interface IProcessor

getRegA

public int getRegA()
Specified by:
getRegA in interface IProcessor

getRegX

public int getRegX()
Specified by:
getRegX in interface IProcessor

getRegY

public int getRegY()
Specified by:
getRegY in interface IProcessor

getVectorRegisters

public int[][] getVectorRegisters()
Specified by:
getVectorRegisters in interface IProcessor

getZeroFlag

public int getZeroFlag()
Specified by:
getZeroFlag in interface IProcessor

getCarryFlag

public int getCarryFlag()
Specified by:
getCarryFlag in interface IProcessor

getIP

public int getIP()
Specified by:
getIP in interface IProcessor

getBreakpoints

public java.util.Vector<java.lang.Integer> getBreakpoints()
Specified by:
getBreakpoints in interface IProcessor

resetBr

public void resetBr()
this method deletes ALL breakpoints

Specified by:
resetBr in interface IProcessor

deleteBreakpoint

public void deleteBreakpoint(int address)
this method deletes a breakpoint

Specified by:
deleteBreakpoint in interface IProcessor

setHALT

public void setHALT(boolean HALT)
Specified by:
setHALT in interface IProcessor

isHALT

public boolean isHALT()
Specified by:
isHALT in interface IProcessor

getConfiguration

public java.lang.String getConfiguration()
Specified by:
getConfiguration in interface IProcessor

setBreakpoint

public void setBreakpoint(int address)
                   throws java.lang.Exception
setBreakpoint - only if the address is available/used in the instructionRegister

Specified by:
setBreakpoint in interface IProcessor
Throws:
java.lang.Exception

step

public void step()
execute one single instruction

Specified by:
step in interface IProcessor

decodeInstruction

public java.lang.String decodeInstruction(int instr,
                                          boolean isdisas,
                                          boolean stepping,
                                          int progCounter)
                                   throws java.lang.Exception
This method decodes the given 32 bit instruction "instr" and executes the decoded command. If this method is used by the Disassembler, it just returns the disassembled string-representation of the instruction.

Parameters:
instr - - the instruction to decode
isdisas - - because this method is used by the disassembler, and the processor
stepping - - if breakpoints are set, the user should see the executed instructions
progCounter - - programCounter(because this is used also by Disassembler)
Returns:
- String if used by the Disassembler
Throws:
java.lang.Exception