OpenCores
URL https://opencores.org/ocsvn/fpga-cf/fpga-cf/trunk

Subversion Repositories fpga-cf

[/] [fpga-cf/] [trunk/] [java/] [src/] [edu/] [byu/] [cc/] [plieber/] [fpgaenet/] [debug/] [llparse/] [LL_Virtex5.java] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 peteralieb
/* Generated By:JavaCC: Do not edit this line. LL_Virtex5.java */
2
/*
3
@LICENSE@
4
*/
5
package edu.byu.cc.plieber.fpgaenet.debug.llparse;
6
import java.lang.*;
7
import java.util.*;
8
 
9
/**
10
 * The Xilinx Logical Allocation file (.ll file) parser for Virtex2
11
 * FPGAs. The parser fills two <code>Hashtable</code> objects with the
12
 * readback bitstream information for state elements in the Virtex5
13
 * design.  One <code>Hashtable</code> is filled with RAM bitstream
14
 * information keyed on physical location (block name) while the
15
 * second holds the bitstream information for flip-flops keyed on
16
 * physical location (block name).  The grammar is not published but
17
 * was developed from looking at the file format.
18
 *
19
 * @author Paul Graham
20
 * @author Peter Lieber */
21
public class LL_Virtex5 implements LL_Virtex5Constants {
22
 
23
  /**
24
   * A <code>HashTable</code> to allow quick access to {@link
25
   * RAMGroup} objects based on block name and RAM type. The
26
   * <code>RAMGroup</code> objects contain {@link RAMRBEntry} objects
27
   * which hold the actual bitstream offsets.  */
28
  Hashtable<String, RAMGroup > RAMGroupHash;
29
 
30
  /**
31
   * A <code>Hashtable</code> of {@link LatchRBEntry} objects to allow
32
   * quick access based on block name and latch type.  The
33
   * <code>LatchRBEntry</code> is used for flip-flops and stores
34
   * bitstream offset information. */
35
  Hashtable<String, LatchRBEntry > NetHashBlock;
36
 
37
  /** The number of nets associated with latches in the .ll file */
38
  int netCount;
39
 
40
  /** The number of RAM entries in the .ll file */
41
  int ramCount;
42
 
43
  /**
44
   * Indicates whether the LL file provides absolute offsets. First
45
   * needed with the Xilinx 4.1 ISE tools*/
46
  boolean absOffsets;
47
 
48
  /**
49
   * Instances and initializes the parser and parses the input from
50
   * <code>System.in</code>
51
   *
52
   * @param args Command line arguments (ignored by the method)
53
   * */
54
  public static void main(String args[]) throws ParseException {
55
    LL_Virtex5 parser = new LL_Virtex5(System.in);
56
    parser.initTables();
57
    parser.parseLL();
58
  }
59
 
60
  /**
61
   * Initializes the <code>Hashtables</code> and counts.  */
62
  public void initTables() {
63
    RAMGroupHash = new Hashtable<String, RAMGroup >();
64
    NetHashBlock = new Hashtable<String, LatchRBEntry >();
65
    netCount = 0;
66
    ramCount = 0;
67
    absOffsets = false;
68
  }
69
 
70
  /**
71
   * Returns a reference to the <code>RAMGroupHash</code>, which holds
72
   * a {@link RAMGroup} object for each RAM in the .ll file keyed on
73
   * the location of the RAM and the RAM type (F, G, M, or B).
74
   *
75
   * @return Reference to <code>RAMGroupHash</code> */
76
  public Hashtable<String, RAMGroup > getRAMGroupHash() {
77
    return RAMGroupHash;
78
  }
79
 
80
  /**
81
   * Returning a reference to the <code>NetHashBlock</code>, which
82
   * holds a {@link LatchRBEntry} for each flip-flop in the .ll file
83
   * keyed on the location and the latch type (XQ, YQ, etc.)
84
   *
85
   * @return Reference to <code>NetHashBlock</code> */
86
  public Hashtable<String, LatchRBEntry > getNetHashBlock() {
87
    return NetHashBlock;
88
  }
89
 
90
  /**
91
   * Returns true if the LL file provides absolute offsets and false
92
   * otherwise.  Absolute readback bitstream offsets started appearing
93
   * in the Xilinx ISE 4.1i series of tools.
94
   *
95
   * @return <code>true</code> if absolute offsets are provide,
96
   * <code>false</code> otherwise.  */
97
  public boolean hasAbsoluteOffsets() {
98
    return absOffsets;
99
  }
100
 
101
/**
102
 * Defines the various flip-flop types and returns the type as
103
 * a <code>String</code>.
104
 *
105
 * @return <code>String</code> for flip-flop type. */
106
  final public String LatchType() throws ParseException {
107
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
108
    case AQ:
109
      jj_consume_token(AQ);
110
       {if (true) return token.toString();}
111
      break;
112
    case BQ:
113
      jj_consume_token(BQ);
114
        {if (true) return token.toString();}
115
      break;
116
    case CQ:
117
      jj_consume_token(CQ);
118
        {if (true) return token.toString();}
119
      break;
120
    case DQ:
121
      jj_consume_token(DQ);
122
        {if (true) return token.toString();}
123
      break;
124
    case Q1:
125
      jj_consume_token(Q1);
126
        {if (true) return token.toString();}
127
      break;
128
    case Q2:
129
      jj_consume_token(Q2);
130
        {if (true) return token.toString();}
131
      break;
132
    case I:
133
      jj_consume_token(I);
134
       {if (true) return token.toString();}
135
      break;
136
    case O:
137
      jj_consume_token(O);
138
       {if (true) return token.toString();}
139
      break;
140
    default:
141
      jj_la1[0] = jj_gen;
142
      jj_consume_token(-1);
143
      throw new ParseException();
144
    }
145
    throw new Error("Missing return statement in function");
146
  }
