~ubuntu-branches/ubuntu/oneiric/electric/oneiric

« back to all changes in this revision

Viewing changes to com/sun/electric/tool/simulation/test/VerilogJtagTester.java

  • Committer: Bazaar Package Importer
  • Author(s): Onkar Shinde
  • Date: 2010-01-09 16:26:04 UTC
  • mfrom: (1.1.4 upstream) (3.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20100109162604-1ypvmy8ijmlc6oq7
Tags: 8.10-1
* New upstream version.
* debian/control
  - Add libjava3d-java and quilt build dependencies.
  - Update standards version to 3.8.3.
  - Add libjava3d-java as recommends to binary package.
* debian/rules
  - Use quilt patch system instead of simple patchsys.
  - Add java3d related jar files to DEB_JARS.
* debian/patches/*
  - Update as per current upstream source. Convert to quilt.
* debian/ant.properties
  - Do not disable 3D plugin anymore.
  - Use new property to disable compilation of OS X related classes.
* debian/wrappers/electric
  - Add java3d related jar files to runtime classpath.
* debian/README.source
  - Change text to the appropriate one for quilt.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package com.sun.electric.tool.simulation.test;
 
2
 
 
3
import java.util.List;
 
4
import java.util.ArrayList;
 
5
import java.util.Random;
 
6
import java.util.Iterator;
 
7
 
 
8
/*
 
9
 * VerilogScan.java
 
10
 *
 
11
 * Copyright (c) 2004,2005 by Sun Microsystems, Inc.
 
12
 *
 
13
 * Created on Apr 20, 2005
 
14
 */
 
15
 
 
16
/**
 
17
 * A JtagTester that interfaces with a verilog model of the Device Under Test.
 
18
 *
 
19
 * @author gainsley
 
20
 */
 
21
public class VerilogJtagTester extends JtagTesterModel {
 
22
 
 
23
    /**
 
24
     * Create a new Verilog JtagTester.  This implements a JtagTester, but does so
 
25
     * as an interface to a Verilog simulation of the chip under test.  This should only
 
26
     * be called by VerilogModel.
 
27
     * @param vm the verilog model that the tester will interface with
 
28
     * @param tck the name of the tck port
 
29
     * @param tms the name of the tms port
 
30
     * @param trstb the name of the trstb port
 
31
     * @param tdi the name of the tdi port
 
32
     * @param tdob the name of the tdob port
 
33
     */
 
34
    VerilogJtagTester(VerilogModel vm, String tck, String tms, String trstb, String tdi, String tdob) {
 
35
        super(vm, tck, tms, trstb, tdi, tdob);
 
36
    }
 
37
 
 
38
    String formatDataNetName(String dataNetName) {
 
39
        return VerilogModel.formatDataNetName(dataNetName);
 
40
    }
 
41
 
 
42
 
 
43
    /** Unit test */
 
44
    public static void main(String args[]) {
 
45
        VerilogModel vm = new VerilogModel();
 
46
        VerilogJtagTester tester = (VerilogJtagTester)vm.createJtagTester("TCK", "TMS", "TRSTb", "TDI", "TDOb");
 
47
        vm.start("verilog", VerilogModel.getExampleVerilogChipFile(), VerilogModel.NORECORD);
 
48
 
 
49
        // test private methods separately
 
50
        tester.reset();
 
51
        tester.task_load_instruction("11000010");
 
52
        tester.task_scan_data("1000100010001111");
 
53
 
 
54
        // test public methods which use private methods
 
55
        ChainNode testNode = new ChainNode("testNode", "1001", 156, "node for unit test");
 
56
        Random rand = new Random(309402934);
 
57
        for (int i=0; i<testNode.getInBits().getNumBits(); i++) {
 
58
            testNode.getInBits().set(i, rand.nextBoolean());
 
59
        }
 
60
        System.out.println("Note that data shifted out is inverted sense of data shifted in,");
 
61
        System.out.println("  unless it goes through one of our inverting output pads first.");
 
62
        System.out.println("Unit Test: Shifting in: "+testNode.getInBits().getState());
 
63
        tester.shift(testNode, true, true, 0);
 
64
        System.out.println("Unit Test: Shifted out: "+testNode.getOutBits().getState());
 
65
 
 
66
        // We sent to a chain that had no elements, so scan in == scan out.
 
67
        boolean match = true;
 
68
        for (int i=0; i<testNode.getInBits().getNumBits(); i++) {
 
69
            if (testNode.getInBits().get(i) != !testNode.getOutBits().get(i)) {
 
70
                match = false;
 
71
                break;
 
72
            }
 
73
        }
 
74
        if (!match) {
 
75
            System.out.println("Unit Test Error: scan data in should match scan data out when chain is looped back.");
 
76
        } else {
 
77
            System.out.println("Unit Test OK.");
 
78
        }
 
79
        vm.finish();
 
80
    }
 
81
}