hades.models.rtlib.arith
Class DcoreALU2

java.lang.Object
  extended byhades.simulator.SimObject
      extended byhades.models.rtlib.GenericRtlibObject
          extended byhades.models.rtlib.arith.DcoreALU2
All Implemented Interfaces:
java.lang.Cloneable, ContextToolTip, java.io.Serializable, Simulatable, Wakeable

public class DcoreALU2
extends GenericRtlibObject

See Also:
Serialized Form

Nested Class Summary
protected  class DcoreALU2.ConfigDialog
           
 
Nested classes inherited from class hades.models.rtlib.GenericRtlibObject
GenericRtlibObject.BinaryValueLabelFormatter, GenericRtlibObject.DecimalValueLabelFormatter, GenericRtlibObject.DINColorSource, GenericRtlibObject.FlexibleLabelFormatter, GenericRtlibObject.HexValueLabelFormatter
 
Field Summary
 int ADDC
           
 int ADDI
           
 int ADDU
           
 int AND_AB
           
 int ANDI
           
 int ASR
           
 int ASRC
           
 int BCLRI
           
 int BSETI
           
 int CMP_AGTB
           
 int CMP_ALTB
           
 int CMP_EQ
           
 int CMP_NEQ
           
protected  DcoreALU2.ConfigDialog configDialog
           
protected  int currentOpcode
           
 int ILLEGAL_0b
           
 int ILLEGAL_0f
           
 int LSL
           
 int LSLC
           
 int LSLI
           
 int LSR
           
 int LSRC
           
 int LSRI
           
 int MOV
           
 int MOVI
           
 int n_operations
           
 int NOT_A
           
protected  int[] opcodeArray
           
(package private)  java.lang.String[] operationLabels
           
 int OR_AB
           
protected  PortStdLogicVector port_A
           
protected  PortStdLogicVector port_B
           
protected  PortStdLogic1164 port_Cin
           
protected  PortStdLogic1164 port_Cout
           
protected  PortStdLogicVector port_IMM
           
protected  PortStdLogicVector port_OPC
           
protected  PortStdLogicVector port_Y
           
 int SUBI
           
 int SUBU
           
protected  StdLogic1164 value_Cout
           
protected  StdLogicVector vector_Y
           
 int XOR_AB
           
protected  StdLogicVector zero12
           
 
Fields inherited from class hades.models.rtlib.GenericRtlibObject
BINARY, DECIMAL, defaultdelay, delay, enableAnimationFlag, HEX, labelFormatter, n_bits, valueLabel, vector, vector_000, vector_111, vector_UUU, vector_XXX, vector_ZZZ, vectorOutputPort
 
Fields inherited from class hades.simulator.SimObject
classloader, console, debug, editor, name, parent, ports, propertySheet, simulator, symbol, versionId, visible
 
Constructor Summary
DcoreALU2()
           
 
Method Summary
protected  void calculateOutput(StdLogicVector A, StdLogicVector B, StdLogic1164 Cin, StdLogicVector IMM, int opcode)
          calculateOutput: internal method to evaluate the ALU operation specified by the opcode on input operands A, B, and Cin.
 void configure()
          create and display a 'ConfigDialog' to set the parameters for a SimObject.
 void constructPorts()
           
 SimObject copy()
          copy(): This function is used to create a clone of a DcoreALU2 object, including the values for width (n_bits), version ID, propagation delay, and the selected opcodes.
 int decodeOpcode(StdLogicVector OPC)
           
 void evaluate(java.lang.Object arg)
          evaluate(): called by the simulation engine on all events that concern this object.
 java.lang.String getCurrentOpcodeName()
           
 java.awt.Component getPropertySheet()
          return a reference to the 'property sheet' or configuration window for this SimObject.
 java.lang.String getToolTip(java.awt.Point position, long millis)
          construct a (not so short) tool tip message.
 boolean initialize(java.lang.String s)
          initialize a DcoreALU2 object from a String which contains the integer version id, the width of this vector, the default output delay, the number of opcodes, and a list of the individual opcodes (starting with opcde[0]):
static void main(java.lang.String[] argv)
           
