hades.signals
Class SignalStdLogicVector

java.lang.Object
  extended byhades.signals.Signal
      extended byhades.signals.SignalStdLogicVector
All Implemented Interfaces:
ColorSource, ContextToolTip, java.io.Serializable, Simulatable

public class SignalStdLogicVector
extends Signal

SignalStdLogicVector - a class that models an IEEE StdLogicVector Signal

A SignalStdLogicVector contains a reference to a StdLogicVector of fixed width, which is initially null (for an so far unconnected Signal). After the first connection has been made, the width of this Signal can never be changed - except by direct editing of the .hds Design file.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class hades.signals.Signal
debug, design, DFS, driverValues, EA, glowMode, isRoot, label, lastChangeTime, lastValue, name, portPositionTable, probe, probeSymbol, receivers, segments, senders, simulator, solderDots, st, VA, value, vertexTable, VI, visible, visited
 
Constructor Summary
SignalStdLogicVector()
           
SignalStdLogicVector(java.lang.String name)
           
SignalStdLogicVector(java.lang.String name, Port[] senders, Port[] receivers)
           
 
Method Summary
 void addSegment(WireSegment ws)
          add a new segment to this Signal: override the base class method to set new WireSegment attributes (color and line width)
 boolean addSender(Port p)
          add a new driver for this Signal and initialize its default driving value to 'StdLogicVector._U'.
 void animate()
          called after the value of this Signal changed.
 void animateOLD()
           
 boolean canConnect(Port port)
          check whether this Signal can be connected to Port port.
 boolean canMerge(Signal signal)
           
 void connect(Port p)
          connect this Signal to Port p.
 void elaborate(java.lang.Object arg)
          initialize this Signal: first, call Signal.elaborate() for the general initialization.
 void evaluate(java.lang.Object arg)
          evaluate
 void extractDriverValue(java.lang.Object arg)
          extractDriverValue(): check that Object "arg" is a SimEvent, then extract the sender port and the new value of the sender.
 java.awt.Color getColor()
          get the color to be used for drawing the WireSegments and SolderDots for this Signal during animation.
static Signal getDefaultValue()
           
 java.lang.String getToolTip(java.awt.Point position, long millis)
          construct a (short) tool tip message for a SignalStdLogicVector.
 int getWidth()
           
 void handleGlowMode()
          do whatever is necessary to update our graphical representation when the glow mode state changed...
 boolean hasFallingEdge()
           
 boolean hasRisingEdge()
           
protected  void parseWidth()
           
 void readFromString(java.lang.String line, Design design)
          parse a SignalStdLogicVector from a .hds design file.
 java.lang.Object resolve()
           
 void setValue(java.lang.Object o)
           
 void setValue(java.lang.String s)
           
 void setWidth(int n_bits)
           
 void writeAsResource(java.io.PrintWriter ps)
          writeAsResource(): write a Signal to a text-file.
 
Methods inherited from class hades.signals.Signal
addReceiver, addSolderDot, buildEdgeVectors, buildVertexArrays, countSegments, countSendersAndReceivers, countSubgraphs, createLabel, createPortPositionTable, createVertexTable, dbg, deleteReceiver, deleteSegment, deleteSender, deleteSingularSegments, DFS, disconnect, disconnectAll, getDebug, getDesign, getDriverValues, getFullName, getGlowMode, getLabel, getLastChangeTime, getName, getPreviousValue, getProbe, getProbeSymbol, getReceivers, getSegments, getSenders, getSimulator, getSolderDots, getValue, getVertexTable, getVisible, hasEvent, hasProbe, isConnected, isPortPosition, isStable, isVertex, isVisible, merge, message, moveLabelTo, numberOfDrivers, parseName, parsePorts, parseSegments, parseSolderDots, printDFS, printGraph, printPortPositionTable, printSegments, printVertexTable, propagateConnectivityChanges, rebuildSolderDots, removeProbe, renameAfterDriver, setDebug, setDesign, setGlowMode, setName, setProbe, setProbeSymbol, setSimulator, setTrafo, setVisible, showInternalWireSegments, splitIntoSubgraphs, tearDown, toString, toStringVerbose, toStringVerboseOld, write, writePorts, writeSegments, writeSolderDots
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SignalStdLogicVector

public SignalStdLogicVector()

SignalStdLogicVector

public SignalStdLogicVector(java.lang.String name)

SignalStdLogicVector

