|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthades.signals.Signal
Signal - the base class for all hades simulation signals. All SimObjects are connected via subclasses of Signal, e.g. 'hades.signal.Std_logic_1164'. This class is _not_ used to draw the Signal. Both senders and receivers of this signals are kept in arrays (instead of lists or vectors), because we want fastest read-access. Insertion and deletions of senders/receivers are rare events.
A Signal is expected to belong to some Design, to allow for hierarchical netlist.
Field Summary | |
protected static boolean |
debug
|
protected Design |
design
|
protected int[] |
DFS
|
protected java.lang.Object[] |
driverValues
|
protected java.util.Vector[] |
EA
|
protected boolean |
glowMode
|
protected boolean[] |
isRoot
|
protected Label |
label
|
protected double |
lastChangeTime
|
protected java.lang.Object |
lastValue
|
protected java.lang.String |
name
|
protected java.util.Hashtable |
portPositionTable
|
protected Waveform |
probe
|
protected ProbeSymbol |
probeSymbol
|
protected Port[] |
receivers
|
protected WireSegment[] |
segments
|
protected Port[] |
senders
|
protected SimKernel |
simulator
|
protected SolderDot[] |
solderDots
|
protected java.util.StringTokenizer |
st
|
protected java.awt.Point[] |
VA
|
protected java.lang.Object |
value
|
protected java.util.Hashtable |
vertexTable
|
protected java.util.Hashtable |
VI
|
protected boolean |
visible
|
protected boolean[] |
visited
|
Constructor Summary | |
Signal()
create an (abstract) Signal |
|
Signal(java.lang.String name)
create an (abstract) Signal called 'name' |
|
Signal(java.lang.String name,
Port[] senders,
Port[] receivers)
create an (abstract) Signal called 'name' with given senders and receivers |
Method Summary | |
boolean |
addReceiver(Port p)
add a new receiver to this Signal |
void |
addSegment(WireSegment ws)
add a new segment to this Signal. |
boolean |
addSender(Port p)
add a new sender to this Signal |
void |
addSolderDot(SolderDot sd)
|
void |
buildEdgeVectors()
|
void |
buildVertexArrays()
construct an array VA[i] to reference signal vertices via an index |
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. |
int |
countSegments()
|
int |
countSendersAndReceivers()
|
int |
countSubgraphs()
|
protected void |
createLabel()
|
void |
createPortPositionTable()
build the portPositionTable for this Signal. |
void |
createVertexTable()
create and initialize a Hashtable to represent all vertices of the Signal graph. |
void |
dbg(java.lang.String s)
|
boolean |
deleteReceiver(Port p)
delete a receiver from this Signal |
void |
deleteSegment(WireSegment ws)
|
boolean |
deleteSender(Port p)
delete a sender from this Signal |
void |
deleteSingularSegments()
|
void |
DFS()
create a depth-first-search numbering of the Signal graph in the array DFS[]; A negative index indicates the start of a new connected component of the Signal graph. |
void |
disconnect(Port p)
|
void |
disconnectAll()
|
void |
elaborate(java.lang.Object arg)
elaborate(): called at the start of the simulation to initialize this signal. |
void |
evaluate(java.lang.Object arg)
evaluate(). |
java.awt.Color |
getColor()
get the color to be used for drawing the WireSegments and SolderDots for this Signal during animation. |
static boolean |
getDebug()
|
Design |
getDesign()
|
java.lang.Object[] |
getDriverValues()
|
java.lang.String |
getFullName()
|
boolean |
getGlowMode()
|
Label |
getLabel()
|
double |
getLastChangeTime()
|
java.lang.String |
getName()
|
java.lang.Object |
getPreviousValue()
|
Waveform |
getProbe()
|
ProbeSymbol |
getProbeSymbol()
|
Port[] |
getReceivers()
|
FigObject[] |
getSegments()
|
Port[] |
getSenders()
|
SimKernel |
getSimulator()
|
FigObject[] |
getSolderDots()
|
java.lang.String |
getToolTip(java.awt.Point position,
long millis)
construct a (short) tool tip message for a Signal. |
java.lang.Object |
getValue()
|
java.util.Hashtable |
getVertexTable()
return the vertexTable for this Signal, which may be null. |
boolean |
getVisible()
|
void |
handleGlowMode()
do whatever is necessary to update our graphical representation when the glow mode state changed. |
boolean |
hasEvent()
|
boolean |
hasProbe()
|
boolean |
isConnected(Port port)
|
boolean |
isPortPosition(java.awt.Point p)
|
boolean |
isStable(double dt)
|
boolean |
isVertex(java.awt.Point p)
|
boolean |
isVisible()
|
void |
merge(Signal victim)
merge this Signal with Signal victim: we add all senders, receivers, and wire segments from victim to our own data structares. |
void |
message(java.lang.String msg)
message(): print or display an information message |
protected void |
moveLabelTo(java.awt.Point p)
|
int |
numberOfDrivers()
|
void |
parseName()
|
protected void |
parsePorts()
phase 1: parse the 'ports' part of this Signal. |
protected void |
parseSegments()
phase 2 parse the segments, if visible |
protected void |
parseSolderDots()
phase 3: parse the solder dots, if visible |
void |
printDFS()
|
void |
printGraph()
|
void |
printPortPositionTable()
|
void |
printSegments()
|
void |
printVertexTable()
print the contents of the vertexTable. |
void |
propagateConnectivityChanges()
this method is called from the connect() and disconnect() methods to inform all senders/receivers of this Signal of any interactive changes made to the Signal connectivity status. |
void |
readFromString(java.lang.String line,
Design design)
|
void |
rebuildSolderDots()
an utility method to rebuild the array with all SolderDots on this Signal. |
void |
removeProbe()
|
java.lang.String |
renameAfterDriver()
rename this signal after the component and port driving the signal, and return the resulting name, too. |
static void |
setDebug(boolean d)
|
void |
setDesign(Design d)
|
void |
setGlowMode(boolean b)
|
void |
setName(java.lang.String _name)
|
void |
setProbe(Waveform w)
|
void |
setProbeSymbol(ProbeSymbol ps)
|
void |
setSimulator(SimKernel simulator)
|
void |
setTrafo(FigTrafo2D trafo)
set a new transformation for the graphical display of this Signals segments and solder dots. |
void |
setValue(java.lang.Object o)
|
void |
setValue(java.lang.String s)
|
void |
setVisible(boolean v)
|
void |
showInternalWireSegments(boolean visible)
show (or hide) the 'internal' WireSegments of this Signal, that is, all WireSegments that are not directly connected to SimObject Port. |
Signal[] |
splitIntoSubgraphs()
split a Signal into its connected subgraphs, and return an Array with references to these subgraph Signals. |
void |
tearDown()
clear all references held by this signal. |
java.lang.String |
toString()
toString() - the usual info method |
java.lang.String |
toStringVerbose()
|
java.lang.String |
toStringVerboseOld()
|
void |
write(java.io.PrintWriter ps)
|
void |
writeAsResource(java.io.PrintWriter ps)
writeAsResource(): write a Signal to a text-file. |
protected void |
writePorts(java.io.PrintWriter ps)
number of ports, instance-names of connected components with port names. |
protected void |
writeSegments(java.io.PrintWriter ps)
write the number of segments, then the segment coordinates for the graphical representation of this Signal |
void |
writeSolderDots(java.io.PrintWriter ps)
write the number and position of all SolderDots for the graphical representation of this Signal |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected SimKernel simulator
protected Port[] receivers
protected Port[] senders
protected java.lang.Object[] driverValues
protected Design design
protected java.lang.String name
protected java.lang.Object value
protected java.lang.Object lastValue
protected double lastChangeTime
protected boolean visible
protected WireSegment[] segments
protected SolderDot[] solderDots
protected boolean glowMode
protected Label label
protected ProbeSymbol probeSymbol
protected Waveform probe
protected java.util.StringTokenizer st
protected static boolean debug
protected java.util.Hashtable vertexTable
protected java.util.Hashtable portPositionTable
protected java.util.Hashtable VI
protected java.awt.Point[] VA
protected java.util.Vector[] EA
protected boolean[] visited
protected boolean[] isRoot
protected int[] DFS
Constructor Detail |
public Signal()
public Signal(java.lang.String name)
public Signal(java.lang.String name, Port[] senders, Port[] receivers)
Method Detail |
public Design getDesign()
public void setDesign(Design d)
public static boolean getDebug()
public static void setDebug(boolean d)
public SimKernel getSimulator()
public void setSimulator(SimKernel simulator)
public Port[] getReceivers()
public Port[] getSenders()
public java.lang.Object[] getDriverValues()
public int countSendersAndReceivers()
public int numberOfDrivers()
public boolean hasProbe()
public Waveform getProbe()
public void setProbe(Waveform w)
public void removeProbe()
public void setProbeSymbol(ProbeSymbol ps)
public ProbeSymbol getProbeSymbol()
public java.awt.Color getColor()
getColor
in interface ColorSource
public boolean getVisible()
public boolean isVisible()
public void setVisible(boolean v)
public Label getLabel()
protected void createLabel()
protected void moveLabelTo(java.awt.Point p)
public FigObject[] getSegments()
public int countSegments()
public FigObject[] getSolderDots()
public void addSegment(WireSegment ws)
public void addSegment( WireSegment ws ) { super.addSegment( ws ); ws.getAttributes().lineWidth = 160; }
public void printSegments()
public void deleteSegment(WireSegment ws)
public void addSolderDot(SolderDot sd)
public void setTrafo(FigTrafo2D trafo)
public java.lang.Object getValue()
public void setValue(java.lang.Object o)
public void setValue(java.lang.String s)
public java.lang.Object getPreviousValue()
public double getLastChangeTime()
public boolean isStable(double dt)
public boolean hasEvent()
public void setName(java.lang.String _name)
public java.lang.String getName()
public java.lang.String getFullName()
public java.lang.String renameAfterDriver()
Note that this method does not check whether the resulting name is unique in its Design. We assume that the component names in the Design are unique too, as well as the component port names...
As a special exception, we check whether the driving component is a hades.models.io.Ipin. If so, we rename the signal to the same name as the Ipin (without the ".Y").
If the signal has no driver, this method does not modify the signal name.
public void setGlowMode(boolean b)
public boolean getGlowMode()
public void handleGlowMode()
public boolean canConnect(Port port)
public boolean canMerge(Signal signal)
public boolean isConnected(Port port)
public void connect(Port p)
public void disconnect(Port p)
public void disconnectAll()
public void propagateConnectivityChanges()
For example, we want to propagate the current Signal value to a newly added receiver port, in order to avoid additional simulation restarts.
Note that this method should not generate additional SimEvents during simulation startup.
public boolean addSender(Port p)
public boolean deleteSender(Port p)
public boolean addReceiver(Port p)
public boolean deleteReceiver(Port p)
public void elaborate(java.lang.Object arg)
elaborate
in interface Simulatable
arg
- an arbitrary argumentpublic void evaluate(java.lang.Object arg)
evaluate
in interface Simulatable
arg
- An object with the new value for this signal.public void message(java.lang.String msg)
Simulatable
message
in interface Simulatable
public void write(java.io.PrintWriter ps)
public java.lang.String toString()
public java.lang.String toStringVerboseOld()
public java.lang.String toStringVerbose()
public java.lang.String getToolTip(java.awt.Point position, long millis)
getToolTip
in interface ContextToolTip
public void tearDown()
public void writeAsResource(java.io.PrintWriter ps)
classname signalname n_ports [instancename portname]**n_ports n_segments [n_points [xi yi]**n_points ]**n_segments n_solders [xi yi]**n_soldersThe 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 "
protected void writePorts(java.io.PrintWriter ps) throws java.lang.Exception
java.lang.Exception
protected void writeSegments(java.io.PrintWriter ps) throws java.lang.Exception
java.lang.Exception
public void writeSolderDots(java.io.PrintWriter ps) throws java.lang.Exception
java.lang.Exception
public void readFromString(java.lang.String line, Design design)
public void parseName()
protected void parsePorts()
protected void parseSegments()
protected void parseSolderDots()
public java.util.Hashtable getVertexTable()
public void createVertexTable()
Note that it is trivial to rebuild the SolderDot array from the vertexTable.
public void deleteSingularSegments()
public void printVertexTable()
public boolean isVertex(java.awt.Point p)
public void createPortPositionTable()
This method retrieves the positions of all Ports this Signal is connected to, and enters them to the portPositionTable.
Currently, the portPositionTable is only used to rebuild the SolderDots on a Signal, because we want a SolderDot on all vertices with more than three edges, but also on port vertices with two edges.
public boolean isPortPosition(java.awt.Point p)
public void printPortPositionTable()
public void buildVertexArrays()
public void buildEdgeVectors()
public void DFS()
See Sedgewick, algorithms in c++, Addison-Wesley for a description of the algorithm.
public void printDFS()
public void printGraph()
public int countSubgraphs()
public Signal[] splitIntoSubgraphs()
Note that this method does not reconstruct the Editor's objectList. Also note that this method expects that the Signal connectivity graph has already been constructed, e.g. by calling DFS().
Also note that we can safely assume that the Signal in question is visible. This is because splitIntoSubgraphs is only called in reaction to user-interaction on the editor canvas, which implies that the "this" signal is currently visible. This in turn means that we call setVisible() on all splitter signals, which fixes an important editor GUI bug.
public void dbg(java.lang.String s)
public void rebuildSolderDots()
Note that you will have to rebuild the editor's object list before the changes to this Signal will be visible. Typically, you might use something like the following code:
signal.rebuildSolderDots(); editor.deleteFromObjectList( signal ); editor.insertIntoObjectList( signal ); editor.doRedraw();
public void merge(Signal victim)
public void showInternalWireSegments(boolean visible)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |