OpenCores
URL https://opencores.org/ocsvn/usb_fpga_2_14/usb_fpga_2_14/trunk

Subversion Repositories usb_fpga_2_14

[/] [usb_fpga_2_14/] [trunk/] [java/] [ztex/] [ConfigData.java] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ZTEX
/*%
2
   Java host software API of ZTEX SDK
3
   Copyright (C) 2009-2017 ZTEX GmbH.
4
   http://www.ztex.de
5
 
6
   This Source Code Form is subject to the terms of the Mozilla Public
7
   License, v. 2.0. If a copy of the MPL was not distributed with this file,
8
   You can obtain one at http://mozilla.org/MPL/2.0/.
9
 
10
   Alternatively, the contents of this file may be used under the terms
11
   of the GNU General Public License Version 3, as described below:
12
 
13
   This program is free software; you can redistribute it and/or modify
14
   it under the terms of the GNU General Public License version 3 as
15
   published by the Free Software Foundation.
16
 
17
   This program is distributed in the hope that it will be useful, but
18
   WITHOUT ANY WARRANTY; without even the implied warranty of
19
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
   General Public License for more details.
21
 
22
   You should have received a copy of the GNU General Public License
23
   along with this program; if not, see http://www.gnu.org/licenses/.
24
%*/
25
 
26
package ztex;
27
 
28
/**
29
  * This class represents the configuration data space of ZTEX FPGA Boards that support it.
30
  * The internal format is (byte order is LE -- least significant byte first)
31
  * <pre>
32
  * &lt;Address&gt; &lt;Description&gt;
33
  * 0..2      Signature "CD0"
34
  * 3         Kind of FPGA Board, see {@link #boardNames}, e.g. 2 for "ZTEX USB-FPGA Module",
35
  * 4         FPGA Board series, e.g. 2
36
  * 5         FPGA Board number (number behind the dot), e.g. 16
37
  * 6..7      FPGA Board variant (letter), e.g. "b"
38
  * 8..9      FPGA, see {@link #fpgas}, e.g. 12 for X7A200T
39
  * 10        FPGA package, see {@link #packages}, e.g. 3 for FBG484
40
  * 11..13    Speed grade + temperature range, e.g. "2C"
41
  * 14        RAM size, format is ( n & 0xf0 ) << ( (n & 0xf) + 16 ) bytes
42
  * 15        RAM type, see {@link #ramTypes}
43
  * 16..25    Serial number, overwrites SN_STRING of the ZTEX descriptor.
44
  *           If it is equal to "0000000000" (default) it is replaced by the unique MAC address.
45
  * 26..27    Actual size of Bitstream in 4K sectors; 0 means Bitstream disabled (default)
46
  * 28..29    Maximum size of Bitstream in 4K sectors; 0 means that either no Flash
47
  *           is present or that this information is stored in Flash (exchangeable media)
48
  * 30..31    Start of the Bitstream in 4K sectors
49
  * 32..33    USB vendor ID, ignored if zero
50
  * 34..35    USB product ID, ignored if USB vendor ID is zero
51
  * 36..67    Product string,  null-terminated if length is smaller than 32
52
  * 68..79    Reserved, must be 0
53
  * 80..127   48 bytes user space
54
  * </pre>
55
  */
56
 
