1 package com.sun.vlsi.chips.marina.test;
3 import java.util.HashMap;
6 import com.sun.async.test.BitVector;
7 import com.sun.async.test.ChainControl;
9 /** One or more ChainControl. If we have a JTAG controller then one
10 * ChainControl. If we don't have a JTAG controller then we need
11 * one ChainControl per scan chain.
13 * ChainControls duplicates much of the ChainControl interface. It
14 * allows the testing code to remain oblivious of whether or not the
15 * JTAG controller exists.
17 public class ChainControls {
18 private Map<String,ChainControl> chainToControl =
19 new HashMap<String,ChainControl>();
21 /** The path has the form:
22 * chipName.chainName.instanceName1.instanceName2 ...
24 private ChainControl getChainControlFromPath(String path) {
25 for (String chainName : chainToControl.keySet()) {
26 if (path.startsWith(chainName)) return chainToControl.get(chainName);
28 MarinaTest.fatal(true, "Can't find chain for path: "+path);
31 public void addChain(String chain, ChainControl control) {
32 chainToControl.put(chain, control);
35 //--------------------------------------------------------------------------------
36 // Replicate interface of ChainControl
37 public BitVector getInBits(String path) {
38 ChainControl cc = getChainControlFromPath(path);
39 return cc.getInBits(path);
41 public BitVector getOutBits(String path) {
42 ChainControl cc = getChainControlFromPath(path);
43 return cc.getOutBits(path);
45 public void setInBits(String path, BitVector bits) {
46 ChainControl cc = getChainControlFromPath(path);
47 cc.setInBits(path, bits);
49 public void shift(String chainName, boolean readEnable, boolean writeEnable) {
50 ChainControl cc = getChainControlFromPath(chainName);
51 cc.shift(chainName, readEnable, writeEnable);
53 public void resetInBits() {
54 for (String chainName : chainToControl.keySet()) {
55 ChainControl cc = chainToControl.get(chainName);