import byucc.jhdl.apps.Viewers.Waves.*;
public class my_class extends
pelca implements WireWatcherListener {
.
.
.
static final String[]
wiresToWatch = {
/* Here you
include the full name and path
(as it appears in Jab) of all the wires
you wish to watch */
}
.
.
.
public my_class(pe parent)
{
super (parent);
.
.
.
HWSystem
hw = (HWSystem)parent.getHardwareSystem();
Wire[] myWire
= new Wire[wiresToWatch.length];
for(int
i=0;i<wiresToWatch.length;i++) {
myWire[i] = (Wire)hw.findNamed(wiresToWatch[i]);
if ( myWire[i] == null ) {
System.out.println("\nWire named "
+ wiresToWatch[i] +
" does not exist.\nExiting ...\n");
System.exit(1);
}
}
new WireWatcher(this,
myWire);
You also have to declare the following two methods in your class:
public void observerUpdate( Object data[] ) {
/* This method gets called at
the end of each cycle.
The
data[] variable enables you to access the value
of
each of the wires you are watching. Here's an
example
of how to use it... */
outFile.println("\nCycle:
" + cycles);
for(int
i=0;i<data.length;i++) {
long temp = ((Long)data[i]).longValue();
outFile.println(wiresToWatch[i] + ": "
+ Long.toHexString(temp));
}
cycles++;
}
public void observerReset() {
/* This guy gets called during reset. */
}
Created: October 28, 1999 by Tim Wheeler