static void msg(java.lang.String s)
           
(package private)  void schedule(SimKernel simulator, double time, Port port, java.lang.Object value)
           
(package private)  void schedule(SimKernel simulator, double time, Port port, StdLogic1164 v)
           
protected  void scheduleOutputsAndFlags()
           
 void setCarry(long value)
          set the carry bit for an ADD/SUB operation from the long integer result 'value' of the addition.
 void write(java.io.PrintWriter ps)
          write the following data to PrintWriter ps: our versionId, the width (n_bits), the default delay, and finally the number of opcodes and a list of the individual opcodes.
 
Methods inherited from class hades.models.rtlib.GenericRtlibObject
assign, constructStandardValues, elaborate, getDelay, getEnableAnimationFlag, getFormattedValue, getNumberFormat, getValue, getWidth, initValueLabel, isConnected, scheduleAfter, scheduleAfter, scheduleVectorOutputPort, setDelay, setDelay, setEnableAnimationFlag, setEnableAnimationFlag, setFormattedValue, setNumberFormat, setNumberFormat, setSymbol, setValue, setValue, setWidth, setWidth, toString, updateSymbol, wakeup, wakeupAfter
 
Methods inherited from class hades.simulator.SimObject
constructDynamicSymbol, getBindkey, getClassLoader, getDebug, getEditor, getExternalResources, getFullName, getName, getParent, getPort, getPorts, getResourceAsStream, getSimulator, getSymbol, getSymbolResourceName, getVersionId, isVisible, keyPressed, message, mousePressed, needsDynamicSymbol, needsExternalResources, setClassLoader, setConsole, setDebug, setEditor, setName, setParent, setPorts, setSimulator, setVersionId, setVisible, tearDown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface hades.simulator.Simulatable
message
 

Field Detail

port_OPC

protected PortStdLogicVector port_OPC

port_A

protected PortStdLogicVector port_A

port_B

protected PortStdLogicVector port_B

port_IMM

protected PortStdLogicVector port_IMM

port_Y

protected PortStdLogicVector port_Y

port_Cin

protected PortStdLogic1164 port_Cin

port_Cout

protected PortStdLogic1164 port_Cout

vector_Y

protected StdLogicVector vector_Y

value_Cout

protected StdLogic1164 value_Cout

zero12

protected StdLogicVector zero12

n_operations

public final int n_operations

opcodeArray

protected int[] opcodeArray

currentOpcode

protected int currentOpcode

MOV

public final int MOV
See Also:
Constant Field Values

ADDU

public final int ADDU
See Also:
Constant Field Values

ADDC

public final int ADDC
See Also:
Constant Field Values

SUBU

public final int SUBU
See Also:
Constant Field Values

AND_AB

public final int AND_AB
See Also:
Constant Field Values

OR_AB

public final int OR_AB
See Also:
Constant Field Values

XOR_AB

public final int XOR_AB
See Also:
Constant Field Values

NOT_A

public final int NOT_A
See Also:
Constant Field Values

LSL

public final int LSL
See Also:
Constant Field Values

LSR

public final int LSR
See Also:
Constant Field Values

ASR

public final int ASR
See Also:
Constant Field Values

ILLEGAL_0b

public final int ILLEGAL_0b
See Also:
Constant Field Values

LSLC

public final int LSLC
See Also:
Constant Field Values

LSRC

public final int LSRC
See Also:
Constant Field Values

ASRC

public final int ASRC
See Also:
Constant Field Values

ILLEGAL_0f

public final int ILLEGAL_0f
See Also:
Constant Field Values

CMP_EQ

public final int CMP_EQ
See Also:
Constant Field Values

CMP_NEQ

public final int CMP_NEQ
See Also:
Constant Field Values

CMP_AGTB

public final int CMP_AGTB
See Also:
Constant Field Values

CMP_ALTB

public final int CMP_ALTB
See Also:
Constant Field Values

MOVI

public final int MOVI
See Also:
Constant Field Values

ADDI

public final int ADDI
See Also:
Constant Field Values

SUBI

public final int SUBI
See Also:
Constant Field Values

ANDI

