hades.models.rtlib.arith
Class UserDefinedALU

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

public class UserDefinedALU
extends GenericRtlibObject

See Also:
Serialized Form

Nested Class Summary
protected  class UserDefinedALU.ConfigDialog
           
 
Nested classes inherited from class hades.models.rtlib.GenericRtlibObject
GenericRtlibObject.BinaryValueLabelFormatter, GenericRtlibObject.DecimalValueLabelFormatter, GenericRtlibObject.DINColorSource, GenericRtlibObject.FlexibleLabelFormatter, GenericRtlibObject.HexValueLabelFormatter
 
Field Summary
 int ADD_AB
           
 int ADD_AB1
           
 int ADD_ABCin
           
 int AND_AB
           
protected  UserDefinedALU.ConfigDialog configDialog
           
 int CONST_0
           
 int CONST_1
           
 int CONST_FFFF
           
protected  int currentOpcode
           
 int DECR_A
           
 int DECR_B
           
 StdLogic1164 ieee_0
           
 StdLogic1164 ieee_1
           
 StdLogic1164 ieee_U
           
 int INCR_A
           
 int INCR_B
           
 int n_operations
           
 int NOT_A
           
 int NOT_B
           
protected  int[] opcodeArray
           
(package private)  java.lang.String[] operationLabels
           
 int OR_AB
           
 int PASS_A
           
 int PASS_B
           
protected  PortStdLogicVector port_A
           
protected  PortStdLogicVector port_B
           
protected  PortStdLogic1164 port_Cin
           
protected  PortStdLogic1164 port_Cout
           
protected  PortStdLogic1164 port_EQ
           
protected  PortStdLogic1164 port_NEG
           
protected  PortStdLogicVector port_OPC
           
protected  PortStdLogic1164 port_OVF
           
protected  PortStdLogicVector port_Y
           
protected  PortStdLogic1164 port_ZERO
           
 int ROL_A
           
 int ROL_AC
           
 int ROR_A
           
 int ROR_AC
           
 int SHL_A
           
 int SRA_A
           
 int SRL_A
           
 int SUB_AB
           
protected  StdLogic1164 value_Cout
           
protected  StdLogic1164 value_EQ
           
protected  StdLogic1164 value_NEG
           
protected  StdLogic1164 value_OVF
           
protected  StdLogic1164 value_ZERO
           
protected  StdLogicVector vector_Y
           
 int XNOR_AB
           
 int XOR_AB
           
 
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
UserDefinedALU()
           
 
Method Summary
protected  void calculateOutput(StdLogicVector A, StdLogicVector B, StdLogic1164 Cin, 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 UserDefinedALU 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 UserDefinedALU 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()
           
protected  void updateFlags(StdLogicVector A, StdLogicVector B)
          updateFlags: update the values of the output flags (ZERO, NEG, EQ, OVF) from the current values of vector_Y and value_Cout.
 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_Y

protected PortStdLogicVector port_Y

port_Cin

protected PortStdLogic1164 port_Cin

port_Cout

protected PortStdLogic1164 port_Cout

port_ZERO

protected PortStdLogic1164 port_ZERO

port_NEG

protected PortStdLogic1164 port_NEG

port_EQ

protected PortStdLogic1164 port_EQ

port_OVF

protected PortStdLogic1164 port_OVF

vector_Y

protected StdLogicVector vector_Y

value_Cout

protected StdLogic1164 value_Cout

value_ZERO

protected StdLogic1164 value_ZERO

value_NEG

protected StdLogic1164 value_NEG

value_EQ

protected StdLogic1164 value_EQ

value_OVF

protected StdLogic1164 value_OVF

n_operations

public final int n_operations
See Also:
Constant Field Values

opcodeArray

protected int[] opcodeArray

currentOpcode

protected int currentOpcode

ieee_U

public final StdLogic1164 ieee_U

ieee_0

public final StdLogic1164 ieee_0

ieee_1

public final StdLogic1164 ieee_1

CONST_0

public final int CONST_0
See Also:
Constant Field Values

CONST_1

public final int CONST_1
See Also:
Constant Field Values

CONST_FFFF

public final int CONST_FFFF
See Also:
Constant Field Values

PASS_A

public final int PASS_A
See Also:
Constant Field Values

PASS_B

public final int PASS_B
See Also:
Constant Field Values

INCR_A

public final int INCR_A
See Also:
Constant Field Values

INCR_B

public final int INCR_B
See Also:
Constant Field Values

DECR_A

public final int DECR_A
See Also:
Constant Field Values

DECR_B

public final int DECR_B
See Also:
Constant Field Values

ADD_AB

public final int ADD_AB
See Also:
Constant Field Values

ADD_AB1

public final int ADD_AB1
See Also:
Constant Field Values

ADD_ABCin

public final int ADD_ABCin
See Also:
Constant Field Values

SUB_AB

public final int SUB_AB
See Also:
Constant Field Values

NOT_A

public final int NOT_A
See Also:
Constant Field Values

NOT_B

public final int NOT_B
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

XNOR_AB

public final int XNOR_AB
See Also:
Constant Field Values

SHL_A

public final int SHL_A
See Also:
Constant Field Values

SRL_A

public final int SRL_A
See Also:
Constant Field Values

SRA_A

public final int SRA_A
See Also:
Constant Field Values

ROL_A

public final int ROL_A
See Also:
Constant Field Values

ROR_A

public final int ROR_A
See Also:
Constant Field Values

ROL_AC

public final int ROL_AC
See Also:
Constant Field Values

ROR_AC

public final int ROR_AC
See Also:
Constant Field Values

operationLabels

java.lang.String[] operationLabels

configDialog

protected UserDefinedALU.ConfigDialog configDialog
Constructor Detail

UserDefinedALU

public UserDefinedALU()
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 UserDefinedALU 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]):

Overrides:
initialize in class GenericRtlibObject

copy

public SimObject copy()
copy(): This function is used to create a clone of a UserDefinedALU 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)

updateFlags

protected void updateFlags(StdLogicVector A,
                           StdLogicVector B)
updateFlags: update the values of the output flags (ZERO, NEG, EQ, OVF) from the current values of vector_Y and value_Cout.


scheduleOutputsAndFlags

protected void scheduleOutputsAndFlags()

schedule

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

schedule

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

calculateOutput

protected void calculateOutput(StdLogicVector A,
                               StdLogicVector B,
                               StdLogic1164 Cin,
                               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.


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)