1 package com.sun.vlsi.chips.marina.test;
3 import java.util.HashMap;
5 import com.sun.electric.tool.simulation.test.*;
7 /** One or more ChainControl. If we have a JTAG controller then one
8 * ChainControl. If we don't have a JTAG controller then we need
9 * one ChainControl per scan chain.
11 * ChainControls duplicates much of the ChainControl interface. It
12 * allows the testing code to remain oblivious of whether or not the
13 * JTAG controller exists.
15 public class ChainControls {
16 private Map<String,ChainControl> chainToControl =
17 new HashMap<String,ChainControl>();
19 /** The path has the form:
20 * chipName.chainName.instanceName1.instanceName2 ...
22 public ChainControl getChainControlFromPath(String path) {
23 for (String chainName : chainToControl.keySet()) {
24 if (path.startsWith(chainName)) return chainToControl.get(chainName);
26 MarinaTest.fatal(true, "Can't find chain for path: "+path);
29 public void addChain(String chain, ChainControl control) {
30 chainToControl.put(chain, control);
33 //--------------------------------------------------------------------------------
34 // Replicate interface of ChainControl
35 public BitVector getInBits(String path) {
36 ChainControl cc = getChainControlFromPath(path);
37 return cc.getInBits(path);
39 public BitVector getOutBits(String path) {
40 ChainControl cc = getChainControlFromPath(path);
41 return cc.getOutBits(path);
43 public void setInBits(String path, BitVector bits) {
44 ChainControl cc = getChainControlFromPath(path);
45 cc.setInBits(path, bits);
47 public void shift(String chainName, boolean readEnable, boolean writeEnable) {
48 ChainControl cc = getChainControlFromPath(chainName);
49 cc.shift(chainName, readEnable, writeEnable);
51 public void resetInBits() {
52 for (String chainName : chainToControl.keySet()) {
53 ChainControl cc = chainToControl.get(chainName);