1 |
2 |
peteralieb |
/*
|
2 |
|
|
@LICENSE@
|
3 |
|
|
*/
|
4 |
|
|
|
5 |
|
|
package edu.byu.cc.plieber.fpgaenet.debug.llparse;
|
6 |
|
|
import java.lang.String;
|
7 |
|
|
|
8 |
|
|
/**
|
9 |
|
|
* This class is used to record flip-flop readback bitstream location
|
10 |
|
|
* information provided by <code>.ll</code> files for Virtex2 FPGAs.
|
11 |
|
|
*
|
12 |
|
|
* @author Paul Graham
|
13 |
|
|
*/
|
14 |
|
|
public class LatchRBEntry extends RBEntry{
|
15 |
|
|
|
16 |
|
|
/* Here are the various locations of latches: input, output,
|
17 |
|
|
and internal */
|
18 |
|
|
/** Represents a latch which is in an input port of the chip */
|
19 |
|
|
static final int INPORT = 1;
|
20 |
|
|
/** Represents a latch which is in an output port of the chip */
|
21 |
|
|
static final int OUTPORT = 2;
|
22 |
|
|
/** Represents a latch which is internal to the chip */
|
23 |
|
|
static final int INTERNAL = 3;
|
24 |
|
|
|
25 |
|
|
/** Holds the latch type for this object */
|
26 |
|
|
String type;
|
27 |
|
|
/** Holds the name of the net associated with this latch */
|
28 |
|
|
String name;
|
29 |
|
|
/** Holds the location of the latch: input port, an output port,
|
30 |
|
|
* or internal.
|
31 |
|
|
*/
|
32 |
|
|
int loc;
|
33 |
|
|
/** Holds the index of the net in a signal vector */
|
34 |
|
|
int index;
|
35 |
|
|
|
36 |
|
|
/**
|
37 |
|
|
* Constructor used to record readback bitstream information for a
|
38 |
|
|
* flip-flop which is associated with an atomic net (not part of a
|
39 |
|
|
* bus).
|
40 |
|
|
*
|
41 |
|
|
* @param new_offset The "junk" offset provided by the
|
42 |
|
|
* <code>.ll</code> file.
|
43 |
|
|
*
|
44 |
|
|
* @param new_frame The frame number for the readback bitstream data
|
45 |
|
|
* for the flip-flop provided by the
|
46 |
|
|
* <code>.ll</code> file.
|
47 |
|
|
*
|
48 |
|
|
* @param new_frameOffset The frame offset for the readback
|
49 |
|
|
* bitstream data for the flip-flop provided
|
50 |
|
|
* by the <code>.ll</code> file.
|
51 |
|
|
*
|
52 |
|
|
* @param new_block The physical location of the block containing
|
53 |
|
|
* the state element (C21, CLB_R8C55.S1,
|
54 |
|
|
* RAMB4_R4C1) provided by the <code>.ll</code>
|
55 |
|
|
* file.
|
56 |
|
|
*
|
57 |
|
|
* @param new_type The type of the flip-flop (XQ,YQ,IQ, etc.)
|
58 |
|
|
* provided by the <code>.ll</code> file.
|
59 |
|
|
*
|
60 |
|
|
* @param new_name The name of the signal attached to the output of
|
61 |
|
|
* the flip-flop, provided by the <code>.ll</code>
|
62 |
|
|
* file.
|
63 |
|
|
* */
|
64 |
|
|
LatchRBEntry(int new_offset, int new_frame, int new_frameOffset,
|
65 |
|
|
String new_block,String new_type,String new_name) {
|
66 |
|
|
super(new_offset,new_frame,new_frameOffset,new_block);
|
67 |
|
|
if(new_type.indexOf("I")!= -1)
|
68 |
|
|
loc = LatchRBEntry.INPORT;
|
69 |
|
|
else if(new_type.indexOf("O")!= -1)
|
70 |
|
|
loc = LatchRBEntry.OUTPORT;
|
71 |
|
|
else
|
72 |
|
|
loc = LatchRBEntry.INTERNAL;
|
73 |
|
|
type = new_type;
|
74 |
|
|
name = new_name;
|
75 |
|
|
index = -1;
|
76 |
|
|
}
|
77 |
|
|
|
78 |
|
|
/**
|
79 |
|
|
* Constructor used to record readback bitstream information for a
|
80 |
|
|
* flip-flop which is associated with either an atomic wire or a
|
81 |
|
|
* bus.
|
82 |
|
|
*
|
83 |
|
|
* @param new_offset The "junk" offset provided by the
|
84 |
|
|
* <code>.ll</code> file.
|
85 |
|
|
*
|
86 |
|
|
* @param new_frame The frame number for the readback bitstream data
|
87 |
|
|
* for the flip-flop provided by the
|
88 |
|
|
* <code>.ll</code> file.
|
89 |
|
|
*
|
90 |
|
|
* @param new_frameOffset The frame offset for the readback
|
91 |
|
|
* bitstream data for the flip-flop provided
|
92 |
|
|
* by the <code>.ll</code> file.
|
93 |
|
|
*
|
94 |
|
|
* @param new_block The physical location of the block containing
|
95 |
|
|
* the state element (C21, CLB_R8C55.S1,
|
96 |
|
|
* RAMB4_R4C1) provided by the <code>.ll</code>
|
97 |
|
|
* file.
|
98 |
|
|
*
|
99 |
|
|
* @param new_type The type of the flip-flop (XQ,YQ,IQ, etc.)
|
100 |
|
|
* provided by the <code>.ll</code> file.
|
101 |
|
|
*
|
102 |
|
|
* @param new_name The name of the signal or bus attached to the
|
103 |
|
|
* output of the flip-flop, provided by the
|
104 |
|
|
* <code>.ll</code> file. This <em>does not</em>
|
105 |
|
|
* include the wire's index within the bus.
|
106 |
|
|
*
|
107 |
|
|
* @param new_index The bus index of the signal attached to the
|
108 |
|
|
* flip-flop's output. For single-bit (atomic)
|
109 |
|
|
* wires, the index should be "-1".*/
|
110 |
|
|
LatchRBEntry(int new_offset, int new_frame, int new_frameOffset,
|
111 |
|
|
String new_block,String new_type,String new_name,int new_index) {
|
112 |
|
|
super(new_offset,new_frame,new_frameOffset,new_block);
|
113 |
|
|
if(new_type.indexOf("I")!= -1)
|
114 |
|
|
loc = LatchRBEntry.INPORT;
|
115 |
|
|
else if(new_type.indexOf("O")!= -1)
|
116 |
|
|
loc = LatchRBEntry.OUTPORT;
|
117 |
|
|
else
|
118 |
|
|
loc = LatchRBEntry.INTERNAL;
|
119 |
|
|
type = new_type;
|
120 |
|
|
name = new_name;
|
121 |
|
|
index = new_index;
|
122 |
|
|
}
|
123 |
|
|
|
124 |
|
|
/**
|
125 |
|
|
* Retrieves the type of the flip-flop.
|
126 |
|
|
*
|
127 |
|
|
* @return The flip-flop's type.
|
128 |
|
|
*/
|
129 |
|
|
public String getType() {
|
130 |
|
|
return type;
|
131 |
|
|
}
|
132 |
|
|
|
133 |
|
|
/**
|
134 |
|
|
* Retrieves the name of the signal attached to the flip-flop's
|
135 |
|
|
* output.
|
136 |
|
|
*
|
137 |
|
|
* @return The output signal's name. */
|
138 |
|
|
public String getName() {
|
139 |
|
|
return name;
|
140 |
|
|
}
|
141 |
|
|
|
142 |
|
|
public String getFullName() {
|
143 |
|
|
if(index != -1)
|
144 |
|
|
return name+"<"+index+">";
|
145 |
|
|
return name;
|
146 |
|
|
}
|
147 |
|
|
|
148 |
|
|
public boolean isBus() {
|
149 |
|
|
return (index != -1);
|
150 |
|
|
}
|
151 |
|
|
|
152 |
|
|
/**
|
153 |
|
|
* Retrieves a classification of the flip-flop's function: whether
|
154 |
|
|
* it is an input flip-flop, output flip-flop, or flip-flop internal
|
155 |
|
|
* to the chip.
|
156 |
|
|
*
|
157 |
|
|
* @return The flip-flop's "function". */
|
158 |
|
|
public int getLocation() {
|
159 |
|
|
return loc;
|
160 |
|
|
}
|
161 |
|
|
|
162 |
|
|
/**
|
163 |
|
|
* Retrieves the bus index of the signal attached to the flip-flop's
|
164 |
|
|
* output. If the index is equal to "-1", the wire is not a part of
|
165 |
|
|
* a bus.
|
166 |
|
|
*
|
167 |
|
|
* @return The output signal's bus index. */
|
168 |
|
|
public int getIndex() {
|
169 |
|
|
return index;
|
170 |
|
|
}
|
171 |
|
|
|
172 |
|
|
/**
|
173 |
|
|
* Tests whether the flip-flop is an FPGA input flip-flop.
|
174 |
|
|
*
|
175 |
|
|
* @return Returns <code>true</code> if the flip-flop is an FPGA
|
176 |
|
|
* input flip-flop; otherwise, it returns
|
177 |
|
|
* <code>false</code>. */
|
178 |
|
|
public boolean isInPort() {
|
179 |
|
|
return (loc == LatchRBEntry.INPORT);
|
180 |
|
|
}
|
181 |
|
|
|
182 |
|
|
/**
|
183 |
|
|
* Tests whether the flip-flop is an FPGA output flip-flop.
|
184 |
|
|
*
|
185 |
|
|
* @return Returns <code>true</code> if the flip-flop is an FPGA
|
186 |
|
|
* output flip-flop; otherwise, it returns
|
187 |
|
|
* <code>false</code>. */
|
188 |
|
|
public boolean isOutPort() {
|
189 |
|
|
return (loc == LatchRBEntry.OUTPORT);
|
190 |
|
|
}
|
191 |
|
|
|
192 |
|
|
/**
|
193 |
|
|
* Tests whether the flip-flop is an internal FPGA flip-flop.
|
194 |
|
|
*
|
195 |
|
|
* @return Returns <code>true</code> if the flip-flop is an internal
|
196 |
|
|
* FPGA flip-flop; otherwise, it returns <code>false</code>.
|
197 |
|
|
* */
|
198 |
|
|
boolean isInternal() {
|
199 |
|
|
return (loc == LatchRBEntry.INTERNAL);
|
200 |
|
|
}
|
201 |
|
|
|
202 |
|
|
/**
|
203 |
|
|
* Returns a string of the entry's offset, signal name (and index),
|
204 |
|
|
* and the type of the flip-flop */
|
205 |
|
|
public String toString() {
|
206 |
|
|
if(index != -1)
|
207 |
|
|
return " "+offset+" "+name+"<"+index+">."+type+"\n";
|
208 |
|
|
return " "+offset+" "+name+"."+type+"\n";
|
209 |
|
|
}
|
210 |
|
|
|
211 |
|
|
/**
|
212 |
|
|
* Returns a string of the entry's signal name (and index), the type
|
213 |
|
|
* of the flip-flop, and the signal name's array index. If the
|
214 |
|
|
* index is "-1" (the signal is not part of a bus), a "0" is used as
|
215 |
|
|
* the array index.*/
|
216 |
|
|
public String toGroupString() {
|
217 |
|
|
if(index != -1)
|
218 |
|
|
return " "+name+"<"+index+">."+type+" "+index+"\n";
|
219 |
|
|
return " "+name+"."+type+" 0\n";
|
220 |
|
|
}
|
221 |
|
|
}
|
222 |
|
|
|