de.cau.cs.kieler.krep.evalbench.program
Class Instruction

java.lang.Object
  extended by de.cau.cs.kieler.krep.evalbench.program.Instruction
Direct Known Subclasses:
Instruction

public abstract class Instruction
extends Object

Superclass for all assembler instructions. This includes same basic code for displaying an instruction and to convert it into object code.

Rating yellow
(2010-02-05) review by cmot, msp

Constructor Summary
Instruction()
           
 
Method Summary
abstract  void asmLabel(HashMap<String,Integer> label2addr)
          replace label by addresses.
 String getLabel()
           
 LinkedList<String> getLabels()
           
protected abstract  int[] getObj()
           
 void setLabel(String label)
           
 void setLabels(LinkedList<String> labs)
           
abstract  String toString()
           
 String writeObj()
          give object code for this instruction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Instruction

public Instruction()
Method Detail

getLabel

public String getLabel()
Returns:
unique label for this instruction

setLabels

public void setLabels(LinkedList<String> labs)
Parameters:
labs - list of labels for this instruction

getLabels

public LinkedList<String> getLabels()
Returns:
all labels for this instruction

toString

public abstract String toString()
Overrides:
toString in class Object

writeObj

public String writeObj()
give object code for this instruction.

Returns:
4 Bytes for this instruction

getObj

protected abstract int[] getObj()
Returns:
object code for the instruction.

setLabel

public void setLabel(String label)
Parameters:
label - set unique label for this instruction

asmLabel

public abstract void asmLabel(HashMap<String,Integer> label2addr)
                       throws ParseException
replace label by addresses.

Parameters:
label2addr - mapping from label to absolute addresses in the instruction ROM
Throws:
ParseException - exception thrown for undefined labels