147
 
148
/**
149
 * Initiates the parsing of an <code>.ll</code> file and prints out
150
 * statistics about the number of flip-flops (latches) and RAMs it
151
 * found.*/
152
  final public void parseLL() throws ParseException {
153
    Revision();
154
    label_1:
155
    while (true) {
156
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
157
      case BIT:
158
      case INFO:
159
        ;
160
        break;
161
      default:
162
        jj_la1[1] = jj_gen;
163
        break label_1;
164
      }
165
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
166
      case BIT:
167
        BitStreamEntry();
168
        break;
169
      case INFO:
170
        InfoEntry();
171
        break;
172
      default:
173
        jj_la1[2] = jj_gen;
174
        jj_consume_token(-1);
175
        throw new ParseException();
176
      }
177
    }
178
    jj_consume_token(0);
179
  System.out.println("Total Block/Latch Entries: "+
180
                     Integer.toString(NetHashBlock.size())+ " Total Nets:" +
181
                     Integer.toString(netCount));
182
  System.out.println("Number of RAMGroup Entries: "+
183
                     Integer.toString(RAMGroupHash.size())+
184
                     " Total RAM entries:" + Integer.toString(ramCount));
185
  System.out.flush();
186
  }
187
 
188
/**
189
 * Parses the revision information for the .ll file.
190
 */
191
  final public void Revision() throws ParseException {
192
    jj_consume_token(REVISION);
193
    jj_consume_token(NUM);
194
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
195
    case 44:
196
      jj_consume_token(44);
197
      break;
198
    case 45:
199
      jj_consume_token(45);
200
      break;
201
    case 46:
202
      jj_consume_token(46);
203
      break;
204
    default:
205
      jj_la1[3] = jj_gen;
206
      jj_consume_token(-1);
207
      throw new ParseException();
208
    }
209
  }
210
 
211
/**
212
 * Parses the entire clause having the type of the flip-flop and
213
 * returns the flip-flop type as a String.
214
 *
215
 * @return Flip-flop type as <code>String</code>. */
216
  final public String Latch() throws ParseException {
217
  String latchtype;
218
    jj_consume_token(LATCH);
219
    jj_consume_token(EQUAL);
220
    latchtype = LatchType();
221
                                         {if (true) return latchtype;}
222
    throw new Error("Missing return statement in function");
223
  }
224
 
225
/**
226
 * Parses the net names associated with latches and stores a
227
 * <code>LatchRBEntry</code> object in the <code>NetHashBlock
228
 * Hashtable</code>.  The method handles both angle brackets ("<>")
229
 * and square brackets ("[]") for net names.  In some strange
230
 * circumstances, it was necessary to handle names which extended
231
 * beyond the array naming construct (in other words, there was still
232
 * part of the name after the last "]" or ">").  In these cases, the
233
 * names are considered atomic (not multi-bit), so the index variable
234
 * is reset to "-1".
235
 *
236
 * @param offset The first offset provided by the LL file for this
237
 *               flip-flop; it is actually a junk bit in the readback
238
 *               bitstream.
239
 *
240
 * @param frame The frame number for this flip-flops readback data
241
 *              provided by the LL file.
242
 *
243
 * @param frameOffset The offset within the frame for this flip-flop's
244
 *                    readback data provided by the LL file.
245
 *
246
 * @param block The block's name and location.
247
 *
248
 * @param latchType The type of the flip-flop.
249
 **/