57
public class ConfigData {
58
 
59
/**
60
  * Kinds of FPGA Boards.
61
  * It's defined as
62
  * <pre>{@code
63
public static final String boardNames[] = {
64
    "(unknown)" ,             // 0
65
    "ZTEX FPGA Module" ,      // 1
66
    "ZTEX USB-FPGA Module"    // 2, FX2 based
67
    "ZTEX USB3-FPGA Module"   // 3, FX3 based
68
};}</pre>
69
  **/
70
    public static final String boardNames[] = {
71
        "(unknown)" ,             // 0
72
        "ZTEX FPGA Module" ,      // 1
73
        "ZTEX USB-FPGA Module",   // 2, FX2 based
74
        "ZTEX USB3-FPGA Module"   // 3, FX3 based
75
    };
76
 
77
/**
78
  * FPGA's used on ZTEX FPGA Boards.
79
  * It's defined as
80
  * <pre>{@code
81
public static final String fpgas[] = {
82
        "(unknown)" ,  // 0
83
        "XC6SLX9" ,    // 1
84
        "XC6SLX16" ,   // 2
85
        "XC6SLX25" ,   // 3
86
        "XC6SLX45" ,   // 4
87
        "XC6SLX75" ,   // 5
88
        "XC6SLX100" ,  // 6
89
        "XC6SLX150" ,  // 7
90
        "XC7A35T",     // 8
91
        "XC7A50T",     // 9
92
        "XC7A75T",     // 10
93
        "XC7A100T",    // 11
94
        "XC7A200T",    // 12
95
        "Quad-XC6SLX150",  // 13
96
        "XC7A15T",     // 14
97
};}</pre>
98
  **/
99
    public static final String fpgas[] = {
100
        "(unknown)" ,  // 0
101
        "XC6SLX9" ,    // 1
102
        "XC6SLX16" ,   // 2
103
        "XC6SLX25" ,   // 3
104
        "XC6SLX45" ,   // 4
105
        "XC6SLX75" ,   // 5
106
        "XC6SLX100" ,  // 6
107
        "XC6SLX150" ,  // 7
108
        "XC7A35T",     // 8
109
        "XC7A50T",     // 9
110
        "XC7A75T",     // 10
111
        "XC7A100T",    // 11
112
        "XC7A200T",    // 12
113
        "Quad-XC6SLX150",  // 13
114
        "XC7A15T",     // 14
115
    };
116
 
117
/** * FPGA packages used on ZTEX FPGA boards.
118
  * It's defined as
119
  * <pre>{@code
120
public static final String packages[] = {
121
        "(unknown)",  // 0
122
        "FTG256" ,    // 1  256 balls, 1.0mm
123
        "CSG324" ,    // 2  324 balls, 0.8mm
124
        "CSG484" ,    // 3  484 balls, 0.8mm
125
        "FBG484"      // 4  484 balls, 1.0mm
126
};}</pre>
127
  **/
128
    public static final String packages[] = {
129
        "(unknown)",  // 0
130
        "FTG256" ,    // 1  256 balls, 1.0mm
131
        "CSG324" ,    // 2  324 balls, 0.8mm
132
        "CSG484" ,    // 3  484 balls, 0.8mm
133
        "FBG484"      // 4  484 balls, 1.0mm
134
    };
135
 
136
/** * RAM types and speed used on ZTEX FPGA boards.
137
  * It's defined as
138
  * <pre>{@code
139
public static final String ramTypes[] = {
140
        "(unknown)",        // 0
141
        "DDR-200 SDRAM",    // 1
142
        "DDR-266 SDRAM",    // 2
143
        "DDR-333 SDRAM",    // 3
144
        "DDR-400 SDRAM",    // 4
145
        "DDR2-400 SDRAM",   // 5
146
        "DDR2-533 SDRAM",   // 6
147
        "DDR2-667 SDRAM",   // 7
148
        "DDR2-800 SDRAM",   // 8
149
        "DDR2-1066 SDRAM"   // 9
150
};}</pre>
151
  **/
152
    public static final String ramTypes[] = {
153
        "(unknown)",        // 0
154
        "DDR-200 SDRAM",    // 1
155
        "DDR-266 SDRAM",    // 2
156
        "DDR-333 SDRAM",    // 3
157
        "DDR-400 SDRAM",    // 4
158
        "DDR2-400 SDRAM",   // 5
159
        "DDR2-533 SDRAM",   // 6
160
        "DDR2-667 SDRAM",   // 7
161
        "DDR2-800 SDRAM",   // 8
162
        "DDR2-1066 SDRAM",  // 9
163
        "DDR3-800 SDRAM",   // 10
164
        "DDR3-1066 SDRAM"   // 11
165
    };
166
 
167
    private byte[] data = new byte[128];  // data buffer
168
    private Ztex1v1 ztex = null;
169
 
170
 
171
/**
172
 * Constructs an empty instance.
173
 */
174
   public ConfigData() {
175
        data[0] = 67;
176
        data[1] = 68;
177
        data[2] = 48;
178
        for ( int i=3; i<128; i++)
179
            data[i] = 0;
180
        for ( int i=16; i<26; i++)
181
            data[i] = 48;
182
   }
183
 
184
/**
185
  * Constructs an instance and connects it with z. Also see {@link #connect(Ztex1v1)}.
186
  * @param z The ztex device to connect with.
187
  * @throws InvalidFirmwareException if interface 1 is not supported.
188
  * @throws UsbException If a communication error occurs.
189
  * @throws CapabilityException If no MAC-EEPROM support is present.
190
  */
191
   public ConfigData( Ztex1v1 z ) throws InvalidFirmwareException, UsbException, CapabilityException {
192
        this();
193
        connect(z);
194
   }
195
 
196
 
197
/**
198
  * Reads the configuration data (if existent) from a device and connects it to this instance.
199
  * After this user defined settings (e.g. serial number, bitstream size) are
200
  * stored on device immediately after they are altered.
201
  * @param z The ztex device to connect with.
202
  * @return True if configuration data could be read.
203
  * @throws InvalidFirmwareException If interface 1 is not supported.
204
  * @throws UsbException If a communication error occurs.
205
  * @throws CapabilityException If no MAC-EEPROM support is present.
206
  */
207
   public boolean connect( Ztex1v1 z ) throws InvalidFirmwareException, UsbException, CapabilityException {
208
        ztex = z;
209
        if ( ztex == null ) return false;
210
 
211
        byte[] buf = new byte[128];
212
        ztex.macEepromRead(0,buf,128);
213
        if ( buf[0]==67 && buf[1]==68 && buf[2]==48 ) {
214
            for ( int i=3; i<128; i++)
215
                data[i] = buf[i];
216
            return true;
217
        }
218
        return false;
219
   }
220
 
221
 
222
/**
223
  * Disconnects the currently connected device.
224
  * After this modified settings are not stored on device anymore.
225
  * @return True if a device was connected.
226
  */
227
   public boolean disconnect() {
228
        if ( ztex == null ) return false;
229
        ztex = null;
230
        return true;
231
    }
232
 
233
 
234
/**
235
  * Returns a copy of the configuration data array.
236
  * @return A copy of the configuration data array.
237
  */
238
   public byte[] data () {
239
        byte[] buf = new byte[128];
240
        for ( int i=0; i<128; i++)
241
            buf[i] = data[i];
242
        return buf;
243
   }
244
 
245
 
246
/**
247
  * Returns a string of an array of strings including range check.
248
  */
249
   private String stringOfArray (String[] a, int i) {
250
        if ( i > a.length || i < 0 ) i = 0;
251
        return a[i];
252
    }
253
 
254
 
255
/**
256
  * Finds a string from array.
257
  */
258
   private int findFromArray ( String[] a, String s) {
259
        int i = 0;
260
        while ( i < a.length && !a[i].equals(s) ) i++;
261
        if ( i >= a.length ) {
262
            System.err.print("Invalid value: `" + s + "'. Possible values: `" + a[1] + "'");
263
            for (int j=2; j<a.length; j++ )
264
                System.out.print(", `" + a[j] + "'");
265
            System.out.println();
266
            i = 0;
267
        }
268
        return i;
269
    }
270
 
271
 
272
/**
273
  * Returns a string from data.
274
  */
275
   private String stringFromData (int start, int maxlen) {
276
        int i = 0;
277
        while ( i < maxlen && data[start+i] != 0 ) i++;
278
        return new String(data,start,i);
279
    }
280
 
281
 
282
/**
283
  * send data
284
  * returns true if data was sent
285
  */
286
   private boolean sendData ( int start, int len) throws InvalidFirmwareException, UsbException, CapabilityException {
287
        if ( ztex == null ) return false;
288
        if ( start < 0 ) start = 0;
289
        if ( len > 128-start ) len = 128-start;
290
        if ( len <= 0 ) return false;
291
        byte[] buf = new byte[len];
292
        for ( int i=0; i<len; i++ )
293
            buf[i] = data[start+i];
294
        ConfigData c = ztex.config;
295
        ztex.config = null;
296
        ztex.macEepromWrite(start,buf,len);
297
        ztex.config = c;
298
        return true;
299
    }
300
 
301
/**
302
  * Convert string to data.
303
  */
304
   private void stringToData (String s, int start, int maxlen) {
305
        if ( s == null ) {
306
            for ( int i=0; i<maxlen; i++ ) {
307
                data[start+i] = 0;
308
            }
309
        }
310
        else {
311
            byte buf[] = s.getBytes();
312
            for ( int i=0; i<maxlen; i++ ) {
313
                data[start+i] = i<buf.length ? buf[i] : 0;
314
            }
315
        }
316
    }
317
 
318
/**
319
  * Returns the name of the FPGA Board.
320
  * @return The name of the FPGA Board.
321
  */
322
   public String getName () {
323
        return stringOfArray(boardNames,data[3]) + " " + data[4] + "." +  (data[5] / 10) + (data[5] % 10) + stringFromData(6,2);
324
   }
325
 
326
/**
327
  * Returns the major version number, e.g. 2 for USB-FPGA Modules 2.14b.
328
  * @return the major version number.
329
  */
330
   public byte getMajorVersion () {
331
        return data[4];
332
   }
333
 
334
/**
335
  * Returns the minor version number, e.g. 14 for USB-FPGA Modules 2.14b.
336
  * @return the minor version number.
337
  */
338
   public byte getMinorVersion () {
339
        return data[5];
340
   }
341
 
342
/**
343
  * Returns the variant letter, e.g. "b" for USB-FPGA Modules 2.14b.
344
  * @return the variant letter.
345
  */
346
   public String getVariant () {
347
        return stringFromData(6,2);
348
   }
349
 
350
 
351
/**
352
  * Sets the name of the FPGA Board.
353
  * Example: <pre>setName("ZTEX USB-FPGA Module", 2, 16, "b");  // denotes "ZTEX USB-FPGA Module 2.16b"</pre>
354
  * This setting is not transferred to the FPGA Board because is should not be altered by the user.
355
  * @param kind Kind of FPGA Board, see {@link #boardNames} for possible values, e.g. "ZTEX USB-FPGA Module"
356
  * @param series FPGA Board series, e.g. 2
357
  * @param number FPGA Board number (number behind the dot), e.g. 16
358
  * @param variant FPGA Board variant (letter), e.g. "b"
359
 */
360
   public void setName ( String kind, int series, int number, String variant) {
361
        data[3] = (byte) findFromArray(boardNames, kind);
362
        data[4] = (byte) (series & 255);
363
        data[5] = (byte) (number & 255);
364
        stringToData(variant,6,2);
365
   }
366
 
367
/**
368
  * Returns FPGA information.
369
  * Notation of the result is &lt;name&gt;-&lt;package&gt;-&lt;speed grade and temperature range&gt;, e.g. XC7A200T-FBG484-2C.
370
  * @return FPGA Information.
371
  */
372
   public String getFpga () {
373
        return stringOfArray(fpgas, (data[8] & 255) | ((data[9] & 255) << 8)) + "-" + stringOfArray(packages, data[10]) + "-" + stringFromData(11,3);
374
   }
375
 
376
/**
377
  * Sets FPGA information.
378
  * Example: <pre>setFpga("XC7A200T", "FBG484", "2C");   // denotes Xilinx part number XC7A200T-2FBG484C</pre>
379
  * This setting is not transferred to the FPGA Board because is should not be altered by the user.
380
  * @param name Name of the FPGA, see {@link #fpgas} for possible values, e.g. "XC7A200T"
381
  * @param pckg FPGA package, see {@link #packages} for possible values, e.g. "FBG484"
382
  * @param sg Speed grade and temperature range, e.g. "2C"
383
 */
384
   public void setFpga ( String name, String pckg, String sg) {
385
        int i = findFromArray(fpgas, name);
386
        data[8] = (byte) (i & 255);
387
        data[9] = (byte) ((i>>8) & 255);
388
        data[10] = (byte) findFromArray(packages, pckg);
389
        stringToData(sg,11,3);
390
   }
391
 
392
/**
393
  * Returns RAM type and speed.
394
  * @return FPGA Information.
395
  */
396
   public String getRamType () {
397
        return stringOfArray(ramTypes, (data[15] & 255));
398
   }
399
 
400
/**
401
  * Returns RAM size in bytes.
402
  * @return RAM size in bytes.
403
  */
404
   public int getRamSize () {
405
        return (data[14] & 0xf0) << ( (data[14] & 0xf) + 16 );
406
   }
407
 
408
/**
409
  * Sets RAM information.
410
  * Example: <pre>setRam(128, "DDR2-800 SDRAM");   // sets RAM info to 128 MB DDR2-800 SDRAM</pre>
411
  * This setting is not transferred to the FPGA Board because is should not be altered by the user.
412
  * @param size RAM size in MBytes, e.g. 128
413
  * @param type RAM type and speed, see {@link #ramTypes} for possible values, e.g. "DDR2-800 SDRAM"
414
 */
415
   public void setRam ( int size, String type) {
416
        if (size<0 || size>480*1024) {
417
            System.err.println("Warning: Invalid RAM size: `" + size + "'. Possible values are 0 to 480*1024.");
418
            size = 0;
419
        }
420
        int i=0;
421
        while (size >= 16) {
422
            i++;
423
            size = size >> 1;
424
        }
425
        data[14] = (byte) ((size << 4) | (i & 15));
426
        data[15] = (byte) findFromArray(ramTypes, type);
427
   }
428
 
429
/**
430
  * Returns maximum size of bitstream in bytes.
431
  * This is the amount of flash which should be reserved for the bitstream.
432
  * @return Maximum size of bitstream in bytes sectors.
433
  */
434
   public int getMaxBitstreamSize () {
435
        return ( (data[28] & 255) | ((data[29] & 255) << 8) ) * 4096;
436
   }
437
 
438
/**
439
  * Sets the maximum size of bitstream in 4 KByte sectors.
440
  * This setting is not transferred to the FPGA Board because is should not be altered by the user.
441
  * @param size4k Maximum size of bitstream in 4 KByte sectors. E.g. a value of 256 reserves 1 MByte for the bitstream.
442
 */
443
   public void setMaxBitstreamSize ( int size4k ) {
444
        data[28] = (byte) (size4k & 255);
445
        data[29] = (byte) ((size4k>> 8) & 255);
446
   }
447
 
448
/**
449
  * Returns bitstream start position in bytes.
450
  * On devices which boot from flash the first sectors are reserved for the firmware.
451
  * @return Bitstream start position in bytes.
452
  */
453
   public int getBitstreamStart () {
454
        return ( (data[30] & 255) | ((data[31] & 255) << 8) ) * 4096;
455
   }
456
 
457
/**
458
  * Sets the start position of the bitstream in 4 KByte sectors.
459
  * This setting is not transferred to the FPGA Board because is should not be altered by the user.
460
  * @param start4k Bitstream start position in 4 KByte sectors. E.g. a value of 128 reserves 512 KByte for the bitstream.
461
 */
462
   public void setBitstreamStart ( int start4k ) {
463
        data[30] = (byte) (start4k & 255);
464
        data[31] = (byte) ((start4k>> 8) & 255);
465
   }
466
 
467
/**
468
  * Returns actual size of bitstream in bytes sectors.
469
  * 0 means that no bitstream is stored. The value is rounded up to a multiples of 4096.
470
  * @return Actual size of bitstream in byte sectors.
471
  */
472
   public int getBitstreamSize () {
473
        return ( (data[26] & 255) | ((data[27] & 255) << 8) ) * 4096;
474
   }
475
 
476
/**
477
  * Sets the actual size of bitstream in bytes. The value is rounded up to a multiple of 4096.
478
  * If a device is connected, this setting is transferred to the FPGA Board.
479
  * A warning is printed if bitstream size is larger then the reserved size (see {@link #getMaxBitstreamSize()}).
480
  * @param size Actual size of bitstream in bytes.
481
  * @return True if a device is connected and setting was send.
482
  * @throws InvalidFirmwareException If interface 1 is not supported.
483
  * @throws UsbException If a communication error occurs.
484
  * @throws CapabilityException If no MAC-EEPROM support is present.
485
 */
486
   public boolean setBitstreamSize ( int size ) throws InvalidFirmwareException, UsbException, CapabilityException {
487
        if ( size < 0 ) size = 0;
488
        size = (size + 4095) >> 12;
489
        int i = (data[28] & 255) | ((data[29] & 255) << 8);
490
        if ( size > i )  System.err.println("Warning: Bitstream size of " + size + " 4K sectors larger than reserved memory of " + i + " 4K sectors");
491
        data[26] = (byte) (size & 255);
492
        data[27] = (byte) ((size>> 8) & 255);
493
        return sendData(26,2);
494
   }
495
 
496
/**
497
  * Sets the serial number.
498
  * During start-up the firmware overwrites SN_STRING from the ZTEX descriptor (see {@link ZtexDevice1}) by this value.
499
  * If it is equal to "0000000000" (default) it is replaced by the unique MAC address. <p>
500
  * This setting is transferred to the FPGA Board.
501
  * Change takes effect after the next restart of the firmware.
502
  * @param sn Serial number string. Only the first 10 characters are considered.
503
  * @return True if a device is connected and setting was send.
504
  * @throws InvalidFirmwareException If interface 1 is not supported.
505
  * @throws UsbException If a communication error occurs.
506
  * @throws CapabilityException If no MAC-EEPROM support is present.
507
 */
508
   public boolean setSN ( String sn ) throws InvalidFirmwareException, UsbException, CapabilityException {
509
        stringToData(sn,16,10);
510
        return sendData(16,10);
511
   }
512
 
513
/**
514
  * Set the USB vendor vendor and product ID.
515
  * If vendor ID is 0 the default values from the firmware are used.
516
  * @param vid USB vendor ID.
517
  * @param pid USB product ID.
518
  * <p> This settings are transferred to the FPGA Board.
519
  * Change takes effect after the next restart of the firmware.
520
  * @return True if a device is connected and setting was send.
521
  * @throws InvalidFirmwareException If interface 1 is not supported.
522
  * @throws UsbException If a communication error occurs.
523
  * @throws CapabilityException If no MAC-EEPROM support is present.
524
 */
525
   public boolean setUsbIDs (int vid, int pid) throws InvalidFirmwareException, UsbException, CapabilityException {
526
        data[32] = (byte) (vid & 255);
527
        data[33] = (byte) ((vid>> 8) & 255);
528
        data[34] = (byte) (pid & 255);
529
        data[35] = (byte) ((pid>> 8) & 255);
530
        return sendData(32,4);
531
   }
532
 
533
/**
534
  * Sets the product string.
535
  * If string is empty the firmware default is used.
536
  * <p> This setting is transferred to the FPGA Board.
537
  * Change takes effect after the next restart of the firmware.
538
  * @param ps The product string.
539
  * @return True if a device is connected and setting was send.
540
  * @throws InvalidFirmwareException If interface 1 is not supported.
541
  * @throws UsbException If a communication error occurs.
542
  * @throws CapabilityException If no MAC-EEPROM support is present.
543
 */
544
   public boolean setProductString ( String ps ) throws InvalidFirmwareException, UsbException, CapabilityException {
545
        stringToData(ps,36,32);
546
        return sendData(36,32);
547
   }
548
 
549
/**
550
  * Returns user data at index i.
551
  * @param i the index. Valid values are 0 to 47.
552
  * @return User data.
553
  * @throws IndexOutOfBoundsException If i is smaller than 0 or greater than 47.
554
  */
555
   public byte getUserData (int i) {
556
        if ( i<0 || i>47 ) throw new IndexOutOfBoundsException ( "Invalid index: " + i + ". Valid range is 0 to 47.");
557
        return data[80+i];
558
   }
559
 
560
/**
561
  * Sets user data at index i to value v. Use the method {@link #getMaxBitstreamSize()}
562
  * to transfer the data to the FPGA Board.
563
  * @param i The index. Valid values are 0 to 47.
564
  * @param v The value.
565
  * @throws IndexOutOfBoundsException If i is smaller than 0 or greater than 47.
566
  */
567
   public void setUserData (int i, byte v) throws IndexOutOfBoundsException {
568
        if ( i<0 || i>47 ) throw new IndexOutOfBoundsException ( "Invalid index: " + i + ". Valid range is 0 to 47.");
569
        data[80+i] = v;
570
   }
571
 
572
/**
573
  * Sends the user data to the FPGA Board.
574
  * @return True if a device is connected and data could be send.
575
  * @throws InvalidFirmwareException If interface 1 is not supported.
576
  * @throws UsbException If a communication error occurs.
577
  * @throws CapabilityException If no MAC-EEPROM support is present.
578
  */
579
   public boolean sendtUserData () throws InvalidFirmwareException, UsbException, CapabilityException {
580
        return sendData(80,48);
581
   }
582
 
583
/**
584
  * Returns the bitstream path if the same directory sheme as for the examples is used.
585
  * For USB-FPGA Modules 1.* and 2.0* (Spartan 6 FPGA) it is "usb-fpga-<major version number>.<minor version number><variant letter>/<project name>.bit",
586
  * for later FPGA Boards it is "usb-fpga-<major version number>.<minor version number>/<project name>.runs/impl_<major version number>.<minor version number><variant letter>/<project name>.bit".
587
  * @param name The project name.
588
  * @return Standard bitstream path.
589
  */
590
   public String defaultBitstreamPath(String name) {
591
        return ( (getMajorVersion()<2) || ( (getMajorVersion()==2) && getMinorVersion()<10) ) ?
592
            "fpga-" + getMajorVersion() + "." + ( getMinorVersion() / 10 ) +  ( getMinorVersion() % 10 ) + ztex.config.getVariant() + "/" + name + ".bit" :
593
            "fpga-" + getMajorVersion() + "." + ( getMinorVersion() / 10 ) +  ( getMinorVersion() % 10 ) + "/" + name + ".runs/impl_" + getMajorVersion() + "_" + ( getMinorVersion() / 10 ) +  ( getMinorVersion() % 10 ) + ztex.config.getVariant() + "/" + name + ".bit";
594
   }
595
 
596
 
597
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.