hades.models.register
Class Register

java.lang.Object
  extended byhades.simulator.SimObject
      extended byhades.models.register.Register
All Implemented Interfaces:
java.lang.Cloneable, ContextToolTip, java.io.Serializable, Simulatable
Direct Known Subclasses:
RegisterR, RegisterRE, ShiftRegister

public class Register
extends SimObject
implements Simulatable, java.io.Serializable

Register - a simple subclass of SimObject that models a n-bit rising-edge triggered, editable D-register without reset or enable. Signals are expected to be StdLogic1164 objects.

See Also:
Serialized Form

Field Summary
protected  StdLogic1164[] data
           
protected  FigCompound display
           
 int h
           
protected  Label[] labels
           
protected  int n_bits
           
protected  Port port_C
           
protected static double t_pass
           
protected static double t_setup
           
protected  StdLogic1164 value_0
           
protected  StdLogic1164 value_1
           
protected  StdLogic1164 value_U
           
protected  StdLogic1164 value_X
           
 int w
           
 
Fields inherited from class hades.simulator.SimObject
classloader, console, debug, editor, name, parent, ports, propertySheet, simulator, symbol, versionId, visible
 
Constructor Summary
Register()
          construct an rising-edge triggered, editable D-Register without reset or enable, using a default width of 4 bits.
 
Method Summary
protected  void addDisplayElementsToSymbol()
          add a graphical elements from 'display' directly to 'symbol', in order to get the layer ordering right.
 void configure()
          create and display a 'ConfigDialog' to set the parameters for a SimObject.
 void constructDynamicSymbol()
           
 SimObject copy()
          copy(): This function is used to create a clone of the current SimObject.
protected  void createGlobalPortSymbols()
           
 void elaborate(java.lang.Object arg)
          elaborate(): This method is called by the simulation engine to initialize the simulation object.
 void evaluate(java.lang.Object arg)
          evaluate(): called by the simulation engine on all events that concern this object.
 int getBitWidth()
           
protected  int getDefaultBitWidth()
           
 double getPassTime()
           
 void initDisplay()
           
 boolean initialize(java.lang.String s)
          initialize a SimObject from a String.
protected  void initPortsAndData()
          the internal utility method to create the array of ports and flipflop values, corresponding to the desired bit-width specified by the global variable n_bits.
 void mousePressed(java.awt.event.MouseEvent me)
          react to a MouseEvent.
 boolean needsDynamicSymbol()
          to support registers of arbitrary width, we need a dynamical Symbol
protected  void removeDisplayElementsFromSymbol()
          currently unused
 void schedule(int bitIndex, double time)
           
 void setBitWidth(int n_new)
          try to set a new width for this register.
 void setBitWidth(java.lang.String s)
           
 void setPassTime(double t)
           
 void setPassTime(java.lang.String s)
           
 void setSymbol(Symbol s)
           
 void show()
           
protected  boolean showDInputPorts()
           
 java.lang.String toString()
          toString() - the usual info method
 void write(java.io.PrintWriter ps)
           
 
Methods inherited from class hades.simulator.SimObject
getBindkey, getClassLoader, getDebug, getEditor, getExternalResources, getFullName, getName, getParent, getPort, getPorts, getPropertySheet, getResourceAsStream, getSimulator, getSymbol, getSymbolResourceName, getToolTip, getVersionId, isVisible, keyPressed, message, 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

n_bits

protected int n_bits

port_C

protected Port port_C

value_U

protected StdLogic1164 value_U

value_X

protected StdLogic1164 value_X

value_0

protected StdLogic1164 value_0

value_1

protected StdLogic1164 value_1

data

protected StdLogic1164[] data

labels

protected Label[] labels

display

protected FigCompound display

t_pass

protected static double t_pass

t_setup

protected static double t_setup

w

public final int w
See Also:
Constant Field Values

h

public final int h
See Also:
Constant Field Values
Constructor Detail

Register

public Register()
construct an rising-edge triggered, editable D-Register without reset or enable, using a default width of 4 bits.

The width can be changed later in the 'initialize' method or interactively using the 'PropertySheet' dialog.

Method Detail

getDefaultBitWidth

protected int getDefaultBitWidth()

showDInputPorts

protected boolean showDInputPorts()

initPortsAndData

protected void initPortsAndData()
the internal utility method to create the array of ports and flipflop values, corresponding to the desired bit-width specified by the global variable n_bits.

A register uses n_bits inputs, n_bits outputs, and one clock input.


getBitWidth

public int getBitWidth()

setBitWidth

public void setBitWidth(int n_new)
try to set a new width for this register. Useful values are in the range 1 .. 64.


setBitWidth

public void setBitWidth(java.lang.String s)

needsDynamicSymbol

public boolean needsDynamicSymbol()
to support registers of arbitrary width, we need a dynamical Symbol

Overrides:
needsDynamicSymbol in class SimObject

constructDynamicSymbol

public void constructDynamicSymbol()
Overrides:
constructDynamicSymbol in class SimObject

initialize

public boolean initialize(java.lang.String s)
Description copied from class: SimObject
initialize a SimObject from a String. The method returns true once all required data has been read. Until then, you should repeatedly call initialize() with additional Strings.

Overrides:
initialize in class SimObject

write

public void write(java.io.PrintWriter ps)
Overrides:
write in class SimObject

getPassTime

public double getPassTime()

setPassTime

public void setPassTime(double t)

setPassTime

public void setPassTime(java.lang.String s)

setSymbol

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

initDisplay

public void initDisplay()

createGlobalPortSymbols

protected void createGlobalPortSymbols()

addDisplayElementsToSymbol

protected void addDisplayElementsToSymbol()
add a graphical elements from 'display' directly to 'symbol', in order to get the layer ordering right.


removeDisplayElementsFromSymbol

protected void removeDisplayElementsFromSymbol()
currently unused


show

public void show()

mousePressed

public void mousePressed(java.awt.event.MouseEvent me)
Description copied from class: SimObject
react to a MouseEvent. The base SimObject ignores MouseEvents.

Note that the HADES schematic editor will also deliver jfig.canvas.FigCanvasEvent object, which also include the world-coordinates of the Event.

Overrides:
mousePressed in class SimObject

elaborate

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

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

evaluate

public void evaluate(java.lang.Object arg)
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

schedule

public void schedule(int bitIndex,
                     double time)

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

copy

public SimObject copy()
Description copied from class: SimObject
copy(): This function is used to create a clone of the current SimObject.

I am not yet sure about the correct and best semantic for copy(). Currently a new object of the current class is created by calling the default constructor.

Overrides:
copy in class SimObject

toString

public java.lang.String toString()
toString() - the usual info method

Overrides:
toString in class SimObject