250
  final public void NetName(int offset, int frame, int frameOffset, String block, String latchType) throws ParseException {
251
  String netname;
252
  int index=-1;
253
  boolean extended=false;
254
  LatchRBEntry lrbe;
255
    jj_consume_token(ID);
256
         netname = token.toString();
257
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
258
    case LANGLE:
259
    case LBRACKET:
260
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
261
      case LANGLE:
262
        jj_consume_token(LANGLE);
263
        jj_consume_token(NUM);
264
          index = Integer.parseInt(token.toString());
265
        jj_consume_token(RANGLE);
266
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
267
        case NETEXT:
268
          jj_consume_token(NETEXT);
269
     netname = new String(netname+"<"+Integer.toString(index)+">"+token.toString());
270
     index = -1;
271
     extended = true;
272
          break;
273
        default:
274
          jj_la1[4] = jj_gen;
275
          ;
276
        }
277
        break;
278
      case LBRACKET:
279
        jj_consume_token(LBRACKET);
280
        jj_consume_token(NUM);
281
          index = Integer.parseInt(token.toString());
282
        jj_consume_token(RBRACKET);
283
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
284
        case NETEXT:
285
          jj_consume_token(NETEXT);
286
     netname = new String(netname+"["+Integer.toString(index)+"]"+token.toString());
287
     index = -1;
288
     extended = true;
289
          break;
290
        default:
291
          jj_la1[5] = jj_gen;
292
          ;
293
        }
294
        break;
295
      default:
296
        jj_la1[6] = jj_gen;
297
        jj_consume_token(-1);
298
        throw new ParseException();
299
      }
300
      break;
301
    default:
302
      jj_la1[7] = jj_gen;
303
      ;
304
    }
305
        if(!block.equals("DUMMY")) {
306
          lrbe = new LatchRBEntry(offset,frame,frameOffset,block,latchType,netname,index);
307
          netCount++;
308
          NetHashBlock.put(block+latchType, lrbe);
309
        }
310
  }
311
 
312
/**
313
 * Parses the entire "Net=..." clause.
314
 *
315
 * @param offset The first offset provided by the LL file for this
316
 *               flip-flop; it is actually a junk bit in the readback
317
 *               bitstream.
318
 *
319
 * @param frame The frame number for this flip-flops readback data
320
 *              provided by the LL file.
321
 *
322
 * @param frameOffset The offset within the frame for this flip-flop's
323
 *                    readback data provided by the LL file.
324
 *
325
 * @param block The block's name and location.
326
 *
327
 * @param latchType The type of the flip-flop.
328
 */
329
  final public void Net(int offset, int frame, int frameOffset, String block, String latchType) throws ParseException {
330
    jj_consume_token(NET);
331
    jj_consume_token(EQUAL);
332
    NetName(offset,frame,frameOffset,block,latchType);
333
  }
334
 
335
/**
336
 * Parses the "Ram=..." clauses of the RAM LL entries for lut rams and enters the
337
 * data into the <code>RAMGroupHash</code>. Since a certain RAM may
338
 * already have a <code>RAMGroup</code> entry in the
339
 * <code>RAMGroupHash</code>, the method performs a lookup first to
340
 * see if the RAM's <code>RAMGroup</code> entry exists.  If the entry
341
 * exists, the method adds a <code>RAMRBEntry</code> to the
342
 * <code>RAMGroup</code> which was found.  Otherwise, the method
343
 * creates a new <code>RAMGroup</code> and adds an
344
 * <code>RAMRBEntry</code> to it. This method handles both LUT RAMs
345
 * and BlockRAMs.
346
 *
347
 * @param offset The first offset provided by the LL file for this
348
 *               flip-flop; it is actually a junk bit in the readback
349
 *               bitstream.
350
 *
351
 * @param frame The frame number for this flip-flops readback data
352
 *              provided by the LL file.
353
 *
354
 * @param frameOffset The offset within the frame for this flip-flop's
355
 *                    readback data provided by the LL file.
356
 *
357
 * @param block The block's name and location.  */
