~ubuntu-branches/ubuntu/maverick/electric/maverick

« back to all changes in this revision

Viewing changes to com/sun/electric/tool/simulation/test/HP81250.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
/*
 
4
 * HP81250.java
 
5
 *
 
6
 * Created on March 18, 2004 
 
7
 * Copyright (c) 2004,2005 by Sun Microsystems, Inc.
 
8
 *
 
9
 */
 
10
 
 
11
/**
 
12
 * 
 
13
 * @author ac147373
 
14
 */
 
15
 
 
16
public class HP81250 extends Equipment {
 
17
 
 
18
    String s = new String("null");
 
19
 
 
20
    String handle = new String();
 
21
 
 
22
    /** Creates a new instance of HP81250 */
 
23
    public HP81250(String name) {
 
24
        super(name);
 
25
    }
 
26
 
 
27
    void init(String _handle) {
 
28
        write(":DVT:IDN?");
 
29
        s = read(200).trim();
 
30
        //s = s.substring(0,s.length()-1);
 
31
        System.out.println("dvt idn " + s);
 
32
        try { Thread.sleep(100); } catch (InterruptedException _) { }
 
33
        handle = _handle;
 
34
    }//end testConnection
 
35
 
 
36
    void start() {
 
37
        write(":dvt:instrument:handle:create? " + handle + ", \"DSR\",\"DSRA\"");
 
38
        s = read(200).trim();
 
39
        System.out.println("successfully created handle " + s);
 
40
        try { Thread.sleep(100); } catch (InterruptedException _) { }
 
41
    }//end start
 
42
 
 
43
    void run(boolean state) {
 
44
        if (state)
 
45
            write(":_" + handle + ":sgen:glob:init:cont ON");
 
46
        else
 
47
            write(":_" + handle + ":sgen:glob:init:cont OFF");
 
48
        try { Thread.sleep(300); } catch (InterruptedException _) { }
 
49
 
 
50
        //write(":_"+handle+":sgen:glob:init:cont?");
 
51
        //s = read(200).trim();
 
52
        //System.out.println("system state " + s);
 
53
        //Infrastructure.waitSeconds(.1f);
 
54
    }//end run
 
55
 
 
56
    void list() {
 
57
        write(":dvt:inst:hand:list?");
 
58
        s = read(200).trim();
 
59
        //s = s.substring(0,s.length()-1);
 
60
        System.out.println("list of handles " + s);
 
61
        try { Thread.sleep(100); } catch (InterruptedException _) { }
 
62
    }//end list
 
63
 
 
64
    void load_setting(String setting_name) {
 
65
 
 
66
        String actualSetting = new String();
 
67
        while (!actualSetting.equals(setting_name.toUpperCase())) {
 
68
            //write(":dvt:mmem:setting:import _"+handle+", \"" + setting_name +
 
69
            // "\" ");
 
70
            write(":_" + handle + ":mmem:setting:load \"" + setting_name
 
71
                    + "\" ");
 
72
            try { Thread.sleep(100); } catch (InterruptedException _) { }
 
73
            String acSt = get_setting();
 
74
            actualSetting = acSt.substring(1, acSt.length() - 1);
 
75
            //System.out.println(actualSetting + " " + setting_name);
 
76
        }//end while
 
77
        //System.out.println(actualSetting);
 
78
    }//end load_setting
 
79
 
 
80
    String get_setting() {
 
81
        write(":_" + handle + ":mmem:sett:name?");
 
82
        s = read(200).trim();
 
83
        //System.out.println("setting " + s);
 
84
        try { Thread.sleep(100); } catch (InterruptedException _) { }
 
85
        return s;
 
86
    }//end get_setting
 
87
 
 
88
    void countConnector() {
 
89
        write(":_" + handle + ":conf:cgr1:mod?");
 
90
        s = read(200).trim();
 
91
 
 
92
        System.out.println("number of modules " + s);
 
93
        //loop over modules
 
94
 
 
95
        Integer iObj = new Integer(s);
 
96
 
 
97
        for (int i = 1; i <= (iObj.intValue()); i++) {
 
98
            //find out how many connectors
 
99
            write(":_" + handle + ":conf:cgr1:mod" + i + ":conn?");
 
100
            s = read(200).trim();
 
101
            System.out.println("module number " + i + " has " + s
 
102
                    + " connectors");
 
103
            try { Thread.sleep(100); } catch (InterruptedException _) { }
 
104
        }//end for
 
105
 
 
106
    }//end countConnector
 
107
 
 
108
    void setFreq(int f) {
 
109
        write(":_" + handle + ":sgen:global:freq " + f + "e6");
 
110
        write(":_" + handle + ":sgen:global:mux 4");
 
111
        try { Thread.sleep(100); } catch (InterruptedException _) { }
 
112
        write(":_" + handle + ":sgen:global:freq?");
 
113
        s = read(200).trim();
 
114
        //System.out.println("freq set to " + s);
 
115
    }//end setFreq
 
116
 
 
117
    void createSetting(String setting_name) {
 
118
        run(false);
 
119
        //renew setting
 
120
        write(":_" + handle + ":mmem:sett:new");
 
121
 
 
122
        //create 3 ports, 1 data, 2 clock, one terminal under each port
 
123
        write(":_" + handle + ":sgen:pdat1:app \"INPUT_PORT\",1,\"data\",ELEC");
 
124
        write(":_" + handle + ":sgen:PPUL1:app \"INPUT_PORT\",1,\"pulse\",ELEC");
 
125
        write(":_" + handle + ":sgen:PPUL2:app \"INPUT_PORT\",1,\"pulse\",ELEC");
 
126
 
 
127
        //connect connectors to terminals
 
128
        write(":_" + handle + ":sgen:conn:pdat1:term1:to (@0102004)");
 
129
        write(":_" + handle + ":sgen:conn:ppul1:term1:to (@0103002)");
 
130
        write(":_" + handle + ":sgen:conn:ppul2:term1:to (@0103001)");
 
131
 
 
132
        //set the voltage levels
 
133
        write(":_" + handle + ":mod2:conn4:volt:high 1.8");
 
134
        write(":_" + handle + ":mod3:conn2:volt:high 1.8");
 
135
        write(":_" + handle + ":mod3:conn1:volt:high 1.8");
 
136
 
 
137
        //RZ or NRZ
 
138
        write(":_" + handle + ":mod2:conn4:dig:sign:format NRZ");
 
139
        write(":_" + handle + ":mod3:conn2:dig:sign:format RZ");
 
140
        write(":_" + handle + ":mod3:conn1:dig:sign:format RZ");
 
141
 
 
142
        //duty cycle
 
143
        write(":_" + handle + ":mod2:conn4:pulse:dcycle 10");
 
144
        write(":_" + handle + ":mod3:conn2:pulse:dcycle 30");
 
145
        write(":_" + handle + ":mod3:conn1:pulse:dcycle 30");
 
146
 
 
147
        //global parameters period and segment resolution
 
148
        write(":_" + handle + ":sgen:global:period 40e-9");
 
149
        write(":_" + handle + ":sgen:global:mux 4");
 
150
 
 
151
        //segment resolution
 
152
        write(":_" + handle + ":sgen:pdat1:mux 2.5E-1");
 
153
        write(":_" + handle + ":cgr1:mod3:conn2:mux 1");
 
154
        write(":_" + handle + ":cgr1:mod3:conn1:mux 1");
 
155
 
 
156
        write(":_" + handle + ":sgen:pdat1:mux?");
 
157
        String s = read(200).trim();
 
158
        System.out.println("mux " + s);
 
159
 
 
160
        //switch on the terminals
 
161
        write(":_" + handle + ":mod2:conn4:outp on");
 
162
        write(":_" + handle + ":mod3:conn2:outp on");
 
163
        write(":_" + handle + ":mod3:conn1:outp on");
 
164
 
 
165
        //set sequence
 
166
        write(":_"
 
167
                + handle
 
168
                + ":SGEN:GLOB:SEQ (3.0,\"\",(SEQ,(LOOP4,0,20,\"00\",(BLOCK,0,16,0,\"00\",(),PAUSE0,0,0)),\"\",(BLOCK,0,16,0,\"00\",(),\"REFRESHCLK\",0,0),\"\",(LOOP5,0,INF,\"00\",(BLOCK,0,16,0,\"00\",(),PAUSE0,0,0))))");
 
169
        write(":_"
 
170
                + handle
 
171
                + ":SGEN:GLOB:SEQ:EVEN (3.0,(\"\",0,(('x','xxxxxxxx','xx',IGNORE))),(\"\",0,(('x','xxxxxxxx','xx',IGNORE))),(\"\",0,(('x','xxxxxxxx','xx',IGNORE))),(\"\",0,(('x','xxxxxxxx','xx',IGNORE))),(\"\",0,(('x','xxxxxxxx','xx',IGNORE))),(\"\",0,(('x','xxxxxxxx','xx',IGNORE))),(\"\",0,(('x','xxxxxxxx','xx',IGNORE))),(\"\",0,(('x','xxxxxxxx','xx',IGNORE))),(\"\",0,(('x','xxxxxxxx','xx',IGNORE))),(\"\",0,(('x','xxxxxxxx','xx',IGNORE))))");
 
172
        write(":_" + handle + ":SGEN:GLOB:SEQ:PCON 0");
 
173
 
 
174
        //save the setting
 
175
        write(":_" + handle + ":mmem:sett:save \"" + setting_name + "\"");
 
176
 
 
177
    }//end createSetting
 
178
 
 
179
    void switchConnector(String mod, String conn, String state) {
 
180
        write(":_" + handle + ":mod" + mod + ":conn" + conn + ":outp " + state
 
181
                + "");
 
182
        //Infrastructure.waitSeconds(.1f);
 
183
    }//end switchConnector
 
184
 
 
185
    void getConnectorStat() {
 
186
        write(":_" + handle + ":sgen:glob:conn?");
 
187
        String s = read(200).trim();
 
188
        System.out.println("connector stat " + s);
 
189
    }//end getConnectorStat
 
190
 
 
191
    void destroyHandle() {
 
192
        //write(":_" +handle+":sgen:glob:init:cont OFF");
 
193
        //Infrastructure.waitSeconds(.1f);
 
194
 
 
195
        write("dvt:instrument:handle:destroy _" + handle + "");
 
196
        System.out.println("stopped");
 
197
        write(":dvt:instrument:handle:list?");
 
198
        String s = read(200).trim();
 
199
        System.out.println("handles left " + s);
 
200
 
 
201
        try { Thread.sleep(100); } catch (InterruptedException _) { }
 
202
    }//end stop
 
203
 
 
204
    private void stepThruRefresh() {
 
205
        run(true);
 
206
        run(false);
 
207
    }
 
208
 
 
209
    private void checkConnectors() {
 
210
        start();
 
211
        list();
 
212
        load_setting("try2");
 
213
        setFreq(20);
 
214
        switchConnector("3", "1", "on");
 
215
        switchConnector("3", "2", "on");
 
216
        run(true);
 
217
        run(false);
 
218
        switchConnector("3", "1", "off");
 
219
        switchConnector("3", "2", "off");
 
220
        destroyHandle();
 
221
    }
 
222
 
 
223
    public static void main(String args[]) {
 
224
        //boolean onlyKill = false;
 
225
        boolean onlyKill = true;
 
226
 
 
227
        HP81250 bert = new HP81250("hp81250");
 
228
        bert.init("HANDLEA");
 
229
        /*
 
230
         * if(!onlyKill) { //dont use this
 
231
         * bert.load_setting("c:\\81250\\settings\\try_load");
 
232
         * //bert.countConnector(); bert.start(); bert.list();
 
233
         * bert.load_setting("try2"); //for(int i=0; i <3; i++) //{
 
234
         * bert.run(true); //GPIB.waitFor(0.1f); bert.run(false); //
 
235
         * GPIB.waitFor(0.1f); bert.run(true); bert.run(false); //}//end for
 
236
         * //bert.createSetting("code"); //stepThruRefresh(); //int count=1;
 
237
         * //while(count==1) //stepThruRefresh();
 
238
         * 
 
239
         * }//end if
 
240
         * 
 
241
         * else bert.destroyHandle();
 
242
         */
 
243
        bert.destroyHandle();
 
244
        //checkConnectors();
 
245
 
 
246
    }//end main
 
247
 
 
248
}//end class