public SignalStdLogicVector(java.lang.String name,
                            Port[] senders,
                            Port[] receivers)
Method Detail

getWidth

public int getWidth()

setWidth

public void setWidth(int n_bits)

getDefaultValue

public static Signal getDefaultValue()

canConnect

public boolean canConnect(Port port)
check whether this Signal can be connected to Port port. This is impossible, if either port is already connected to another signal, or if there is a type or value (e.g. bus width) mismatch between this Signal's type and the type expected by the port.

Overrides:
canConnect in class Signal

canMerge

public boolean canMerge(Signal signal)
Overrides:
canMerge in class Signal

connect

public void connect(Port p)
connect this Signal to Port p. This will automatically add P as a sender or receiver, depending on the I/O-type of Port p.

Overrides:
connect in class Signal

addSender

public boolean addSender(Port p)
add a new driver for this Signal and initialize its default driving value to 'StdLogicVector._U'.

Overrides:
addSender in class Signal
See Also:
Signal.addSender(hades.simulator.Port)

addSegment

public void addSegment(WireSegment ws)
add a new segment to this Signal: override the base class method to set new WireSegment attributes (color and line width)

Overrides:
addSegment in class Signal

setValue

public void setValue(java.lang.Object o)
Overrides:
setValue in class Signal

setValue

public void setValue(java.lang.String s)
Overrides:
setValue in class Signal

getColor

public java.awt.Color getColor()
get the color to be used for drawing the WireSegments and SolderDots for this Signal during animation. This method is required to implement the ColorSource interface. In this class, we always return Color.blue, but subclasses should override this method as needed.

Specified by:
getColor in interface ColorSource
Overrides:
getColor in class Signal

elaborate

public void elaborate(java.lang.Object arg)
initialize this Signal: first, call Signal.elaborate() for the general initialization. Then set our lastValue to null, the current value to _U, and all driverValues to _U as well.

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

evaluate

public void evaluate(java.lang.Object arg)
evaluate

Specified by:
evaluate in interface Simulatable
Overrides:
evaluate in class Signal
Parameters:
arg - An object with the new value for this signal.

handleGlowMode

public void handleGlowMode()
do whatever is necessary to update our graphical representation when the glow mode state changed... We request a paint() for all WireSegments and SolderDots, whose colors are updated on their next asynchronous refresh via the ColorSource interface and our getColor() method.

Overrides:
handleGlowMode in class Signal

animate

public void animate()
called after the value of this Signal changed. If glowMode is active, update all WireSegments and SolderDots belonging to this Signal. We request a paint() for all WireSegments and SolderDots, whose colors are updated on their next asynchronous refresh via the ColorSource interface and our getColor() method.


animateOLD

public void animateOLD()

hasRisingEdge

public boolean hasRisingEdge()

hasFallingEdge

public boolean hasFallingEdge()

extractDriverValue

public void extractDriverValue(java.lang.Object arg)
extractDriverValue(): check that Object "arg" is a SimEvent, then extract the sender port and the new value of the sender. Finally, set the driverValue (and time) for the sender port.


resolve

public java.lang.Object resolve()

writeAsResource

public void writeAsResource(java.io.PrintWriter ps)
writeAsResource(): write a Signal to a text-file. This method uses the following data format, where all values are concatenated on one single line seperated by blanks:
     classname
     signalname
     n_ports [instancename portname]**n_ports
     n_segments [n_points [xi yi]**n_points ]**n_segments
     n_solders [xi yi]**n_solders
    
The following example describes a Signal of type "SignalStdLogic1164" with name "n2", two connections to port "Y" on instance "i6" and port "A" on instance "i7". The signal has only one wire-segment which runs from point (27600, 15600) to point (30000 15600) and zero solder dots: "hades.signals.SignalStdLogic1164 n2 2 i6 Y i7 A 1 2 27600 15600 30000 1560 0 0 "

Overrides:
writeAsResource in class Signal

readFromString

public void readFromString(java.lang.String line,
                           Design design)
parse a SignalStdLogicVector from a .hds design file. Note that this method directly accesses the Design and StringTokenizer of class Signal.

Overrides:
readFromString in class Signal

parseWidth

protected void parseWidth()

getToolTip

public java.lang.String getToolTip(java.awt.Point position,
                                   long millis)
construct a (short) tool tip message for a SignalStdLogicVector. We show the Signal class, the Signal name, it's width, and the current value (if any).

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