358
  final public void SliceRam(int offset, int frame, int frameOffset, String block) throws ParseException {
359
  String lutType;
360
  int address;
361
  RAMGroup rg;
362
  RAMRBEntry rrb;
363
  String key;
364
    jj_consume_token(RAM);
365
    jj_consume_token(EQUAL);
366
    jj_consume_token(LUT);
367
         lutType = token.toString();
368
    jj_consume_token(COLON);
369
    jj_consume_token(NUM);
370
    try {
371
      address = Integer.parseInt(token.toString());
372
      rrb = new RAMRBEntry(offset,frame,frameOffset,block,lutType,address);
373
      ramCount++;
374
      key = new String(block+"."+lutType);
375
      rg = (RAMGroup)RAMGroupHash.get(key);
376
      if(rg == null) {
377
        RAMGroupHash.put(key,new RAMGroup(rrb));
378
      }
379
      else {
380
        rg.addRAMEntry(rrb);
381
      }
382
    }
383
    catch (RAMTypeException rte) {
384
      System.out.println("Caught Exception: " + rte.toString());
385
      System.out.println("Wrong RAM Type: Are you using the proper part type? (Virtex5)");
386
      rte.printStackTrace();
387
    }
388
  }
389
 
390
/**
391
 * Parses the "Ram=..." clauses of the RAM LL entries for BRAMs and enters the
392
 * data into the <code>RAMGroupHash</code>. Since a certain RAM may
393
 * already have a <code>RAMGroup</code> entry in the
394
 * <code>RAMGroupHash</code>, the method performs a lookup first to
395
 * see if the RAM's <code>RAMGroup</code> entry exists.  If the entry
396
 * exists, the method adds a <code>RAMRBEntry</code> to the
397
 * <code>RAMGroup</code> which was found.  Otherwise, the method
398
 * creates a new <code>RAMGroup</code> and adds an
399
 * <code>RAMRBEntry</code> to it. This method handles both LUT RAMs
400
 * and BlockRAMs.
401
 *
402
 * @param offset The first offset provided by the LL file for this
403
 *               flip-flop; it is actually a junk bit in the readback
404
 *               bitstream.
405
 *
406
 * @param frame The frame number for this flip-flops readback data
407
 *              provided by the LL file.
408
 *
409
 * @param frameOffset The offset within the frame for this flip-flop's
410
 *                    readback data provided by the LL file.
411
 *
412
 * @param block The block's name and location.  */
413
  final public void BRam(int offset, int frame, int frameOffset, String block) throws ParseException {
414
  String lutType;
415
  int address;
416
  RAMGroup rg;
417
  RAMRBEntry rrb;
418
  String key;
419
    jj_consume_token(RAM);
420
    jj_consume_token(EQUAL);
421
    jj_consume_token(LUT);
422
         lutType = token.toString();
423
    jj_consume_token(COLON);
424
    jj_consume_token(ID);
425
    try {
426
      String bitAddress = token.toString();
427
      // We need to skip the PARBIT prefix used for block ram parity bits
428
      if( bitAddress.charAt(0) == 'P' )
429
        address = Integer.parseInt(bitAddress.substring(6));
430
      // We need to skip the BIT prefix used for block ram data bits
431
      else
432
        address = Integer.parseInt(bitAddress.substring(3));
433
      rrb = new RAMRBEntry(offset,frame,frameOffset,block,lutType,address);
434
      ramCount++;
435
      key = new String(block+"."+lutType);
436
      rg = (RAMGroup)RAMGroupHash.get(key);
437
      if(rg == null) {
438
        RAMGroupHash.put(key,new RAMGroup(rrb));
439
      }
440
      else {
441
        rg.addRAMEntry(rrb);
442
      }
443
    }
444
    catch (RAMTypeException rte) {
445
      System.out.println("Caught Exception: " + rte.toString());
446
      System.out.println("Wrong RAM Type: Are you using the proper part type? (Virtex2, XC4K, etc.)");
447
      rte.printStackTrace();
448
    }
449
  }
450
 
451
/**
452
 * Parses "Rom=..." entries, but doesn't do anything with them.
453
 */
