hades.models.rtlib
Class GenericRtlibObject

java.lang.Object
  extended byhades.simulator.SimObject
      extended byhades.models.rtlib.GenericRtlibObject
All Implemented Interfaces:
java.lang.Cloneable, ContextToolTip, java.io.Serializable, Simulatable, Wakeable
Direct Known Subclasses:
Add, Addc, BitDecoder, BitwiseAnd, BitwiseNot, BitwiseOr, BitwiseXor, Constant, CounterRE, DcoreALU, DcoreALU2, Decoder, Decr, ExpandBit, Expander, GenericShifter, Incr, IpinVector, Latch, LatchR, LFSR, Merge, Merge3, MergeBits, Mux21, Mux41, N1And, N1Or, OpinVector, Reg, RegE, RegR, RegRE, RegWithInitialValue, SelectBit, ShiftRegR, Sub, Subset, TriBuf, TwosComplement, UserDefinedALU

public class GenericRtlibObject
extends SimObject
implements Simulatable, Wakeable, java.io.Serializable

GenericRtlibObject - the utility base class for HADES RTLIB models, that is, the "Rechnerbaukasten" models.

This class supplies a generic configuration dialog with object name, input bus width (n_bits), default output value, default delay.

Signals are expected to be SignalStdLogicVector objects, typically with n_bits bits.

This class also implements the default behaviour for a Wakeup-event, which is to update (and repaint) the value label in the component's Symbol.

Finally, note that this class implements the assign() method defined in the hades.simulator.Assignable interface. This default implementation expects a (binary, decimal, hex-formatted) string with the new output value, schedules the corresponding event on our vectorOutputPort, and a WakeupEvent which is used to update our internal "vector" value at the corresponding simulation time. Subclasses are free to implement Assignable if this implementation does the right thing.

See Also:
Serialized Form

Nested Class Summary
 class GenericRtlibObject.BinaryValueLabelFormatter
           
 class GenericRtlibObject.DecimalValueLabelFormatter
           
 class GenericRtlibObject.DINColorSource
           
 class GenericRtlibObject.FlexibleLabelFormatter
           
 class GenericRtlibObject.HexValueLabelFormatter
           
 
Field Summary
static int BINARY
           
static int DECIMAL
           
protected  double defaultdelay
           
protected  double delay
           
protected  boolean enableAnimationFlag
           
static int HEX
           
protected  GenericRtlibObject.FlexibleLabelFormatter labelFormatter
           
protected  int n_bits
           
protected  ColoredValueLabel valueLabel
           
protected  StdLogicVector vector
           
protected  StdLogicVector vector_000
           
protected  StdLogicVector vector_111
           
protected  StdLogicVector vector_UUU
           
protected  StdLogicVector vector_XXX
           
protected  StdLogicVector vector_ZZZ
           
protected  PortStdLogicVector vectorOutputPort
           
 
Fields inherited from class hades.simulator.SimObject
classloader, console, debug, editor, name, parent, ports, propertySheet, simulator, symbol, versionId, visible
 
Constructor Summary
GenericRtlibObject()
          construct a generic Rtlib object.
 
Method Summary
 void assign(java.lang.String value, double simTime)
          a default implementation of the assign() method defined in the hades.simulator.Assignable interface.
 void configure()
          create and display a 'ConfigDialog' to set the parameters for a SimObject.
protected  void constructPorts()
           
