+++ /dev/null
-package com.sun.vlsi.chips.marina.test;
-import com.sun.electric.tool.simulation.test.*;
-
-import java.util.List;
-import java.util.Random;
-import java.util.ArrayList;
-
-public class MarinaUtils {
-
- /**
- * StateWireState hides whether the state wire being high means FULL
- * or whether high means EMPTY
- */
- public static enum StateWireState {
- FULL, EMPTY
- };
-
- public static int testnum;
-
- public static void fatal(boolean pred, String msg) {
- if (pred) throw new FailureException(msg);
- }
-
- public static class FailureException extends RuntimeException {
- public FailureException(String s) { super("test " + testnum + ": " + s); }
- }
-
- /**
- * Compare two lists of BitVectors
- */
- public static void compareItemsOrdered(List<BitVector> din, List<BitVector> dout) {
- fatal(din.size()!=dout.size(),
- "in count="+din.size()+" out count="+dout.size());
- for (int i=0; i<din.size(); i++) {
- BitVector dI = din.get(i);
- BitVector dO = dout.get(i);
- fatal(!dI.equals(dO),
- "item mismatch! in:"+dI.getState()+" out:"+dO.getState());
- }
- }
-
- /**
- * Convert an edu.berkeley.fleet.api.BitVector to a com.sun.async.test.BitVector
- */
- public static BitVector berkToSun(edu.berkeley.fleet.api.BitVector berkBits) {
- BitVector sunBits = new BitVector(berkBits.length(), "berkToSun()");
- for(int i=0; i<sunBits.getNumBits(); i++) sunBits.set(i, berkBits.get(i));
- return sunBits;
- }
-
- /**
- * Convert an a com.sun.async.test.BitVector to a edu.berkeley.fleet.api.BitVector
- */
- public static edu.berkeley.fleet.api.BitVector sunToBerk(BitVector sunBits) {
- edu.berkeley.fleet.api.BitVector berkBits =
- new edu.berkeley.fleet.api.BitVector(sunBits.getNumBits());
- for(int i=0; i<sunBits.getNumBits(); i++) berkBits.set(i, sunBits.get(i));
- return berkBits;
- }
-
-
- public static void expectLength(BitVector bv, int expected) {
- if (bv.getNumBits()!=expected)
- throw new RuntimeException("expected BitVector of length " + expected + ", but got " + bv.getNumBits() +" in " + bv);
- }
-}
\ No newline at end of file