454
  final public void Rom() throws ParseException {
455
    jj_consume_token(ROM);
456
    jj_consume_token(EQUAL);
457
    jj_consume_token(LUT);
458
    jj_consume_token(COLON);
459
    jj_consume_token(NUM);
460
  }
461
 
462
/**
463
 * Parses "YES/NO" clauses.
464
 */
465
  final public void YesNo() throws ParseException {
466
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
467
    case YES:
468
      jj_consume_token(YES);
469
      break;
470
    case NO:
471
      jj_consume_token(NO);
472
      break;
473
    default:
474
      jj_la1[8] = jj_gen;
475
      jj_consume_token(-1);
476
      throw new ParseException();
477
    }
478
  }
479
 
480
/**
481
 * Parses "COMPARE=..." clauses, which are otherwise ignored.
482
 */
483
  final public void Compare() throws ParseException {
484
    jj_consume_token(COMPARE);
485
    jj_consume_token(EQUAL);
486
    YesNo();
487
  }
488
 
489
/**
490
 * Parses the "attributes" of a state bit in the readback bitstream,
491
 * which define whether it belongs to a flip-flop, a RAM, or a ROM and
492
 * other related information.  This is really the core of the parsing work.
493
 *
494
 * @param offset The first offset provided by the LL file for this
495
 *               flip-flop; it is actually a junk bit in the readback
496
 *               bitstream.
497
 *
498
 * @param frame The frame number for this flip-flops readback data
499
 *              provided by the LL file.
500
 *
501
 * @param frameOffset The offset within the frame for this flip-flop's
502
 *                    readback data provided by the LL file.
503
 *
504
 * @param block The block's name and location.  */
505
  final public void SliceAttributes(int offset, int frame, int frameOffset, String block) throws ParseException {
506
  String latchType;
507
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
508
    case LATCH:
509
      latchType = Latch();
510
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
511
      case NET:
512
        Net(offset, frame, frameOffset, block, latchType);
513
        break;
514
      default:
515
        jj_la1[9] = jj_gen;
516
        ;
517
      }
518
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
519
      case COMPARE:
520
        Compare();
521
        break;
522
      default:
523
        jj_la1[10] = jj_gen;
524
        ;
525
      }
526
      break;
527
    case RAM:
528
      SliceRam(offset,frame,frameOffset,block);
529
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
530
      case COMPARE:
531
        Compare();
532
        break;
533
      default:
534
        jj_la1[11] = jj_gen;
535
        ;
536
      }
537
      break;
538
    case ROM:
539
      Rom();
540
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
541
      case COMPARE:
542
        Compare();
543
        break;
544
      default:
545
        jj_la1[12] = jj_gen;
546
        ;
547
      }
548
      break;
549
    default:
550
      jj_la1[13] = jj_gen;
551
      jj_consume_token(-1);
552
      throw new ParseException();
553
    }
554
  }
555
 
556
/**
557
 * Parses the "attributes" of a state bit in the readback bitstream,
558
 * which define whether it belongs to a flip-flop, a RAM, or a ROM and
559
 * other related information.  This is really the core of the parsing work.
560
 *
561
 * @param offset The first offset provided by the LL file for this
562
 *               flip-flop; it is actually a junk bit in the readback
563
 *               bitstream.
564
 *
565
 * @param frame The frame number for this flip-flops readback data
566
 *              provided by the LL file.
567
 *
568
 * @param frameOffset The offset within the frame for this flip-flop's
569
 *                    readback data provided by the LL file.
570
 *
571
 * @param block The block's name and location.  */
572
  final public void PinAttributes(int offset, int frame, int frameOffset, String block) throws ParseException {
573
  String latchType;
574
    latchType = Latch();
575
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
576
    case NET:
577
      Net(offset, frame, frameOffset, block, latchType);
578
      break;
579
    default:
580
      jj_la1[14] = jj_gen;
581
      ;
582
    }
583
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
584
    case COMPARE:
585
      Compare();
586
      break;
587
    default:
588
      jj_la1[15] = jj_gen;
589
      ;
590
    }
591
  }
592
 
593
/**
594
 * Parses the "attributes" of a state bit in the readback bitstream,
595
 * which define whether it belongs to a flip-flop, a RAM, or a ROM and
596
 * other related information.  This is really the core of the parsing work.
597
 *
598
 * @param offset The first offset provided by the LL file for this
599
 *               flip-flop; it is actually a junk bit in the readback
600
 *               bitstream.
601
 *
602
 * @param frame The frame number for this flip-flops readback data
603
 *              provided by the LL file.
604
 *
605
 * @param frameOffset The offset within the frame for this flip-flop's
606
 *                    readback data provided by the LL file.
607
 *
608
 * @param block The block's name and location.  */