protected  void constructStandardValues()
           
 SimObject copy()
          copy(): This function is used to create a clone of this RTLIB object, including the values for width (n_bits), current value (vector), propagation delay, and version ID.
 void elaborate(java.lang.Object arg)
          elaborate(): This method is called by the simulation engine to initialize this RTLIB object for simulation.
 double getDelay()
           
 boolean getEnableAnimationFlag()
           
 java.lang.String getFormattedValue()
          return a String representation of the current "vector" value using the selected number formatting (dec/hex/bin/...).
 int getNumberFormat()
           
 java.lang.String getToolTip(java.awt.Point position, long millis)
          construct a (short) tool tip message.
 long getValue()
           
 int getWidth()
           
 boolean initialize(java.lang.String s)
          initialize a RTLIB object from a String which contains the integer version id, the width of this vector, and optionally a String of the desired start value (e.g.
protected  void initValueLabel()
           
 boolean isConnected()
           
 void scheduleAfter(double t_delay, Port port, java.lang.Object value)
          scheduleAfter: an utility method to schedule a SimEvent on the Signal connected to Port "port" with "value" at time "simTime+t_delay".
 void scheduleAfter(double t_delay, Port port, StdLogic1164 value)
           
protected  void scheduleVectorOutputPort()
           
 void setDelay(double _delay)
           
 void setDelay(java.lang.String s)
           
 void setEnableAnimationFlag(boolean b)
           
 void setEnableAnimationFlag(java.lang.String s)
           
 void setFormattedValue(java.lang.String s)
           
 void setNumberFormat(int i)
          set the number format to one of DECIMAL, BINARY, HEX
 void setNumberFormat(java.lang.String s)
           
 void setSymbol(Symbol s)
           
 void setValue(long _value)
           
 void setValue(java.lang.String s)
           
 void setWidth(int _n)
           
 void setWidth(java.lang.String s)
           
 java.lang.String toString()
          toString: generate a text description for this SimObject.
 void updateSymbol()
           
 void wakeup(java.lang.Object arg)
          wakeup(): Called by the simulator as a reaction to our own scheduleWakeup()-calls.
 void wakeupAfter(double t_delay)
           
 void write(java.io.PrintWriter ps)
          write the following data to PrintWriter ps: our versionId, the width (n_bits), the default output value (vector), and the default delay.
 
Methods inherited from class hades.simulator.SimObject
constructDynamicSymbol, evaluate, getBindkey, getClassLoader, getDebug, getEditor, getExternalResources, getFullName, getName, getParent, getPort, getPorts, getPropertySheet, 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
evaluate, message
 

Field Detail

n_bits

protected int n_bits

vector

protected StdLogicVector vector

vector_UUU

protected StdLogicVector vector_UUU

vector_XXX

protected StdLogicVector vector_XXX

vector_ZZZ

protected StdLogicVector vector_ZZZ

vector_000

protected StdLogicVector vector_000

vector_111

protected StdLogicVector vector_111

vectorOutputPort

protected PortStdLogicVector vectorOutputPort

delay

protected double delay

defaultdelay

protected double defaultdelay

enableAnimationFlag

protected boolean enableAnimationFlag

valueLabel

protected ColoredValueLabel valueLabel

labelFormatter

protected GenericRtlibObject.FlexibleLabelFormatter labelFormatter

DECIMAL

public static final int DECIMAL
See Also:
Constant Field Values

HEX

public static final int HEX
See Also:
Constant Field Values

BINARY

public static final int BINARY
See Also:
Constant Field Values
Constructor Detail

GenericRtlibObject

public GenericRtlibObject()
construct a generic Rtlib object. This method inializes the basic SimObject with our Port arrays, the default StdLogicVector contants for the 'UUI...U', 'XXX...X'. '000', '111', and disables animation.

Method Detail

constructPorts

protected void constructPorts()

constructStandardValues

protected void constructStandardValues()

getEnableAnimationFlag

public boolean getEnableAnimationFlag()

setEnableAnimationFlag

public void setEnableAnimationFlag(boolean b)

setEnableAnimationFlag

public void setEnableAnimationFlag(java.lang.String s)

getDelay

public double getDelay()

setDelay

public void setDelay(double _delay)

setDelay

public void setDelay(java.lang.String s)

getWidth

public int getWidth()

setWidth

public void setWidth(int _n)

setWidth

public void setWidth(java.lang.String s)

getValue

public long getValue()

setValue

public void setValue(long _value)

setValue

public void setValue(java.lang.String s)

getFormattedValue

public java.lang.String getFormattedValue()
return a String representation of the current "vector" value using the selected number formatting (dec/hex/bin/...). This method is also used for the PropertySheet representation.


setFormattedValue

public void setFormattedValue(java.lang.String s)

scheduleVectorOutputPort

protected void scheduleVectorOutputPort()

setNumberFormat

public void setNumberFormat(int i)
set the number format to one of DECIMAL, BINARY, HEX


setNumberFormat

public void setNumberFormat(java.lang.String s)

getNumberFormat

public int getNumberFormat()

isConnected

public boolean isConnected()

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 SimObject

setSymbol

public void setSymbol(Symbol s)
Overrides:
setSymbol in class SimObject

initValueLabel

protected void initValueLabel()

updateSymbol

public void updateSymbol()

elaborate

public void elaborate(java.lang.Object arg)
elaborate(): This method is called by the simulation engine to initialize this RTLIB object for simulation.

GenericRtlibObject just calls updateSymbol() to initialize its graphical representation. Probably, most RTLIB classes won't need to override this method.

Specified by:
elaborate in interface Simulatable
Overrides:
elaborate in class SimObject

wakeup

public void wakeup(java.lang.Object arg)
wakeup(): Called by the simulator as a reaction to our own scheduleWakeup()-calls. For RTLIB components, a wakeup() is normally used to update the value label on its graphical symbol. A WakeupEvent for this purpose should have either 'null' or the current 'this' object as its payload.

A second use is to update our internal 'vector' variable at a specified simulation time, which is needed to implement the assign() method from interface hades.simulator.Assignable. A WakeupEvent for this purpose is expected to hold a StdLogicVector object (with the 'value' from the assign call) as its payload.

Specified by:
wakeup in interface Wakeable

scheduleAfter

public void scheduleAfter(double t_delay,
                          Port port,
                          java.lang.Object value)
scheduleAfter: an utility method to schedule a SimEvent on the Signal connected to Port "port" with "value" at time "simTime+t_delay". This method checks for NullPointers and may safely be called, even if no simulator is available or if no Signal is connected to port.


scheduleAfter

public void scheduleAfter(double t_delay,
                          Port port,
                          StdLogic1164 value)

wakeupAfter

public void wakeupAfter(double t_delay)

assign

public void assign(java.lang.String value,
                   double simTime)
a default implementation of the assign() method defined in the hades.simulator.Assignable interface. We parse and decode the 'value' string, which is expected to hold a binary-, decimal-, or hex-formatted StdLogicVector value. We then generate and schedule a corresponding simulation event on our outputVectorPort port pin. Finally, we schedule a WakeupEvent for ourselves, which we use to update our internal 'vector' value at the simulation time specified by the call. As we put the decoded StdLogicVector as the payload argument into the WakeupEvent, our wakeup() method is able to distinguish the new (as of 17.07.2002) WakeupEvent from the WakeupEvents used just for updating our (dynamic) graphical symbol.


initialize

public boolean initialize(java.lang.String s)
initialize a RTLIB object from a String which contains the integer version id, the width of this vector, and optionally a String of the desired start value (e.g. "1001 8 01ZXW001" for an 8 bit vector), and optionally the default delay.

Overrides:
initialize in class SimObject

write

public void write(java.io.PrintWriter ps)
write the following data to PrintWriter ps: our versionId, the width (n_bits), the default output value (vector), and the default delay. Hopefully, many RTLIB classes won't need to override write().

Overrides:
write in class SimObject

copy

public SimObject copy()
copy(): This function is used to create a clone of this RTLIB object, including the values for width (n_bits), current value (vector), propagation delay, and version ID.

Overrides:
copy in class SimObject

getToolTip

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

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

toString

public java.lang.String toString()
Description copied from class: SimObject
toString: generate a text description for this SimObject. This method currently combines the class name for the SimObject (or subclass) and its full name in the current Hades Design, e.g. "hades.models.gates.And2: /uut/adder16/adder1/i3".

Overrides:
toString in class SimObject