| 1 |
2 |
peteralieb |
options {
|
| 2 |
|
|
STATIC = false;
|
| 3 |
|
|
}
|
| 4 |
|
|
|
| 5 |
|
|
PARSER_BEGIN(LL_Virtex5)
|
| 6 |
|
|
/*
|
| 7 |
|
|
@LICENSE@
|
| 8 |
|
|
*/
|
| 9 |
|
|
package edu.byu.cc.plieber.fpgaenet.debug.llparse;
|
| 10 |
|
|
import java.lang.*;
|
| 11 |
|
|
import java.util.*;
|
| 12 |
|
|
|
| 13 |
|
|
/**
|
| 14 |
|
|
* The Xilinx Logical Allocation file (.ll file) parser for Virtex2
|
| 15 |
|
|
* FPGAs. The parser fills two Hashtable objects with the
|
| 16 |
|
|
* readback bitstream information for state elements in the Virtex5
|
| 17 |
|
|
* design. One Hashtable is filled with RAM bitstream
|
| 18 |
|
|
* information keyed on physical location (block name) while the
|
| 19 |
|
|
* second holds the bitstream information for flip-flops keyed on
|
| 20 |
|
|
* physical location (block name). The grammar is not published but
|
| 21 |
|
|
* was developed from looking at the file format.
|
| 22 |
|
|
*
|
| 23 |
|
|
* @author Paul Graham
|
| 24 |
|
|
* @author Peter Lieber */
|
| 25 |
|
|
public class LL_Virtex5 {
|
| 26 |
|
|
|
| 27 |
|
|
/**
|
| 28 |
|
|
* A HashTable to allow quick access to {@link
|
| 29 |
|
|
* RAMGroup} objects based on block name and RAM type. The
|
| 30 |
|
|
* RAMGroup objects contain {@link RAMRBEntry} objects
|
| 31 |
|
|
* which hold the actual bitstream offsets. */
|
| 32 |
|
|
Hashtable RAMGroupHash;
|
| 33 |
|
|
|
| 34 |
|
|
/**
|
| 35 |
|
|
* A Hashtable of {@link LatchRBEntry} objects to allow
|
| 36 |
|
|
* quick access based on block name and latch type. The
|
| 37 |
|
|
* LatchRBEntry is used for flip-flops and stores
|
| 38 |
|
|
* bitstream offset information. */
|
| 39 |
|
|
Hashtable NetHashBlock;
|
| 40 |
|
|
|
| 41 |
|
|
/** The number of nets associated with latches in the .ll file */
|
| 42 |
|
|
int netCount;
|
| 43 |
|
|
|
| 44 |
|
|
/** The number of RAM entries in the .ll file */
|
| 45 |
|
|
int ramCount;
|
| 46 |
|
|
|
| 47 |
|
|
/**
|
| 48 |
|
|
* Indicates whether the LL file provides absolute offsets. First
|
| 49 |
|
|
* needed with the Xilinx 4.1 ISE tools*/
|
| 50 |
|
|
boolean absOffsets;
|
| 51 |
|
|
|
| 52 |
|
|
/**
|
| 53 |
|
|
* Instances and initializes the parser and parses the input from
|
| 54 |
|
|
* System.in
|
| 55 |
|
|
*
|
| 56 |
|
|
* @param args Command line arguments (ignored by the method)
|
| 57 |
|
|
* */
|
| 58 |
|
|
public static void main(String args[]) throws ParseException {
|
| 59 |
|
|
LL_Virtex5 parser = new LL_Virtex5(System.in);
|
| 60 |
|
|
parser.initTables();
|
| 61 |
|
|
parser.parseLL();
|
| 62 |
|
|
}
|
| 63 |
|
|
|
| 64 |
|
|
/**
|
| 65 |
|
|
* Initializes the Hashtables and counts. */
|
| 66 |
|
|
public void initTables() {
|
| 67 |
|
|
RAMGroupHash = new Hashtable();
|
| 68 |
|
|
NetHashBlock = new Hashtable();
|
| 69 |
|
|
netCount = 0;
|
| 70 |
|
|
ramCount = 0;
|
| 71 |
|
|
absOffsets = false;
|
| 72 |
|
|
}
|
| 73 |
|
|
|
| 74 |
|
|
/**
|
| 75 |
|
|
* Returns a reference to the RAMGroupHash, which holds
|
| 76 |
|
|
* a {@link RAMGroup} object for each RAM in the .ll file keyed on
|
| 77 |
|
|
* the location of the RAM and the RAM type (F, G, M, or B).
|
| 78 |
|
|
*
|
| 79 |
|
|
* @return Reference to RAMGroupHash */
|
| 80 |
|
|
public Hashtable getRAMGroupHash() {
|
| 81 |
|
|
return RAMGroupHash;
|
| 82 |
|
|
}
|
| 83 |
|
|
|
| 84 |
|
|
/**
|
| 85 |
|
|
* Returning a reference to the NetHashBlock, which
|
| 86 |
|
|
* holds a {@link LatchRBEntry} for each flip-flop in the .ll file
|
| 87 |
|
|
* keyed on the location and the latch type (XQ, YQ, etc.)
|
| 88 |
|
|
*
|
| 89 |
|
|
* @return Reference to NetHashBlock */
|
| 90 |
|
|
public Hashtable getNetHashBlock() {
|
| 91 |
|
|
return NetHashBlock;
|
| 92 |
|
|
}
|
| 93 |
|
|
|
| 94 |
|
|
/**
|
| 95 |
|
|
* Returns true if the LL file provides absolute offsets and false
|
| 96 |
|
|
* otherwise. Absolute readback bitstream offsets started appearing
|
| 97 |
|
|
* in the Xilinx ISE 4.1i series of tools.
|
| 98 |
|
|
*
|
| 99 |
|
|
* @return true if absolute offsets are provide,
|
| 100 |
|
|
* false otherwise. */
|
| 101 |
|
|
public boolean hasAbsoluteOffsets() {
|
| 102 |
|
|
return absOffsets;
|
| 103 |
|
|
}
|
| 104 |
|
|
}
|
| 105 |
|
|
|
| 106 |
|
|
PARSER_END(LL_Virtex5)
|
| 107 |
|
|
|
| 108 |
|
|
SKIP :
|
| 109 |
|
|
{
|
| 110 |
|
|
" "
|
| 111 |
|
|
|
|
| 112 |
|
|
"\t"
|
| 113 |
|
|
|
|
| 114 |
|
|
";" : IN_LINE_COMMENT
|
| 115 |
|
|
}
|
| 116 |
|
|
|
| 117 |
|
|
SKIP:
|
| 118 |
|
|
{
|
| 119 |
|
|
"\n" : DEFAULT
|
| 120 |
|
|
}
|
| 121 |
|
|
|
| 122 |
|
|
MORE:
|
| 123 |
|
|
{
|
| 124 |
|
|
< ~[] >
|
| 125 |
|
|
}
|
| 126 |
|
|
|
| 127 |
|
|
TOKEN :
|
| 128 |
|
|
{
|
| 129 |
|
|
< NUM: ( ["0"-"9"] )+ >
|
| 130 |
|
|
|
|
| 131 |
|
|
< HEXNUM: "0x" ( ["0"-"9","a"-"f","A"-"F"] )+ >
|
| 132 |
|
|
|
|
| 133 |
|
|
< EQUAL: "=" >
|
| 134 |
|
|
|
|
| 135 |
|
|
< TYPE : "Type" >
|
| 136 |
|
|
|
|
| 137 |
|
|
< LUT : ["A","B","C","D"] >
|
| 138 |
|
|
|
|
| 139 |
|
|
< BLOCKRAM : "B" >
|
| 140 |
|
|
|
|
| 141 |
|
|
< SLICEBLOCK : "SLICE_X" (["0"-"9"])+ "Y" (["0"-"9"])+ >
|
| 142 |
|
|
|
|
| 143 |
|
|
< BRAMBLOCK : "RAMB36_X" (["0"-"9"])+ "Y" (["0"-"9"])+ >
|
| 144 |
|
|
|
|
| 145 |
|
|
< GTPBLOCK : "GTP_DUAL_X" (["0"-"9"])+ "Y" (["0"-"9"])+ >
|
| 146 |
|
|
|
|
| 147 |
|
|
< DCMBLOCK : "DCM_ADV_X" (["0"-"9"])+ "Y" (["0"-"9"])+ >
|
| 148 |
|
|
|
|
| 149 |
|
|
< PINBLOCK : ["A"-"Z"] (["A"-"Z"])? ["0"-"9"] (["0"-"9"])? >
|
| 150 |
|
|
|
|
| 151 |
|
|
< AQ : "AQ">
|
| 152 |
|
|
|
|
| 153 |
|
|
< BQ : "BQ">
|
| 154 |
|
|
|
|
| 155 |
|
|
< CQ : "CQ">
|
| 156 |
|
|
|
|
| 157 |
|
|
< DQ : "DQ">
|
| 158 |
|
|
|
|
| 159 |
|
|
< Q1 : "Q1">
|
| 160 |
|
|
|
|
| 161 |
|
|
< Q2 : "Q2">
|
| 162 |
|
|
|
|
| 163 |
|
|
< I : "I">
|
| 164 |
|
|
|
|
| 165 |
|
|
< O : "O">
|
| 166 |
|
|
|
|
| 167 |
|
|
< DO : "DO" ["A","B"] ["0"-"9"] (["0"-"9"])? >
|
| 168 |
|
|
|
|
| 169 |
|
|
< COLON : ":" >
|
| 170 |
|
|
|
|
| 171 |
|
|
< LANGLE: "<" >
|
| 172 |
|
|
|
|
| 173 |
|
|
< RANGLE: ">" >
|
| 174 |
|
|
|
|
| 175 |
|
|
< LBRACKET: "[" >
|
| 176 |
|
|
|
|
| 177 |
|
|
< RBRACKET: "]" >
|
| 178 |
|
|
|
|
| 179 |
|
|
< REVISION : "Revision">
|
| 180 |
|
|
|
|
| 181 |
|
|
< BIT : "Bit" >
|
| 182 |
|
|
|
|
| 183 |
|
|
< BLOCK : "Block" >
|
| 184 |
|
|
|
|
| 185 |
|
|
< LATCH : "Latch" >
|
| 186 |
|
|
|
|
| 187 |
|
|
< RAM : "Ram" >
|
| 188 |
|
|
|
|
| 189 |
|
|
< ROM : "Rom" >
|
| 190 |
|
|
|
|
| 191 |
|
|
< NET: "Net" >
|
| 192 |
|
|
|
|
| 193 |
|
|
< YES: "YES">
|
| 194 |
|
|
|
|
| 195 |
|
|
< NO: "NO">
|
| 196 |
|
|
|
|
| 197 |
|
|
< COMPARE: "COMPARE">
|
| 198 |
|
|
|
|
| 199 |
|
|
< INFO: "Info">
|
| 200 |
|
|
|
|
| 201 |
|
|
< ID: ["a"-"z","A"-"Z"] (["a"-"z","A"-"Z","_","/","0"-"9","-",".","$"])* >
|
| 202 |
|
|
|
|
| 203 |
|
|
< NETEXT: ["/","_"](["a"-"z","A"-"Z","_","/","0"-"9","-","."])+ >
|
| 204 |
|
|
}
|
| 205 |
|
|
|
| 206 |
|
|
/**
|
| 207 |
|
|
* Defines the various flip-flop types and returns the type as
|
| 208 |
|
|
* a String.
|
| 209 |
|
|
*
|
| 210 |
|
|
* @return String for flip-flop type. */
|
| 211 |
|
|
String LatchType() :
|
| 212 |
|
|
{ }
|
| 213 |
|
|
{
|
| 214 |
|
|
{ return token.toString();}
|
| 215 |
|
|
| { return token.toString();}
|
| 216 |
|
|
| { return token.toString();}
|
| 217 |
|
|
| { return token.toString();}
|
| 218 |
|
|
| { return token.toString();}
|
| 219 |
|
|
| { return token.toString();}
|
| 220 |
|
|
| { return token.toString();}
|
| 221 |
|
|
| { return token.toString();}
|
| 222 |
|
|
}
|
| 223 |
|
|
|
| 224 |
|
|
/**
|
| 225 |
|
|
* Initiates the parsing of an .ll file and prints out
|
| 226 |
|
|
* statistics about the number of flip-flops (latches) and RAMs it
|
| 227 |
|
|
* found.*/
|
| 228 |
|
|
void parseLL() :
|
| 229 |
|
|
{ }
|
| 230 |
|
|
{
|
| 231 |
|
|
Revision() ( BitStreamEntry() | InfoEntry() )*
|
| 232 |
|
|
|
| 233 |
|
|
{
|
| 234 |
|
|
System.out.println("Total Block/Latch Entries: "+
|
| 235 |
|
|
Integer.toString(NetHashBlock.size())+ " Total Nets:" +
|
| 236 |
|
|
Integer.toString(netCount));
|
| 237 |
|
|
System.out.println("Number of RAMGroup Entries: "+
|
| 238 |
|
|
Integer.toString(RAMGroupHash.size())+
|
| 239 |
|
|
" Total RAM entries:" + Integer.toString(ramCount));
|
| 240 |
|
|
System.out.flush();
|
| 241 |
|
|
}
|
| 242 |
|
|
}
|
| 243 |
|
|
|
| 244 |
|
|
/**
|
| 245 |
|
|
* Parses the revision information for the .ll file.
|
| 246 |
|
|
*/
|
| 247 |
|
|
void Revision() :
|
| 248 |
|
|
{ }
|
| 249 |
|
|
{
|
| 250 |
|
|
("\r" | "\n" | "\r\n")
|
| 251 |
|
|
}
|
| 252 |
|
|
|
| 253 |
|
|
/**
|
| 254 |
|
|
* Parses the entire clause having the type of the flip-flop and
|
| 255 |
|
|
* returns the flip-flop type as a String.
|
| 256 |
|
|
*
|
| 257 |
|
|
* @return Flip-flop type as String. */
|
| 258 |
|
|
String Latch() :
|
| 259 |
|
|
{ String latchtype; }
|
| 260 |
|
|
{
|
| 261 |
|
|
latchtype=LatchType() {return latchtype;}
|
| 262 |
|
|
}
|
| 263 |
|
|
|
| 264 |
|
|
/**
|
| 265 |
|
|
* Parses the net names associated with latches and stores a
|
| 266 |
|
|
* LatchRBEntry object in the NetHashBlock
|
| 267 |
|
|
* Hashtable. The method handles both angle brackets ("<>")
|
| 268 |
|
|
* and square brackets ("[]") for net names. In some strange
|
| 269 |
|
|
* circumstances, it was necessary to handle names which extended
|
| 270 |
|
|
* beyond the array naming construct (in other words, there was still
|
| 271 |
|
|
* part of the name after the last "]" or ">"). In these cases, the
|
| 272 |
|
|
* names are considered atomic (not multi-bit), so the index variable
|
| 273 |
|
|
* is reset to "-1".
|
| 274 |
|
|
*
|
| 275 |
|
|
* @param offset The first offset provided by the LL file for this
|
| 276 |
|
|
* flip-flop; it is actually a junk bit in the readback
|
| 277 |
|
|
* bitstream.
|
| 278 |
|
|
*
|
| 279 |
|
|
* @param frame The frame number for this flip-flops readback data
|
| 280 |
|
|
* provided by the LL file.
|
| 281 |
|
|
*
|
| 282 |
|
|
* @param frameOffset The offset within the frame for this flip-flop's
|
| 283 |
|
|
* readback data provided by the LL file.
|
| 284 |
|
|
*
|
| 285 |
|
|
* @param block The block's name and location.
|
| 286 |
|
|
*
|
| 287 |
|
|
* @param latchType The type of the flip-flop.
|
| 288 |
|
|
**/
|
| 289 |
|
|
void NetName(int offset, int frame, int frameOffset, String block, String latchType) :
|
| 290 |
|
|
{
|
| 291 |
|
|
String netname;
|
| 292 |
|
|
int index=-1;
|
| 293 |
|
|
boolean extended=false;
|
| 294 |
|
|
LatchRBEntry lrbe;
|
| 295 |
|
|
}
|
| 296 |
|
|
{
|
| 297 |
|
|
{ netname = token.toString();}
|
| 298 |
|
|
[(
|
| 299 |
|
|
{ index = Integer.parseInt(token.toString()); }
|
| 300 |
|
|
|
| 301 |
|
|
[
|
| 302 |
|
|
{ netname = new String(netname+"<"+Integer.toString(index)+">"+token.toString());
|
| 303 |
|
|
index = -1;
|
| 304 |
|
|
extended = true;
|
| 305 |
|
|
} ]
|
| 306 |
|
|
|
|
| 307 |
|
|
{ index = Integer.parseInt(token.toString());}
|
| 308 |
|
|
|
| 309 |
|
|
[
|
| 310 |
|
|
{ netname = new String(netname+"["+Integer.toString(index)+"]"+token.toString());
|
| 311 |
|
|
index = -1;
|
| 312 |
|
|
extended = true;
|
| 313 |
|
|
} ]
|
| 314 |
|
|
)]
|
| 315 |
|
|
{
|
| 316 |
|
|
if(!block.equals("DUMMY")) {
|
| 317 |
|
|
lrbe = new LatchRBEntry(offset,frame,frameOffset,block,latchType,netname,index);
|
| 318 |
|
|
netCount++;
|
| 319 |
|
|
NetHashBlock.put(block+latchType, lrbe);
|
| 320 |
|
|
}
|
| 321 |
|
|
}
|
| 322 |
|
|
}
|
| 323 |
|
|
|
| 324 |
|
|
/**
|
| 325 |
|
|
* Parses the entire "Net=..." clause.
|
| 326 |
|
|
*
|
| 327 |
|
|
* @param offset The first offset provided by the LL file for this
|
| 328 |
|
|
* flip-flop; it is actually a junk bit in the readback
|
| 329 |
|
|
* bitstream.
|
| 330 |
|
|
*
|
| 331 |
|
|
* @param frame The frame number for this flip-flops readback data
|
| 332 |
|
|
* provided by the LL file.
|
| 333 |
|
|
*
|
| 334 |
|
|
* @param frameOffset The offset within the frame for this flip-flop's
|
| 335 |
|
|
* readback data provided by the LL file.
|
| 336 |
|
|
*
|
| 337 |
|
|
* @param block The block's name and location.
|
| 338 |
|
|
*
|
| 339 |
|
|
* @param latchType The type of the flip-flop.
|
| 340 |
|
|
*/
|
| 341 |
|
|
void Net(int offset, int frame, int frameOffset, String block, String latchType) :
|
| 342 |
|
|
{ }
|
| 343 |
|
|
{
|
| 344 |
|
|
NetName(offset,frame,frameOffset,block,latchType)
|
| 345 |
|
|
}
|
| 346 |
|
|
|
| 347 |
|
|
/**
|
| 348 |
|
|
* Parses the "Ram=..." clauses of the RAM LL entries for lut rams and enters the
|
| 349 |
|
|
* data into the RAMGroupHash. Since a certain RAM may
|
| 350 |
|
|
* already have a RAMGroup entry in the
|
| 351 |
|
|
* RAMGroupHash, the method performs a lookup first to
|
| 352 |
|
|
* see if the RAM's RAMGroup entry exists. If the entry
|
| 353 |
|
|
* exists, the method adds a RAMRBEntry to the
|
| 354 |
|
|
* RAMGroup which was found. Otherwise, the method
|
| 355 |
|
|
* creates a new RAMGroup and adds an
|
| 356 |
|
|
* RAMRBEntry to it. This method handles both LUT RAMs
|
| 357 |
|
|
* and BlockRAMs.
|
| 358 |
|
|
*
|
| 359 |
|
|
* @param offset The first offset provided by the LL file for this
|
| 360 |
|
|
* flip-flop; it is actually a junk bit in the readback
|
| 361 |
|
|
* bitstream.
|
| 362 |
|
|
*
|
| 363 |
|
|
* @param frame The frame number for this flip-flops readback data
|
| 364 |
|
|
* provided by the LL file.
|
| 365 |
|
|
*
|
| 366 |
|
|
* @param frameOffset The offset within the frame for this flip-flop's
|
| 367 |
|
|
* readback data provided by the LL file.
|
| 368 |
|
|
*
|
| 369 |
|
|
* @param block The block's name and location. */
|
| 370 |
|
|
void SliceRam(int offset, int frame, int frameOffset, String block) :
|
| 371 |
|
|
{ String lutType;
|
| 372 |
|
|
int address;
|
| 373 |
|
|
RAMGroup rg;
|
| 374 |
|
|
RAMRBEntry rrb;
|
| 375 |
|
|
String key;
|
| 376 |
|
|
}
|
| 377 |
|
|
{
|
| 378 |
|
|
|
| 379 |
|
|
{lutType = token.toString();}
|
| 380 |
|
|
|
| 381 |
|
|
{
|
| 382 |
|
|
try {
|
| 383 |
|
|
address = Integer.parseInt(token.toString());
|
| 384 |
|
|
rrb = new RAMRBEntry(offset,frame,frameOffset,block,lutType,address);
|
| 385 |
|
|
ramCount++;
|
| 386 |
|
|
key = new String(block+"."+lutType);
|
| 387 |
|
|
rg = (RAMGroup)RAMGroupHash.get(key);
|
| 388 |
|
|
if(rg == null) {
|
| 389 |
|
|
RAMGroupHash.put(key,new RAMGroup(rrb));
|
| 390 |
|
|
}
|
| 391 |
|
|
else {
|
| 392 |
|
|
rg.addRAMEntry(rrb);
|
| 393 |
|
|
}
|
| 394 |
|
|
}
|
| 395 |
|
|
catch (RAMTypeException rte) {
|
| 396 |
|
|
System.out.println("Caught Exception: " + rte.toString());
|
| 397 |
|
|
System.out.println("Wrong RAM Type: Are you using the proper part type? (Virtex5)");
|
| 398 |
|
|
rte.printStackTrace();
|
| 399 |
|
|
}
|
| 400 |
|
|
}
|
| 401 |
|
|
}
|
| 402 |
|
|
|
| 403 |
|
|
/**
|
| 404 |
|
|
* Parses the "Ram=..." clauses of the RAM LL entries for BRAMs and enters the
|
| 405 |
|
|
* data into the RAMGroupHash. Since a certain RAM may
|
| 406 |
|
|
* already have a RAMGroup entry in the
|
| 407 |
|
|
* RAMGroupHash, the method performs a lookup first to
|
| 408 |
|
|
* see if the RAM's RAMGroup entry exists. If the entry
|
| 409 |
|
|
* exists, the method adds a RAMRBEntry to the
|
| 410 |
|
|
* RAMGroup which was found. Otherwise, the method
|
| 411 |
|
|
* creates a new RAMGroup and adds an
|
| 412 |
|
|
* RAMRBEntry to it. This method handles both LUT RAMs
|
| 413 |
|
|
* and BlockRAMs.
|
| 414 |
|
|
*
|
| 415 |
|
|
* @param offset The first offset provided by the LL file for this
|
| 416 |
|
|
* flip-flop; it is actually a junk bit in the readback
|
| 417 |
|
|
* bitstream.
|
| 418 |
|
|
*
|
| 419 |
|
|
* @param frame The frame number for this flip-flops readback data
|
| 420 |
|
|
* provided by the LL file.
|
| 421 |
|
|
*
|
| 422 |
|
|
* @param frameOffset The offset within the frame for this flip-flop's
|
| 423 |
|
|
* readback data provided by the LL file.
|
| 424 |
|
|
*
|
| 425 |
|
|
* @param block The block's name and location. */
|
| 426 |
|
|
void BRam(int offset, int frame, int frameOffset, String block) :
|
| 427 |
|
|
{ String lutType;
|
| 428 |
|
|
int address;
|
| 429 |
|
|
RAMGroup rg;
|
| 430 |
|
|
RAMRBEntry rrb;
|
| 431 |
|
|
String key;
|
| 432 |
|
|
}
|
| 433 |
|
|
{
|
| 434 |
|
|
|
| 435 |
|
|
{lutType = token.toString();}
|
| 436 |
|
|
|
| 437 |
|
|
{
|
| 438 |
|
|
try {
|
| 439 |
|
|
String bitAddress = token.toString();
|
| 440 |
|
|
// We need to skip the PARBIT prefix used for block ram parity bits
|
| 441 |
|
|
if( bitAddress.charAt(0) == 'P' )
|
| 442 |
|
|
address = Integer.parseInt(bitAddress.substring(6));
|
| 443 |
|
|
// We need to skip the BIT prefix used for block ram data bits
|
| 444 |
|
|
else
|
| 445 |
|
|
address = Integer.parseInt(bitAddress.substring(3));
|
| 446 |
|
|
rrb = new RAMRBEntry(offset,frame,frameOffset,block,lutType,address);
|
| 447 |
|
|
ramCount++;
|
| 448 |
|
|
key = new String(block+"."+lutType);
|
| 449 |
|
|
rg = (RAMGroup)RAMGroupHash.get(key);
|
| 450 |
|
|
if(rg == null) {
|
| 451 |
|
|
RAMGroupHash.put(key,new RAMGroup(rrb));
|
| 452 |
|
|
}
|
| 453 |
|
|
else {
|
| 454 |
|
|
rg.addRAMEntry(rrb);
|
| 455 |
|
|
}
|
| 456 |
|
|
}
|
| 457 |
|
|
catch (RAMTypeException rte) {
|
| 458 |
|
|
System.out.println("Caught Exception: " + rte.toString());
|
| 459 |
|
|
System.out.println("Wrong RAM Type: Are you using the proper part type? (Virtex2, XC4K, etc.)");
|
| 460 |
|
|
rte.printStackTrace();
|
| 461 |
|
|
}
|
| 462 |
|
|
}
|
| 463 |
|
|
}
|
| 464 |
|
|
|
| 465 |
|
|
/**
|
| 466 |
|
|
* Parses "Rom=..." entries, but doesn't do anything with them.
|
| 467 |
|
|
*/
|
| 468 |
|
|
void Rom() :
|
| 469 |
|
|
{ }
|
| 470 |
|
|
{
|
| 471 |
|
|
|
| 472 |
|
|
}
|
| 473 |
|
|
|
| 474 |
|
|
/**
|
| 475 |
|
|
* Parses "YES/NO" clauses.
|
| 476 |
|
|
*/
|
| 477 |
|
|
void YesNo():
|
| 478 |
|
|
{ }
|
| 479 |
|
|
{
|
| 480 |
|
|
|
| 481 |
|
|
|
|
| 482 |
|
|
|
| 483 |
|
|
}
|
| 484 |
|
|
|
| 485 |
|
|
/**
|
| 486 |
|
|
* Parses "COMPARE=..." clauses, which are otherwise ignored.
|
| 487 |
|
|
*/
|
| 488 |
|
|
void Compare() :
|
| 489 |
|
|
{ }
|
| 490 |
|
|
{
|
| 491 |
|
|
YesNo()
|
| 492 |
|
|
}
|
| 493 |
|
|
|
| 494 |
|
|
/**
|
| 495 |
|
|
* Parses the "attributes" of a state bit in the readback bitstream,
|
| 496 |
|
|
* which define whether it belongs to a flip-flop, a RAM, or a ROM and
|
| 497 |
|
|
* other related information. This is really the core of the parsing work.
|
| 498 |
|
|
*
|
| 499 |
|
|
* @param offset The first offset provided by the LL file for this
|
| 500 |
|
|
* flip-flop; it is actually a junk bit in the readback
|
| 501 |
|
|
* bitstream.
|
| 502 |
|
|
*
|
| 503 |
|
|
* @param frame The frame number for this flip-flops readback data
|
| 504 |
|
|
* provided by the LL file.
|
| 505 |
|
|
*
|
| 506 |
|
|
* @param frameOffset The offset within the frame for this flip-flop's
|
| 507 |
|
|
* readback data provided by the LL file.
|
| 508 |
|
|
*
|
| 509 |
|
|
* @param block The block's name and location. */
|
| 510 |
|
|
void SliceAttributes(int offset, int frame, int frameOffset, String block) :
|
| 511 |
|
|
{ String latchType;}
|
| 512 |
|
|
{
|
| 513 |
|
|
latchType=Latch() (Net(offset, frame, frameOffset, block, latchType))? (Compare())?
|
| 514 |
|
|
|
|
| 515 |
|
|
SliceRam(offset,frame,frameOffset,block) (Compare())?
|
| 516 |
|
|
|
|
| 517 |
|
|
Rom() (Compare())?
|
| 518 |
|
|
}
|
| 519 |
|
|
|
| 520 |
|
|
/**
|
| 521 |
|
|
* Parses the "attributes" of a state bit in the readback bitstream,
|
| 522 |
|
|
* which define whether it belongs to a flip-flop, a RAM, or a ROM and
|
| 523 |
|
|
* other related information. This is really the core of the parsing work.
|
| 524 |
|
|
*
|
| 525 |
|
|
* @param offset The first offset provided by the LL file for this
|
| 526 |
|
|
* flip-flop; it is actually a junk bit in the readback
|
| 527 |
|
|
* bitstream.
|
| 528 |
|
|
*
|
| 529 |
|
|
* @param frame The frame number for this flip-flops readback data
|
| 530 |
|
|
* provided by the LL file.
|
| 531 |
|
|
*
|
| 532 |
|
|
* @param frameOffset The offset within the frame for this flip-flop's
|
| 533 |
|
|
* readback data provided by the LL file.
|
| 534 |
|
|
*
|
| 535 |
|
|
* @param block The block's name and location. */
|
| 536 |
|
|
void PinAttributes(int offset, int frame, int frameOffset, String block) :
|
| 537 |
|
|
{ String latchType;}
|
| 538 |
|
|
{
|
| 539 |
|
|
latchType=Latch() (Net(offset, frame, frameOffset, block, latchType))? (Compare())?
|
| 540 |
|
|
}
|
| 541 |
|
|
|
| 542 |
|
|
/**
|
| 543 |
|
|
* Parses the "attributes" of a state bit in the readback bitstream,
|
| 544 |
|
|
* which define whether it belongs to a flip-flop, a RAM, or a ROM and
|
| 545 |
|
|
* other related information. This is really the core of the parsing work.
|
| 546 |
|
|
*
|
| 547 |
|
|
* @param offset The first offset provided by the LL file for this
|
| 548 |
|
|
* flip-flop; it is actually a junk bit in the readback
|
| 549 |
|
|
* bitstream.
|
| 550 |
|
|
*
|
| 551 |
|
|
* @param frame The frame number for this flip-flops readback data
|
| 552 |
|
|
* provided by the LL file.
|
| 553 |
|
|
*
|
| 554 |
|
|
* @param frameOffset The offset within the frame for this flip-flop's
|
| 555 |
|
|
* readback data provided by the LL file.
|
| 556 |
|
|
*
|
| 557 |
|
|
* @param block The block's name and location. */
|
| 558 |
|
|
void BramAttributes(int offset, int frame, int frameOffset, String block) :
|
| 559 |
|
|
{ }
|
| 560 |
|
|
{
|
| 561 |
|
|
BRam(offset,frame,frameOffset,block) (Compare())?
|
| 562 |
|
|
}
|
| 563 |
|
|
|
| 564 |
|
|
|
| 565 |
|
|
|
| 566 |
|
|
/**
|
| 567 |
|
|
* Parses the information regarding location of the IOB/SLICE/BLOCKRAM
|
| 568 |
|
|
* and returns the information as a String.
|
| 569 |
|
|
*
|
| 570 |
|
|
* @return The Virtex2 block location string (for example, "A21",
|
| 571 |
|
|
* "CLB_R8C55", "RAMB4_R7C0").
|
| 572 |
|
|
**/
|
| 573 |
|
|
String Block(int offset, int frame, int frameOffset) :
|
| 574 |
|
|
{
|
| 575 |
|
|
String block;
|
| 576 |
|
|
}
|
| 577 |
|
|
{
|
| 578 |
|
|
|
| 579 |
|
|
(
|
| 580 |
|
|
|
| 581 |
|
|
{block = token.toString();}
|
| 582 |
|
|
SliceAttributes(offset,frame,frameOffset,block) ("\r" | "\n" | "\r\n")
|
| 583 |
|
|
|
|
| 584 |
|
|
|
| 585 |
|
|
{block = token.toString();}
|
| 586 |
|
|
BramAttributes(offset,frame,frameOffset,block) ("\r" | "\n" | "\r\n")
|
| 587 |
|
|
|
|
| 588 |
|
|
( | )
|
| 589 |
|
|
{block = token.toString();}
|
| 590 |
|
|
< ID > ("\r" | "\n" | "\r\n")
|
| 591 |
|
|
|
|
| 592 |
|
|
|
| 593 |
|
|
{block = token.toString();}
|
| 594 |
|
|
PinAttributes(offset,frame,frameOffset,block) ("\r" | "\n" | "\r\n")
|
| 595 |
|
|
)
{
return block;
|
| 596 |
|
|
}
|
| 597 |
|
|
}
|
| 598 |
|
|
|
| 599 |
|
|
|
| 600 |
|
|
|
| 601 |
|
|
|
| 602 |
|
|
* element. */
|
| 603 |
|
|
void BitStreamEntry() :
|
| 604 |
|
|
{ int offset,frame,frameOffset;
|
| 605 |
|
|
String block;
|
| 606 |
|
|
}
|
| 607 |
|
|
{
|
| 608 |
|
|
{offset = Integer.parseInt(token.toString());}
|
| 609 |
|
|
( {frame = Integer.parseInt(token.toString()); }
|
| 610 |
|
|
| {frame = Integer.decode(token.toString()).intValue(); absOffsets=true;})
|
| 611 |
|
|
{frameOffset = Integer.parseInt(token.toString()); }
|
| 612 |
|
|
block = Block(offset, frame, frameOffset)
|
| 613 |
|
|
}
|
| 614 |
|
|
|
| 615 |
|
|
/**
|
| 616 |
|
|
|
| 617 |
|
|
* file. The information is ignored. */
|
| 618 |
|
|
void InfoValue() :
|
| 619 |
|
|
{ }
|
| 620 |
|
|
{
|
| 621 |
|
|
|
| 622 |
|
|
|
|
| 623 |
|
|
|
| 624 |
|
|
}
|
| 625 |
|
|
|
| 626 |
|
|
/**
|
| 627 |
|
|
|
| 628 |
|
|
* state elements with readback bitstream locations. These entries
|
| 629 |
|
|
* describe some of the bitstream generation options used for the
|
| 630 |
|
|
* bitstream. */
|
| 631 |
|
|
void InfoEntry() :
|
| 632 |
|
|
{}
|
| 633 |
|
|
{
|
| 634 |
|
|
InfoValue() ("\r" | "\n" | "\r\n")
|
| 635 |
|
|
}
|
| 636 |
|
|
|
| 637 |
|
|
|
| 638 |
|
|
|