609
  final public void BramAttributes(int offset, int frame, int frameOffset, String block) throws ParseException {
610
    BRam(offset,frame,frameOffset,block);
611
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
612
    case COMPARE:
613
      Compare();
614
      break;
615
    default:
616
      jj_la1[16] = jj_gen;
617
      ;
618
    }
619
  }
620
 
621
/**
622
 * Parses the information regarding location of the IOB/SLICE/BLOCKRAM
623
 * and returns the information as a <code>String</code>.
624
 *
625
 * @return The Virtex2 block location string (for example, "A21",
626
 *         "CLB_R8C55", "RAMB4_R7C0").
627
 **/
628
  final public String Block(int offset, int frame, int frameOffset) throws ParseException {
629
  String block;
630
    jj_consume_token(BLOCK);
631
    jj_consume_token(EQUAL);
632
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
633
    case SLICEBLOCK:
634
      jj_consume_token(SLICEBLOCK);
635
   block = token.toString();
636
      SliceAttributes(offset,frame,frameOffset,block);
637
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
638
      case 44:
639
        jj_consume_token(44);
640
        break;
641
      case 45:
642
        jj_consume_token(45);
643
        break;
644
      case 46:
645
        jj_consume_token(46);
646
        break;
647
      default:
648
        jj_la1[17] = jj_gen;
649
        jj_consume_token(-1);
650
        throw new ParseException();
651
      }
652
      break;
653
    case BRAMBLOCK:
654
      jj_consume_token(BRAMBLOCK);
655
         block = token.toString();
656
      BramAttributes(offset,frame,frameOffset,block);
657
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
658
      case 44:
659
        jj_consume_token(44);
660
        break;
661
      case 45:
662
        jj_consume_token(45);
663
        break;
664
      case 46:
665
        jj_consume_token(46);
666
        break;
667
      default:
668
        jj_la1[18] = jj_gen;
669
        jj_consume_token(-1);
670
        throw new ParseException();
671
      }
672
      break;
673
    case GTPBLOCK:
674
    case DCMBLOCK:
675
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
676
      case GTPBLOCK:
677
        jj_consume_token(GTPBLOCK);
678
        break;
679
      case DCMBLOCK:
680
        jj_consume_token(DCMBLOCK);
681
        break;
682
      default:
683
        jj_la1[19] = jj_gen;
684
        jj_consume_token(-1);
685
        throw new ParseException();
686
      }
687
         block = token.toString();
688
      jj_consume_token(TYPE);
689
      jj_consume_token(EQUAL);
690
      jj_consume_token(ID);
691
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
692
      case 44:
693
        jj_consume_token(44);
694
        break;
695
      case 45:
696
        jj_consume_token(45);
697
        break;
698
      case 46:
699
        jj_consume_token(46);
700
        break;
701
      default:
702
        jj_la1[20] = jj_gen;
703
        jj_consume_token(-1);
704
        throw new ParseException();
705
      }
706
      break;
707
    case PINBLOCK:
708
      jj_consume_token(PINBLOCK);
709
         block = token.toString();
710
      PinAttributes(offset,frame,frameOffset,block);
711
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
712
      case 44:
713
        jj_consume_token(44);
714
        break;
715
      case 45:
716
        jj_consume_token(45);
717
        break;
718
      case 46:
719
        jj_consume_token(46);
720
        break;
721
      default:
722
        jj_la1[21] = jj_gen;
723
        jj_consume_token(-1);
724
        throw new ParseException();
725
      }
726
      break;
727
    default:
728
      jj_la1[22] = jj_gen;
729
      jj_consume_token(-1);
730
      throw new ParseException();
731
    }
732
   {if (true) return block;}
733
    throw new Error("Missing return statement in function");
734
  }
735
 
736
/**
737
 * Parses an entire readback bitstream location entry for a state
738
 * element. */
