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 java.lang.Object

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

Since:
Date: Nov 20, 2011
Author:
croesch

Constructor Summary
Mic1(java.io.InputStream micAsm, java.io.InputStream asm)
          Constructs a new Mic1-processor, reading the given inputstreams as micro-program and assembler-program.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 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 getNextMacroAddress()
          Returns the address of the code line that'll be executed next.
 int getNextMpc()
          Returns the address of the micro code line that'll be executed by the next tick.
 int getOldMpc()
          Returns the address of the last executed micro code line.
 int hashCode()
           
 void interrupt()
          Interrupts the processor.
 boolean isHaltInstruction()
          Returns whether the current instruction is the halt-instruction.
 boolean isInterrupted()
          Returns whether the processor is interrupted.
 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, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mic1

public Mic1(java.io.InputStream micAsm,
            java.io.InputStream asm)
     throws MacroFileFormatException,
            MicroFileFormatException
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:
MacroFileFormatException - if the macro assembler program has invalid format
MicroFileFormatException - if the micro assembler program has invalid 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

@NotNull
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

getNextMacroAddress

public int getNextMacroAddress()
Returns the address of the code line that'll be executed next.

Returns:
the address of the code line that'll be executed next.
Since:
Date: May 11, 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

getNextMpc

public int getNextMpc()
Returns the address of the micro code line that'll be executed by the next tick.

Returns:
the address of the micro code line that'll be executed by the next tick.
Since:
Date: May 11, 2012

getControlStore

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

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

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

interrupt

public void interrupt()
Interrupts the processor.

Since:
Date: May 26, 2012

isInterrupted

public boolean isInterrupted()
Returns whether the processor is interrupted.

Returns:
true, if the processor has been interrupted while executing ticks,
or false if the processor hasn't been interrupted while executing the last ticks.
Since:
Date: May 26, 2012


Copyright © 2012. All Rights Reserved.