com.github.croesch.micro_debug.mic1
Class Mic1

java.lang.Object
  extended by com.github.croesch.micro_debug.mic1.Mic1

public final class Mic1
extends Object

This class represents the CISC-processor being debugged by this program.

Since:
Date: Nov 20, 2011
Author:
croesch

Constructor Summary
Mic1(InputStream micAsm, InputStream asm)
          Constructs a new Mic1-processor, reading the given inputstreams as micro-program and assembler-program.
 
Method Summary
 MicroControlStore getControlStore()
          Returns the control store of micro instructions.
 int getLastMacroAddress()
          Returns the address of the last executed code line.
 Memory getMemory()
          Returns the main memory.
 int getMemoryValue(int addr)
          Returns the value of the memory at the given address.
 int getOldMpc()
          Returns the address of the last executed micro code line.
 boolean isHaltInstruction()
          Returns whether the current instruction is the halt-instruction.
 void microStep()
          If the processor hasn't reached the halt instruction this executes one micro instruction.
The number of effectively executed instructions is printed to the user.
 void microStep(int number)
          Executes the given number of micro instructions.
 void reset()
          Resets the processor to its start values, except the debugging options.
 int run()
          Executes all instructions until the end of the program.
 void setMemoryValue(int addr, int val)
          Sets the value of the memory at the given address to the given value.
 void setProcessorInterpreter(IProcessorInterpreter ip)
          Sets the interpreter of this processor.
 void step()
          If the processor hasn't reached the halt instruction this executes one macro instruction.
The number of effectively executed micro instructions is printed to the user.
 void step(int steps)
          Executes the given number of macro instructions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mic1

public Mic1(InputStream micAsm,
            InputStream asm)
     throws FileFormatException
Constructs a new Mic1-processor, reading the given inputstreams as micro-program and assembler-program.

Parameters:
micAsm - the micro-assembler-program
asm - the assembler-program
Throws:
FileFormatException - if one of the streams contains a file with the wrong file format
Since:
Date: Nov 21, 2011
Method Detail

setProcessorInterpreter

public void setProcessorInterpreter(IProcessorInterpreter ip)
Sets the interpreter of this processor.

Parameters:
ip - the interpreter to store.
Since:
Date: Feb 13, 2012

reset

public void reset()
Resets the processor to its start values, except the debugging options. So Registers and current instructions will be reset, but breakpoints or tracing options not.

Since:
Date: Jan 27, 2012

microStep

public void microStep()
If the processor hasn't reached the halt instruction this executes one micro instruction.
The number of effectively executed instructions is printed to the user.

Since:
Date: Jan 16, 2012

microStep

public void microStep(int number)
Executes the given number of micro instructions. If one of them is the halt-instruction, it'll execute less than the given number.
The number of effectively executed instructions is printed to the user.

Parameters:
number - micro instructions to execute, if possible.
Since:
Date: Jan 16, 2012

step

public void step()
If the processor hasn't reached the halt instruction this executes one macro instruction.
The number of effectively executed micro instructions is printed to the user.

Since:
Date: Jan 29, 2012

step

public void step(int steps)
Executes the given number of macro instructions. If one of the executed micro instructions is the halt-instruction, it'll execute less than the given number of macro instructions.
The number of effectively executed micro instructions is printed to the user.

Parameters:
steps - the number of macro instructions to execute
Since:
Date: Jan 29, 2012

run

public int run()
Executes all instructions until the end of the program.

Returns:
the number of ticks that this method executed.
Since:
Date: Jan 14, 2012

isHaltInstruction

public boolean isHaltInstruction()
Returns whether the current instruction is the halt-instruction. If the instruction only is a goto that points to itself, then this is considered to be a halt instruction.
If the instruction points to an address where no instruction is defined, then this will also be handled as a halt-instruction.

Returns:
true, if the current instruction causes the processor to halt
Since:
Date: Jan 14, 2012

setMemoryValue

public void setMemoryValue(int addr,
                           int val)
Sets the value of the memory at the given address to the given value.

Parameters:
addr - the address, where to set the new value
val - the new value
Since:
Date: Jan 21, 2012

getMemoryValue

public int getMemoryValue(int addr)
Returns the value of the memory at the given address.

Parameters:
addr - the address to read the value from the memory.
Returns:
the value fetched from the memory at the given address
Since:
Date: Jan 21, 2012

getMemory

public Memory getMemory()
Returns the main memory.

Returns:
the Memory of this processor.
Since:
Date: Feb 13, 2012

getLastMacroAddress

public int getLastMacroAddress()
Returns the address of the last executed code line.

Returns:
the address of the last executed code line.
Since:
Date: Feb 13, 2012

getOldMpc

public int getOldMpc()
Returns the address of the last executed micro code line.

Returns:
the address of the last executed micro code line.
Since:
Date: Feb 14, 2012

getControlStore

public MicroControlStore getControlStore()
Returns the control store of micro instructions.

Returns:
MicroControlStore storing the micro code of the processor
Since:
Date: Feb 14, 2012


Copyright © 2012. All Rights Reserved.