739
  final public void BitStreamEntry() throws ParseException {
740
  int offset,frame,frameOffset;
741
  String block;
742
    jj_consume_token(BIT);
743
    jj_consume_token(NUM);
744
               offset = Integer.parseInt(token.toString());
745
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
746
    case NUM:
747
      jj_consume_token(NUM);
748
          frame = Integer.parseInt(token.toString());
749
      break;
750
    case HEXNUM:
751
      jj_consume_token(HEXNUM);
752
             frame = Integer.decode(token.toString()).intValue(); absOffsets=true;
753
      break;
754
    default:
755
      jj_la1[23] = jj_gen;
756
      jj_consume_token(-1);
757
      throw new ParseException();
758
    }
759
    jj_consume_token(NUM);
760
         frameOffset = Integer.parseInt(token.toString());
761
    block = Block(offset, frame, frameOffset);
762
  }
763
 
764
/**
765
 * Parses the value of any the informational entries in the LL
766
 * file. The information is ignored. */
767
  final public void InfoValue() throws ParseException {
768
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
769
    case ID:
770
      jj_consume_token(ID);
771
      break;
772
    case NUM:
773
      jj_consume_token(NUM);
774
      break;
775
    default:
776
      jj_la1[24] = jj_gen;
777
      jj_consume_token(-1);
778
      throw new ParseException();
779
    }
780
  }
781
 
782
/**
783
 * Parses any entries in the LL file which do not directly associate
784
 * state elements with readback bitstream locations.  These entries
785
 * describe some of the bitstream generation options used for the
786
 * bitstream. */
787
  final public void InfoEntry() throws ParseException {
788
    jj_consume_token(INFO);
789
    jj_consume_token(ID);
790
    jj_consume_token(EQUAL);
791
    InfoValue();
792
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
793
    case 44:
794
      jj_consume_token(44);
795
      break;
796
    case 45:
797
      jj_consume_token(45);
798
      break;
799
    case 46:
800
      jj_consume_token(46);
801
      break;
802
    default:
803
      jj_la1[25] = jj_gen;
804
      jj_consume_token(-1);
805
      throw new ParseException();
806
    }
807
  }
808
 
809
  /** Generated Token Manager. */
810
  public LL_Virtex5TokenManager token_source;
811
  SimpleCharStream jj_input_stream;
812
  /** Current token. */
813
  public Token token;
814
  /** Next token. */
815
  public Token jj_nt;
816
  private int jj_ntk;
817
  private int jj_gen;
818
  final private int[] jj_la1 = new int[26];
819
  static private int[] jj_la1_0;
820
  static private int[] jj_la1_1;
821
  static {
822
      jj_la1_init_0();
823
      jj_la1_init_1();
824
   }
825
   private static void jj_la1_init_0() {
826
      jj_la1_0 = new int[] {0x1fe0000,0x0,0x0,0x0,0x0,0x0,0x28000000,0x28000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc000,0x0,0x0,0x1f000,0xc0,0x40,0x0,};
827
   }
828
   private static void jj_la1_init_1() {
829
      jj_la1_1 = new int[] {0x0,0x201,0x201,0x7000,0x800,0x800,0x0,0x0,0xc0,0x20,0x100,0x100,0x100,0x1c,0x20,0x100,0x100,0x7000,0x7000,0x0,0x7000,0x7000,0x0,0x0,0x400,0x7000,};
830
   }
831
 
832
  /** Constructor with InputStream. */
833
  public LL_Virtex5(java.io.InputStream stream) {
834
     this(stream, null);
835
  }
836
  /** Constructor with InputStream and supplied encoding */
837
  public LL_Virtex5(java.io.InputStream stream, String encoding) {
838
    try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
839
    token_source = new LL_Virtex5TokenManager(jj_input_stream);
840
    token = new Token();
841
    jj_ntk = -1;
842
    jj_gen = 0;
843
    for (int i = 0; i < 26; i++) jj_la1[i] = -1;
844
  }
845
 
846
  /** Reinitialise. */
847
  public void ReInit(java.io.InputStream stream) {
848
     ReInit(stream, null);
849
  }
850
  /** Reinitialise. */
851
  public void ReInit(java.io.InputStream stream, String encoding) {
852
    try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
853
    token_source.ReInit(jj_input_stream);
854
    token = new Token();
855
    jj_ntk = -1;
856
    jj_gen = 0;
857
    for (int i = 0; i < 26; i++) jj_la1[i] = -1;
858
  }
859
 
860
  /** Constructor. */
