1 package edu.berkeley.fleet.dataflow;
2 import edu.berkeley.fleet.loops.*;
3 import java.util.concurrent.Semaphore;
6 import edu.berkeley.fleet.two.*;
7 import edu.berkeley.fleet.api.*;
8 import edu.berkeley.fleet.fpga.*;
9 import edu.berkeley.fleet.api.Instruction.*;
10 import edu.berkeley.fleet.api.Instruction.Set;
11 import edu.berkeley.fleet.api.Instruction.Set.*;
12 import static edu.berkeley.fleet.api.Predicate.*;
13 import static edu.berkeley.fleet.util.BitManipulations.*;
15 // does peer.recvWord() have to honor the currently-set predicate?
17 // public class ReplaceNode extends Node { }
18 // public class CountMergeNode extends Node { }
19 // public class SortMergeNode extends Node { }
20 // public class FanOutNode extends Node { }
21 // public class MemoryNode extends Node { }
22 // public class DoneNode extends Node { }
24 public class DataFlowGraph {
26 public final Fleet fleet;
27 public final ShipPool pool;
29 public DataFlowGraph(Fleet fleet) {
30 this(fleet, new ShipPool(fleet));
32 public DataFlowGraph(Fleet fleet, ShipPool pool) {
37 public static int reset_count = 0;
38 public static HashSet<Dock> torpedoes = new HashSet<Dock>();
40 private HashSet<Node> nodes = new HashSet<Node>();
42 public void build(Context ctx) {
46 public void reset(Context ctx, int phase, Destination ackDestination) {
50 mod.reset(ctx, phase, ackDestination);
55 void doReset(Context ctx, int phase, Dock dock, Port peer, Destination ackDestination, boolean peerUsed) {
56 if (dock.getShip().getType().equals("Debug")) return;
60 // Phase 0: torpedo every output dock, put it in
61 // collecting mode. Cannot combine with phase 1,
62 // because until output docks are in vacuum mode we
63 // cannot be sure that the tokens to the input docks
64 // will eventually succeed. This may cause the
65 // instructions sent after the tokens to back up into
68 if (!dock.isInputDock()) {
70 LoopFactory lf = new LoopFactory(ctx, dock, 1);
71 lf.sendToken(ackDestination);
73 lf.abortLoopIfTorpedoPresent();
80 // Phase 1: torpedo every input dock, put it in loopback mode
82 if (dock.isInputDock()) {
84 LoopFactory lf = new LoopFactory(ctx, dock, 1);
85 lf.sendToken(ackDestination);
87 // FIXME: this won't work right for ports that
88 // get "shared" by two senders (for example,
91 if (peerUsed && peer!=null) {
93 lf.abortLoopIfTorpedoPresent();
94 ((OutPort)peer).recvWord(lf);
95 ((OutPort)peer).sendToken(lf);
102 // Phase 2: torpedo every output dock, have it absorb tokens
104 if (!dock.isInputDock()) {
106 LoopFactory lf = new LoopFactory(ctx, dock, 1);
108 for(int i=0; i<((InPort)peer).getTokensToAbsorb(); i++)
110 lf.sendToken(ackDestination);
116 // Phase 3: torpedo every input dock, and we're done
118 if (dock.isInputDock()) {
119 if (peerUsed && peer!=null) {
122 LoopFactory lf = new LoopFactory(ctx, dock, 1);
123 lf.sendToken(ackDestination);
134 DataFlowGraph.this.nodes.add(this);
137 private HashMap<String,Port> ports = new HashMap<String,Port>();
139 public InPort getInPort(String name) { return (InPort)ports.get(name); }
140 public OutPort getOutPort(String name) { return (OutPort)ports.get(name); }
142 public void build(Context ctx) { for(Port p : ports.values()) p.build(ctx); }
143 public void reset(Context ctx, int phase, Destination ackDestination) {
144 for(Port p : ports.values()) p.reset(ctx, phase, ackDestination);
147 public abstract class Port {
148 public final String name;
149 public Port(String name) {
151 if (Node.this.ports.get(name)!=null) throw new RuntimeException();
152 Node.this.ports.put(name,this);
154 public abstract void build(Context ctx);
155 public abstract void reset(Context ctx, int phase, Destination ackDestination);
158 public abstract class InPort extends Port {
160 public InPort(String name) { super(name); }
161 public void connect(OutPort peer) {
165 public void setPeer(OutPort peer) {
166 if (this.peer!=null) throw new RuntimeException("cannot call setPeer() twice");
170 /** this port's peer (an OutPort) invokes this to have "recvToken" or equivalent inserted */
171 public abstract void recvToken(LoopFactory loopfactory_at_output_dock);
172 /** this port's peer (an OutPort) invokes this to have "sendWord" or equivalent inserted */
173 public abstract void sendWord(LoopFactory loopfactory_at_output_dock);
175 public int getTokensToAbsorb() { return 0; }
178 public abstract class OutPort extends Port {
180 public OutPort(String name) { super(name); }
181 public void connect(InPort peer) {
185 public void setPeer(InPort peer) {
186 if (this.peer!=null) throw new RuntimeException("cannot call setPeer() twice");
190 /** this port's peer (an InPort) invokes this to have "sendToken" or equivalent inserted */
191 public abstract void sendToken(LoopFactory loopfactory_at_input_dock);
192 /** this port's peer (an InPort) invokes this to have "recvWord" or equivalent inserted */
193 public abstract void recvWord(LoopFactory loopfactory_at_input_dock);
196 public final class DockInPort extends InPort {
200 public DockInPort(String name, Dock dock) { this(name, dock, 0); }
201 public DockInPort(String name, Dock dock, int count) { this(name, dock, count, new BitVector[] { null }); }
202 public DockInPort(String name, Dock dock, int count, BitVector[] pattern) {
206 this.pattern = pattern;
208 public void recvToken(LoopFactory lf) { lf.recvToken(); }
209 public void sendWord(LoopFactory lf) { lf.sendWord(dock.getDataDestination()); }
210 public void build(Context ctx) { build(ctx, new LoopFactory(ctx, dock, 1)); }
211 // number-in-flight is considered a property of the input dock in a pair
212 public int getInflight() { return 4; }
213 //public int getInflight() { return 1; }
214 public int getTokensToAbsorb() { return getInflight(); }
215 private boolean peerUsed() {
216 if (peer==null) return false;
217 for(int i=0; i<pattern.length; i++) if (pattern[i]==null) return true;
220 public void reset(Context ctx, int phase, Destination ackDestination) {
221 doReset(ctx, phase, dock, peer, ackDestination, peerUsed());
223 protected void build(Context ctx, LoopFactory lf) {
224 int inflight = (count != 0 && count < getInflight()) ? count : getInflight();
227 for(int i=0; i<inflight; i++) peer.sendToken(lf);
229 lf = lf.makeNext(count, true);
230 for(int i=0; i<pattern.length; i++) {
231 if (pattern[i]==null) {
233 lf.abortLoopIfTorpedoPresent();
238 lf.interruptibleNop();
241 lf.literal(pattern[i]);
242 lf.abortLoopIfTorpedoPresent();
248 // "torpedoable nop" to keep the dock in a receptive state
249 lf.abortLoopIfTorpedoPresent();
253 public BitVector getConstant(String constantName) {
254 return dock.getConstant(constantName);
258 public /*final*/ class DockOutPort extends OutPort {
259 public final Dock dock;
260 public final int count;
261 public DockOutPort(String name, Dock dock) { this(name, dock, 0); }
262 public DockOutPort(String name, Dock dock, int count) { super(name); this.dock = dock; this.count = count; }
263 public void sendToken(LoopFactory lf) { lf.sendToken(dock.getDataDestination()); }
264 public void recvWord(LoopFactory lf) { lf.recvWord(); }
265 public void build(Context ctx) { build(ctx, new LoopFactory(ctx, dock, 1)); }
266 protected void build(Context ctx, LoopFactory lf) {
267 if (peer==null) return;
268 lf = lf.makeNext(count);
269 lf.abortLoopIfTorpedoPresent();
274 public void reset(Context ctx, int phase, Destination ackDestination) {
275 doReset(ctx, phase, dock, peer, ackDestination, true);
280 private BitVector bv(long l) { return new BitVector(/*FIXME fleet.getWordWidth()*/37).set(l); }
281 private BitVector[] bv(long[] l) {
282 BitVector[] ret = new BitVector[l.length];
283 for(int i=0; i<ret.length; i++) ret[i] = bv(l[i]);
288 * Deliver the constant at out forever. Flow control in<->out is
289 * maintained, but out is not flow-controlled, so be sure
290 * that every datum sent there is consumed synchronously wiht
291 * data items sent to out.
293 public class ForeverNode extends Node {
294 private BitVector bv;
295 public final OutPort out = new OutPort("out") {
296 public void sendToken(LoopFactory lf) { }
297 public void recvWord(LoopFactory lf) { }
298 public void build(Context ctx) { }
299 public void reset(Context ctx, int phase, Destination ackDestination) { }
300 public void setPeer(InPort peer) {
302 DockInPort pip = ((DockInPort)peer);
303 for(int i=0; i<pip.pattern.length; i++) {
304 if (pip.pattern[i]==null)
309 public ForeverNode(long l) { this(new BitVector(fleet.getWordWidth()).set(l)); }
310 public ForeverNode(final BitVector bv) { this.bv = bv; }
313 public class OnceNode extends Node {
314 private BitVector bv;
315 public final OutPort out = new OutPort("out") {
316 public void sendToken(LoopFactory lf) { }
317 public void recvWord(LoopFactory lf) { }
318 public void build(Context ctx) { }
319 public void reset(Context ctx, int phase, Destination ackDestination) { }
320 public void setPeer(InPort peer) {
322 DockInPort pip = ((DockInPort)peer);
323 BitVector[] pip_pattern = pip.pattern;
324 BitVector[] temp = new BitVector[pip_pattern.length * 2];
327 boolean done = false;
328 // FIXME: if peer.count is already 1, this gets simpler and different
329 for(i=0; i<temp.length; i++) {
330 if (pip_pattern[j] != null) {
331 temp[i] = pip_pattern[j];
338 if (j >= pip_pattern.length) j = 0;
340 pip.pattern = new BitVector[i];
341 System.arraycopy(temp, 0, pip.pattern, 0, i);
345 public OnceNode(long l) { this(new BitVector(fleet.getWordWidth()).set(l)); }
346 public OnceNode(final BitVector bv) { this.bv = bv; }
349 public class DebugNode extends Node {
350 public final Ship ship = pool.allocateShip("Debug");
351 public final InPort in = new DockInPort("in", ship.getDock("in"));
352 // NOTE: shutdown needs to treat this specially
353 public DebugNode() { }
356 public class UnPunctuatorNode extends Node {
357 private final Ship ship = pool.allocateShip("Counter");
358 public final OutPort out = new DockOutPort("out", ship.getDock("out"));
359 public final InPort val = new DockInPort("in1", ship.getDock("in1"));
360 public final InPort count = new DockInPort("in2", ship.getDock("in2"), 0, new BitVector[] { null, bv(1) });
361 public final InPort op = new DockInPort("inOp", ship.getDock("inOp"), 0, new BitVector[] {
362 ship.getDock("inOp").getConstant("PASS_C2_V1"),
363 ship.getDock("inOp").getConstant("DROP_C2_V1") } );
364 public UnPunctuatorNode() { }
367 public class PunctuatorNode extends Node {
368 private final long punc;
369 private final Ship ship = pool.allocateShip("Counter");
370 public final OutPort out = new DockOutPort("out", ship.getDock("out"));
371 public final InPort val = new DockInPort("in1", ship.getDock("in1"));
372 public final InPort op = new DockInPort("inOp", ship.getDock("inOp"), 0, new BitVector[] {
373 ship.getDock("inOp").getConstant("PASS_C2_V1"),
374 ship.getDock("inOp").getConstant("PASS_C2_V2") } );
375 public final InPort count;
376 public PunctuatorNode(long punc) {
378 this.count = new DockInPort("in2", ship.getDock("in2"), 0, new BitVector[] { null, bv(1), bv(punc) });
382 public class AluNode extends Node {
383 public final Ship ship = pool.allocateShip("Alu");
384 public final InPort in1 = new DockInPort("in1", ship.getDock("in1"));
385 public final InPort in2 = new DockInPort("in2", ship.getDock("in2"));
386 public final InPort inOp = new DockInPort("inOp", ship.getDock("inOp"));
387 public final OutPort out = new DockOutPort("out", ship.getDock("out"));
391 public class DownCounterNode extends Node {
392 public final Ship ship = pool.allocateShip("Counter");
393 public final InPort start = new DockInPort("in1", ship.getDock("in1"));
394 public final InPort incr = new DockInPort("in2", ship.getDock("in2"));
395 public final InPort inOp = new DockInPort("inOp", ship.getDock("inOp"), 0, new BitVector[] {
396 ship.getDock("inOp").getConstant("COUNT") });
397 public final OutPort out = new DockOutPort("out", ship.getDock("out"));
398 public DownCounterNode() { }
401 public class RepeatNode extends Node {
402 public final Ship ship = pool.allocateShip("Counter");
403 public final InPort count = new DockInPort("in1", ship.getDock("in1"));
404 public final InPort val = new DockInPort("in2", ship.getDock("in2"));
405 public final InPort inOP = new DockInPort("inOp", ship.getDock("inOp"), 0, new BitVector[] {
406 ship.getDock("inOp").getConstant("REPEAT_C1_V2") });
407 public final OutPort out = new DockOutPort("out", ship.getDock("out"));
408 public RepeatNode() { }
411 public class SortedMergeNode extends Node {
412 public final Ship ship = pool.allocateShip("Alu");
413 public final InPort in1 = new DockInPort("in1", ship.getDock("in1"));
414 public final InPort in2 = new DockInPort("in2", ship.getDock("in2"));
415 public final InPort inOp = new DockInPort("inOp", ship.getDock("inOp"), 0, new BitVector[] {
416 ship.getDock("inOp").getConstant("MAXMERGE") });
417 public final OutPort out = new DockOutPort("out", ship.getDock("out"));
418 public SortedMergeNode() { }
421 public class MemoryNode extends Node {
422 public final Ship ship;
423 public final InPort inCBD;
424 public final InPort inAddrRead1;
425 public final InPort inAddrRead2;
426 public final InPort inAddrWrite;
427 public final InPort inDataWrite;
428 public final OutPort outRead1;
429 public final OutPort outRead2;
430 public final OutPort outWrite;
431 public MemoryNode(Ship memoryShip) {
432 this.ship = memoryShip;
433 this.inCBD = ship.getType().equals("Memory") ? new DockInPort("inCBD", ship.getDock("inCBD")) : null;
434 this.inAddrWrite = new DockInPort("inAddrWrite", ship.getDock("inAddrWrite"));
435 this.inDataWrite = new DockInPort("inDataWrite", ship.getDock("inDataWrite"));
436 this.inAddrRead1 = new InPort("inAddrRead1") {
437 public void recvToken(LoopFactory lf) { lf.recvToken(); }
438 public void sendWord(LoopFactory lf) { lf.sendWord(ship.getDock("inAddrRead").getDataDestination(), new BitVector(1).set(0)); }
439 public void build(Context ctx) { }
440 public int getTokensToAbsorb() { return outRead1.peer.getTokensToAbsorb(); }
441 public void reset(Context ctx, int phase, Destination ackDestination) {
442 doReset(ctx, phase, ship.getDock("inAddrRead"), null, ackDestination, false);
445 this.inAddrRead2 = new InPort("inAddrRead2") {
446 public void recvToken(LoopFactory lf) { lf.recvToken(); }
447 public void sendWord(LoopFactory lf) { lf.sendWord(ship.getDock("inAddrRead").getDataDestination(), new BitVector(1).set(1)); }
448 public void build(Context ctx) { }
449 public int getTokensToAbsorb() { return outRead2.peer.getTokensToAbsorb(); }
450 public void reset(Context ctx, int phase, Destination ackDestination) { }
452 this.outRead1 = new OutPort("outRead1") {
453 public void sendToken(LoopFactory lf) { inAddrRead1.peer.sendToken(lf); }
454 public void recvWord(LoopFactory lf) { lf.recvWord(); }
455 public void build(Context ctx) { }
456 public void reset(Context ctx, int phase, Destination ackDestination) { }
458 this.outRead2 = new OutPort("outRead2") {
459 public void sendToken(LoopFactory lf) { inAddrRead2.peer.sendToken(lf); }
460 public void recvWord(LoopFactory lf) { lf.recvWord(); }
461 public void build(Context ctx) { }
462 public void reset(Context ctx, int phase, Destination ackDestination) { }
464 this.outWrite = new DockOutPort("out", ship.getDock("out")) {
465 protected void build(Context ctx, LoopFactory lf) {
467 lf.abortLoopIfTorpedoPresent();
470 lf.setFlags(FlagFunction.ZERO, FlagFunction.ZERO.add(FlagC));
471 if (this.peer != null) {
472 lf.setPredicate(Predicate.FlagB);
474 lf.abortLoopIfTorpedoPresent();
475 this.peer.recvToken(lf);
476 this.peer.sendWord(lf);
479 lf.setPredicate(Predicate.NotFlagB);
480 lf.abortLoopIfTorpedoPresent();
482 lf.setFlags(FlagFunction.ZERO.add(NotFlagC).add(FlagB), FlagFunction.ZERO.add(FlagC).add(FlagB));
483 if (outRead1.peer != null) {
484 lf.setPredicate(Predicate.NotFlagB);
485 outRead1.peer.sendWord(lf);
487 if (outRead2.peer != null) {
488 lf.setPredicate(Predicate.NotFlagA);
489 outRead2.peer.sendWord(lf);
491 lf.setPredicate(null);
495 public void build(Context ctx) {
499 lf = new LoopFactory(ctx, ship.getDock("inAddrRead"), 0);
500 lf.abortLoopIfTorpedoPresent();
502 lf.setFlags(FlagFunction.ZERO.add(FlagC), FlagFunction.ZERO);
503 lf.setPredicate(Predicate.NotFlagA);
504 lf.sendToken(ship.getDock("out").getDataDestination(), new BitVector(1).set(0));
505 lf.setPredicate(Predicate.FlagA);
506 lf.sendToken(ship.getDock("out").getDataDestination(), new BitVector(1).set(1));
507 lf.setPredicate(null);
512 public static void main(String[] s) throws Exception {
513 Fleet fleet = new Fpga();
514 //Fleet fleet = new Interpreter(false);
516 Random random = new Random(System.currentTimeMillis());
517 long[] vals = new long[256];
518 for(int i=0; i<vals.length; i++) {
519 vals[i] = Math.abs(random.nextInt());
522 Ship mem1 = fleet.getShip("Memory", 0);
523 Ship mem2 = fleet.getShip("Memory", 1);
524 //Ship mem2 = fleet.getShip("DDR2", 0);
530 fp = fleet.run(new Instruction[0]);
531 MemoryUtils.writeMem(fp, mem1, 0, vals);
532 int vals_length = vals.length;
534 // Disable readback/writeback inside the loop
537 while(stride < vals_length) {
539 // reset the FleetProcess
540 //fp.terminate(); fp = null;
542 System.out.println("stride " + stride);
544 // if we reset the FleetProcess, restart it
545 if (fp==null) fp = fleet.run(new Instruction[0]);
548 vals = mergeSort(fp, fleet, vals, vals_length, stride, mem1, mem2);
550 // verify the cleanup
551 //CleanupUtils.verifyClean(fp);
553 Ship mem = mem1; mem1=mem2; mem2=mem;
556 System.out.println();
559 BitVector[] bvs = new BitVector[vals_length];
560 MemoryUtils.readMem(fp, mem1, 0, bvs);
561 System.out.println("results:");
562 for(int i=0; i<vals_length; i++)
563 System.out.println(bvs[i].toLong());
567 public static long[] mergeSort(FleetProcess fp, Fleet fleet,
568 long[] vals, int vals_length, int stride_length,
569 Ship memoryShip1, Ship memoryShip2) throws Exception {
572 BitVector[] mem = new BitVector[vals_length];
573 for(int i=0; i<mem.length; i++) mem[i] = new BitVector(fleet.getWordWidth()).set(vals[i]);
574 MemoryUtils.writeMem(fp, memoryShip1, 0, mem);
577 //////////////////////////////////////////////////////////////////////////////
579 DataFlowGraph proc = new DataFlowGraph(fleet);
580 DebugNode dm = proc.new DebugNode();
582 int end_of_data = vals_length;
583 int num_strides = end_of_data / (stride_length * 2);
585 MemoryNode mm = proc.new MemoryNode(memoryShip1);
586 SortedMergeNode sm = proc.new SortedMergeNode();
588 // So far: we have four spare Counter ships; one can be used for resetting
589 for(int i=0; i<2; i++) {
591 DownCounterNode c0 = proc.new DownCounterNode();
592 DownCounterNode c1 = proc.new DownCounterNode();
594 c0.start.connect(proc.new ForeverNode(stride_length).out);
595 c0.incr.connect(proc.new ForeverNode(1).out);
597 c1.start.connect(proc.new OnceNode(end_of_data + i*stride_length).out);
598 c1.incr.connect(proc.new OnceNode(stride_length*2).out);
600 RepeatNode r1 = proc.new RepeatNode();
601 r1.val.connect(c1.out);
602 r1.count.connect(proc.new ForeverNode(stride_length).out);
604 AluNode alu = proc.new AluNode();
605 alu.in1.connect(r1.out);
606 alu.in2.connect(c0.out);
607 alu.inOp.connect(proc.new ForeverNode(((Node.DockInPort)alu.inOp).getConstant("ADD")).out);
608 alu.out.connect(i==0 ? mm.inAddrRead1 : mm.inAddrRead2);
610 PunctuatorNode punc = proc.new PunctuatorNode(-1);
611 punc.count.connect(proc.new ForeverNode(stride_length).out);
612 punc.val.connect(i==0 ? mm.outRead1 : mm.outRead2);
613 punc.out.connect(i==0 ? sm.in1 : sm.in2);
616 UnPunctuatorNode unpunc = proc.new UnPunctuatorNode();
617 unpunc.val.connect(sm.out);
618 unpunc.count.connect(proc.new ForeverNode(2*stride_length).out);
620 DownCounterNode cw = proc.new DownCounterNode();
621 cw.start.connect(proc.new OnceNode(end_of_data).out);
622 cw.incr.connect(proc.new OnceNode(1).out);
624 MemoryNode mm2 = proc.new MemoryNode(memoryShip2);
625 mm2.inAddrWrite.connect(cw.out);
626 mm2.inDataWrite.connect(unpunc.out);
627 mm2.outWrite.connect(dm.in);
629 //////////////////////////////////////////////////////////////////////////////
631 Context ctx = new Context(fp.getFleet());
632 ctx.setAutoflush(true);
634 ArrayList<Instruction> ai = new ArrayList<Instruction>();
637 for(Instruction ins : ai) {
638 //System.out.println(ins);
639 fp.sendInstruction(ins);
643 for(int i=0; i<vals_length; i++) {
644 System.out.print("\rreading back... " + i+"/"+vals_length+" ");
645 BitVector rec = fp.recvWord();
646 System.out.print(" (prev result: " + rec + " = " + rec.toLong() + ")");
648 System.out.println("\rdone. ");
650 //if (true) return ret;
652 Context ctx2 = new Context(fp.getFleet());
653 Dock debugIn = fleet.getShip("Debug",0).getDock("in");
655 fp.sendToken(debugIn.getInstructionDestination());
658 LoopFactory lf = new LoopFactory(ctx2, debugIn, 0);
660 lf.abortLoopIfTorpedoPresent();
669 Ship counter = proc.pool.allocateShip("Counter");
671 for(int phase=0; phase<=3; phase++) {
672 System.out.println("== phase "+phase+" ==================================================================");
673 ctx2 = new Context(fp.getFleet());
675 Destination ackDestination = counter.getDock("in2").getDataDestination();
676 proc.reset(ctx2, phase, ackDestination);
678 Context ctx3 = new Context(fp.getFleet());
679 lf = new LoopFactory(ctx3, counter.getDock("inOp"), 1);
680 lf.literal("DROP_C1_V2");
684 lf = new LoopFactory(ctx3, counter.getDock("in1"), 1);
685 lf.literal(reset_count-1);
689 lf = new LoopFactory(ctx3, counter.getDock("in2"), 0);
690 lf.abortLoopIfTorpedoPresent();
693 lf = new LoopFactory(ctx3, counter.getDock("out"), 1);
695 lf.sendToken(counter.getDock("in2").getInstructionDestination()); // HACK: we don't check to make sure this hits
696 lf.sendToken(debugIn.getDataDestination());
697 ctx3.dispatch(fp); // HACK: we don't check to make sure that this is "firmly in place"
699 for(Dock dock : torpedoes) fp.sendToken(dock.getInstructionDestination());
702 System.out.println("flushed");
705 System.out.println("phase done");
707 System.out.println();
710 fp.sendToken(debugIn.getInstructionDestination());
713 //System.out.println("verifying cleanup:");
714 //CleanupUtils.verifyClean(fp);
716 System.out.println("reading back:");
719 ret = new long[vals_length];
720 BitVector[] mem = new BitVector[vals_length];
721 MemoryUtils.readMem(fp, memoryShip2, 0, mem);
722 for(int i=0; i<ret.length; i++) ret[i] = mem[i].toLong();
727 private BitVector[] longsToBitVectors(long[] initialValues) {
728 BitVector[] bv = new BitVector[initialValues.length];
729 for(int i=0; i<initialValues.length; i++)
730 bv[i] = new BitVector(fleet.getWordWidth()).set(initialValues[i]);