public final int ANDI
See Also:
Constant Field Values

LSLI

public final int LSLI
See Also:
Constant Field Values

LSRI

public final int LSRI
See Also:
Constant Field Values

BSETI

public final int BSETI
See Also:
Constant Field Values

BCLRI

public final int BCLRI
See Also:
Constant Field Values

operationLabels

java.lang.String[] operationLabels

configDialog

protected DcoreALU2.ConfigDialog configDialog
Constructor Detail

DcoreALU2

public DcoreALU2()
Method Detail

constructPorts

public void constructPorts()
Overrides:
constructPorts in class GenericRtlibObject

write

public void write(java.io.PrintWriter ps)
write the following data to PrintWriter ps: our versionId, the width (n_bits), the default delay, and finally the number of opcodes and a list of the individual opcodes.

Overrides:
write in class GenericRtlibObject

initialize

public boolean initialize(java.lang.String s)
initialize a DcoreALU2 object from a String which contains the integer version id, the width of this vector, the default output delay, the number of opcodes, and a list of the individual opcodes (starting with opcde[0]):

Warning: For the DcoreALU2, we ignore the opcodes found in the input file and use the standard mapping 0, 1, 2, 3, ...

Overrides:
initialize in class GenericRtlibObject

copy

public SimObject copy()
copy(): This function is used to create a clone of a DcoreALU2 object, including the values for width (n_bits), version ID, propagation delay, and the selected opcodes.

Overrides:
copy in class GenericRtlibObject

configure

public void configure()
Description copied from class: SimObject
create and display a 'ConfigDialog' to set the parameters for a SimObject. The default ConfigDialog for the base class (SimObject) itself is empty except for the 'instance name' of the SimObject.

Overrides:
configure in class GenericRtlibObject

getPropertySheet

public java.awt.Component getPropertySheet()
Description copied from class: SimObject
return a reference to the 'property sheet' or configuration window for this SimObject. We cast the return value to an AWT Component, but typically you can expect either a hades.gui.PropertySheet or an java.awt.Window (Dialog or Frame).

Overrides:
getPropertySheet in class SimObject

evaluate

public void evaluate(java.lang.Object arg)
Description copied from interface: Simulatable
evaluate(): called by the simulation engine on all events that concern this object. The object is responsible for updating its internal state and for scheduling all pending output events.

Specified by:
evaluate in interface Simulatable
Overrides:
evaluate in class SimObject
Parameters:
arg - an arbitrary object argument

decodeOpcode

public int decodeOpcode(StdLogicVector OPC)

scheduleOutputsAndFlags

protected void scheduleOutputsAndFlags()

schedule

void schedule(SimKernel simulator,
              double time,
              Port port,
              java.lang.Object value)

schedule

void schedule(SimKernel simulator,
              double time,
              Port port,
              StdLogic1164 v)

calculateOutput

protected void calculateOutput(StdLogicVector A,
                               StdLogicVector B,
                               StdLogic1164 Cin,
                               StdLogicVector IMM,
                               int opcode)
calculateOutput: internal method to evaluate the ALU operation specified by the opcode on input operands A, B, and Cin. Because we cannot return multiple values from a Java method, the result is stored in the global variables "vector_Y" and "value_Cout", and the corresponding flags "value_ZERO" ... "value_OVF".

Either one of A, B, and Cin may be undefined, but none of the input or output objects may be null. Depending on the operation type, the value of Cout and the flags may be modified or not.


setCarry

public void setCarry(long value)
set the carry bit for an ADD/SUB operation from the long integer result 'value' of the addition. If 'value' is out of the acceptable range for a given vector (e.g. 0x0000 .. 0xffff for 16 bit width), the carry bit is set and reset else.


getCurrentOpcodeName

public java.lang.String getCurrentOpcodeName()

getToolTip

public java.lang.String getToolTip(java.awt.Point position,
                                   long millis)
construct a (not so short) tool tip message.

Specified by:
getToolTip in interface ContextToolTip
Overrides:
getToolTip in class GenericRtlibObject

msg

public static void msg(java.lang.String s)

main

public static void main(java.lang.String[] argv)