1 package com.sun.vlsi.chips.marina.test;
3 import com.sun.async.test.BitVector;
4 import com.sun.async.test.ChainControl;
5 import com.sun.async.test.ChipModel;
7 /** InstructionStopper is a scaffold that lets us create a 36 bit propperStopper
8 * by using a 52 bit propperStopper and throwing away the unused bits. */
9 public class InstructionStopper extends ProperStopper {
10 public static final int INSTR_SZ = 36;
11 private String formatDecodedInstr(BitVector dta) {
12 BitVector instr = dta.get(0, INSTR_SZ).bitReverse();
13 StringBuffer sb = new StringBuffer();
14 String pred = instr.get(0, 6) .getState();
15 String rq = instr.get(6, 1).getState();
16 String unused2 = instr.get(7, 2).getState();
17 String op = instr.get(9, 6).getState();
18 String tail = instr.get(15, 1).getState();
19 String rest = instr.get(16, 20).getState();
21 return pred+" "+rq+" "+unused2+" "+op+" "+tail+" "+rest;
23 public InstructionStopper(String propInst,
24 String controlChain, String dataChain,
26 ChainControl cc, ChipModel model,
28 super(propInst, controlChain, dataChain, reportChain, cc, model, indenter);
32 public void fill(BitVector instr) {
33 int n = instr.getNumBits();
34 fatal(n!=INSTR_SZ, "InstructionStopper.fill: wrong num bits: "+n+", expect: "+INSTR_SZ);
35 fatal(INSTR_SZ>37, "Instructions can't be more than 37 bits");
37 BitVector pad = new BitVector(37-INSTR_SZ, "pad");
39 instr = instr.cat(pad);
41 BitVector t = new BitVector(1, "token"); t.setFromLong(1);
42 BitVector a = new BitVector(14, "addr"); a.setFromLong(0);
43 super.fill(instr.cat(t).cat(a));
46 public BitVector drain() {
47 BitVector dta = super.drain();
48 return dta.get(0, INSTR_SZ);
51 public String formatDataTokAddr(BitVector dta) {
52 return formatDecodedInstr(dta);
54 /** Take the Berkeley BitVector */
55 public void fill(edu.berkeley.fleet.api.BitVector instr) {
56 BitVector bitVector = new BitVector(INSTR_SZ, "instr");
57 for(int i=0; i<INSTR_SZ; i++) bitVector.set(i, instr.get(i));