-package edu.berkeley.fleet.marina;
-
-import java.util.HashMap;
-import java.util.Map;
-import com.sun.electric.tool.simulation.test.*;
-
-/** One or more ChainControl. If we have a JTAG controller then one
- * ChainControl. If we don't have a JTAG controller then we need
- * one ChainControl per scan chain.
- *
- * ChainControls duplicates much of the ChainControl interface. It
- * allows the testing code to remain oblivious of whether or not the
- * JTAG controller exists.
- */
-public class ChainControls {
- private Map<String,ChainControl> chainToControl =
- new HashMap<String,ChainControl>();
-
- /** The path has the form:
- * chipName.chainName.instanceName1.instanceName2 ...
- */
- public ChainControl getChainControlFromPath(String path) {
- for (String chainName : chainToControl.keySet()) {
- if (path.startsWith(chainName)) return chainToControl.get(chainName);
- }
- MarinaTest.fatal(true, "Can't find chain for path: "+path);
- return null;
- }
- public void addChain(String chain, ChainControl control) {
- chainToControl.put(chain, control);
- }
-
- //--------------------------------------------------------------------------------
- // Replicate interface of ChainControl
- public BitVector getInBits(String path) {
- ChainControl cc = getChainControlFromPath(path);
- return cc.getInBits(path);
- }
- public BitVector getOutBits(String path) {
- ChainControl cc = getChainControlFromPath(path);
- return cc.getOutBits(path);
- }
- public void setInBits(String path, BitVector bits) {
- ChainControl cc = getChainControlFromPath(path);
- cc.setInBits(path, bits);
- }
- public void shift(String chainName, boolean readEnable, boolean writeEnable) {
- ChainControl cc = getChainControlFromPath(chainName);
- cc.shift(chainName, readEnable, writeEnable);
- }
- public void resetInBits() {
- for (String chainName : chainToControl.keySet()) {
- ChainControl cc = chainToControl.get(chainName);
- cc.resetInBits();
- }
- }
-}