setFillDrainControl(MarinaUtils.RingIfc.STOPSINK.bits());
}
/** Stop a running stopper in order to add items. Ensure that we don't
- * lose the item in the fill stage. Wait long enough for ring to quiesce.
- * Exit state: idle */
+ * lose the item in the fill stage.
+ * Exit state: block */
public void stopToFill() {
stop(); // go = 0
idle(); // block = 1
block(); // go = 1
- idle(); // go = 0
+// idle(); // go = 0
}
/** get value of the state wire preceding the fill stage */
public StateWireState getPrevStateWire() {
/** Insert one item into the fill stage.
* Fill stage must be empty.
* You must stop stopper before calling fill.
- * exit state: idle */
+ * exit state: block */
public void fill(BitVector dta) {
if (traceFill) prln("Begin fill. stopper="+name);
adjustIndent(2);
fill(); // fill = 1
idle(); // fill = 0
block(); // go = 1
- idle();
+// idle();
model.waitNS(5);
}
/** Insert items from a list, one by one.
* You must stop stopper before calling fillMany()
- * exit state: idle */
+ * exit state: block */
public void fillMany(List<BitVector> data) {
prln("Begin fillMany. stopper="+name+" numWords="+data.size());
adjustIndent(2);
StateWireState myState=getFillStateWire();
fatal(myState==StateWireState.EMPTY, "drain: fill stage empty");
+ return drainNoCheck();
+ }
+ /** Remove one item from fill stage. Return that item.
+ * Assume that an item is available.
+ * entry state: stop
+ * exit state: stop */
+ private BitVector drainNoCheck() {
shiftData(true, false);
BitVector ans = getDatTokAdr();
prln("begin drainMany. stopper="+name);
adjustIndent(2);
+ stop();
+
List<BitVector> ans = new ArrayList<BitVector>();
int cnt = 0;
if (traceDrain) prln("drainMany: reading word number: "+cnt++);
- BitVector d = drain();
+ BitVector d = drainNoCheck();
ans.add(d);
}