861
  public LL_Virtex5(java.io.Reader stream) {
862
    jj_input_stream = new SimpleCharStream(stream, 1, 1);
863
    token_source = new LL_Virtex5TokenManager(jj_input_stream);
864
    token = new Token();
865
    jj_ntk = -1;
866
    jj_gen = 0;
867
    for (int i = 0; i < 26; i++) jj_la1[i] = -1;
868
  }
869
 
870
  /** Reinitialise. */
871
  public void ReInit(java.io.Reader stream) {
872
    jj_input_stream.ReInit(stream, 1, 1);
873
    token_source.ReInit(jj_input_stream);
874
    token = new Token();
875
    jj_ntk = -1;
876
    jj_gen = 0;
877
    for (int i = 0; i < 26; i++) jj_la1[i] = -1;
878
  }
879
 
880
  /** Constructor with generated Token Manager. */
881
  public LL_Virtex5(LL_Virtex5TokenManager tm) {
882
    token_source = tm;
883
    token = new Token();
884
    jj_ntk = -1;
885
    jj_gen = 0;
886
    for (int i = 0; i < 26; i++) jj_la1[i] = -1;
887
  }
888
 
889
  /** Reinitialise. */
890
  public void ReInit(LL_Virtex5TokenManager tm) {
891
    token_source = tm;
892
    token = new Token();
893
    jj_ntk = -1;
894
    jj_gen = 0;
895
    for (int i = 0; i < 26; i++) jj_la1[i] = -1;
896
  }
897
 
898
  private Token jj_consume_token(int kind) throws ParseException {
899
    Token oldToken;
900
    if ((oldToken = token).next != null) token = token.next;
901
    else token = token.next = token_source.getNextToken();
902
    jj_ntk = -1;
903
    if (token.kind == kind) {
904
      jj_gen++;
905
      return token;
906
    }
907
    token = oldToken;
908
    jj_kind = kind;
909
    throw generateParseException();
910
  }
911
 
912
 
913
/** Get the next Token. */
914
  final public Token getNextToken() {
915
    if (token.next != null) token = token.next;
916
    else token = token.next = token_source.getNextToken();
917
    jj_ntk = -1;
918
    jj_gen++;
919
    return token;
920
  }
921
 
922
/** Get the specific Token. */
923
  final public Token getToken(int index) {
924
    Token t = token;
925
    for (int i = 0; i < index; i++) {
926
      if (t.next != null) t = t.next;
927
      else t = t.next = token_source.getNextToken();
928
    }
929
    return t;
930
  }
931
 
932
  private int jj_ntk() {
933
    if ((jj_nt=token.next) == null)
934
      return (jj_ntk = (token.next=token_source.getNextToken()).kind);
935
    else
936
      return (jj_ntk = jj_nt.kind);
937
  }
938
 
939
  private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
940
  private int[] jj_expentry;
941
  private int jj_kind = -1;
942
 
943
  /** Generate ParseException. */
944
  public ParseException generateParseException() {
945
    jj_expentries.clear();
946
    boolean[] la1tokens = new boolean[47];
947
    if (jj_kind >= 0) {
948
      la1tokens[jj_kind] = true;
949
      jj_kind = -1;
950
    }
951
    for (int i = 0; i < 26; i++) {
952
      if (jj_la1[i] == jj_gen) {
953
        for (int j = 0; j < 32; j++) {
954
          if ((jj_la1_0[i] & (1<<j)) != 0) {
955
            la1tokens[j] = true;
956
          }
957
          if ((jj_la1_1[i] & (1<<j)) != 0) {
958
            la1tokens[32+j] = true;
959
          }
960
        }
961
      }
962
    }
963
    for (int i = 0; i < 47; i++) {
964
      if (la1tokens[i]) {
965
        jj_expentry = new int[1];
966
        jj_expentry[0] = i;
967
        jj_expentries.add(jj_expentry);
968
      }
969
    }
970
    int[][] exptokseq = new int[jj_expentries.size()][];
971
    for (int i = 0; i < jj_expentries.size(); i++) {
972
      exptokseq[i] = jj_expentries.get(i);
973
    }
974
    return new ParseException(token, exptokseq, tokenImage);
975
  }
976
 
977
  /** Enable tracing. */
978
  final public void enable_tracing() {
979
  }
980
 
981
  /** Disable tracing. */
982
  final public void disable_tracing() {
983
  }
984
 
985
}

powered by: WebSVN 2.1.0

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