add commented-out version of UnPunctuatorNode2 to UnPunctuatorNode until I have time...
[fleet.git] / src / edu / berkeley / fleet / dataflow / ForeverNode.java
1 package edu.berkeley.fleet.dataflow;
2 import java.util.*;
3 import edu.berkeley.fleet.loops.*;
4 import edu.berkeley.fleet.api.*;
5
6 /**
7  *  Deliver the constant at out forever.  Flow control in<->out is
8  *  maintained, but out is not flow-controlled, so be sure
9  *  that every datum sent there is consumed synchronously wiht
10  *  data items sent to out.
11  */
12 public class ForeverNode extends Node {
13     private BitVector bv;
14     public final OutPort out = new OutPort("out") {
15             public void sendToken(LoopFactory lf) { }
16             public void recvWord(LoopFactory lf) { }
17             public void build(CodeBag ctx) { }
18             public int  reset(CodeBag ctx, int phase, Destination ackDestination) { return 0; }
19             public void setPeer(InPort peer) {
20                 this.peer = peer;
21                 DockInPort pip = ((DockInPort)peer);
22                 for(int i=0; i<pip.pattern.length; i++) {
23                     if (pip.pattern[i]==null)
24                         pip.pattern[i] = bv;
25                 }
26             }
27         };
28     public ForeverNode(DataFlowGraph dfg, long l) { this(dfg, new BitVector(dfg.fleet.getWordWidth()).set(l)); }
29     public ForeverNode(DataFlowGraph dfg, final BitVector bv) { super(dfg); this.bv = bv; }
30 }