@@ -169,7 +169,22 @@ TEST_CASE("match_lut_init", "[fasm]") {
169
169
CHECK (match_lut_init (" 16'b0000000011111111" , " 16'b0000111100001111" ));
170
170
}
171
171
172
- std::string get_pin_feature (size_t inode) {
172
+ /*
173
+ The following function returns a string describing a block pin given an IPIN/
174
+ OPIN rr node index. This is needed to correlate rr nodes with port names as
175
+ defined in the architecture and used for checking if genfasm correctlty honors
176
+ equivalent port pins rotation.
177
+
178
+ The output pin description format is:
179
+ "PIN_<xlow>_<ylow>_<sub_tile_type>_<sub_tile_port>_<port_pin_index>"
180
+
181
+ Pin decriptions returned by this functions are injected as FASM features to the
182
+ edges of a rr graph that are immediately connected with pins from "outside"
183
+ (not to from/to a SOURCE or SINK). Then, after genfasm is run they are identified,
184
+ and decoded to get all the pin information. This allows to get information
185
+ which block pins are used from the "FASM perspective".
186
+ */
187
+ static std::string get_pin_feature (size_t inode) {
173
188
auto & device_ctx = g_vpr_ctx.device ();
174
189
175
190
// Get tile physical tile and the pin number
@@ -178,7 +193,8 @@ std::string get_pin_feature (size_t inode) {
178
193
auto physical_tile = device_ctx.grid [ilow][jlow].type ;
179
194
int pin_num = device_ctx.rr_nodes [inode].ptc_num ();
180
195
181
- // Get the sub tile (type, not instance)
196
+ // Get the sub tile (type, not instance) and index of its pin that matches
197
+ // the node index.
182
198
const t_sub_tile* sub_tile_type = nullptr ;
183
199
int sub_tile_pin = -1 ;
184
200
@@ -200,14 +216,13 @@ std::string get_pin_feature (size_t inode) {
200
216
REQUIRE (sub_tile_type != nullptr );
201
217
REQUIRE (sub_tile_pin != -1 );
202
218
203
- // Find the sub tile port and pin index
219
+ // Find the sub tile port and pin index for the sub-tile type pin index.
204
220
for (const auto & port : sub_tile_type->ports ) {
205
221
int pin_lo = port.absolute_first_pin_index ;
206
222
int pin_hi = pin_lo + port.num_pins ;
207
223
208
224
if (sub_tile_pin >= pin_lo && sub_tile_pin < pin_hi) {
209
225
int port_pin = sub_tile_pin - pin_lo;
210
- fprintf (stderr, " %zu %s %d\n " , inode, port.name , port_pin);
211
226
return vtr::string_fmt (" PIN_%d_%d_%s_%s_%d" , ilow, jlow, sub_tile_type->name , port.name , port_pin);
212
227
}
213
228
}
@@ -331,7 +346,6 @@ TEST_CASE("fasm_integration_test", "[fasm]") {
331
346
if (line.find (" .names" ) != std::string::npos) {
332
347
REQUIRE (lut_def.length () > 0 );
333
348
lut_defs.push_back (lut_def);
334
- // fprintf(stderr, "'%s'\n", lut_def.c_str());
335
349
lut_def = " " ;
336
350
continue ;
337
351
}
@@ -568,7 +582,6 @@ TEST_CASE("fasm_integration_test", "[fasm]") {
568
582
// Decompose the xbar feature - extract only the necessary information
569
583
// such as block location and pin index.
570
584
std::smatch m;
571
- fprintf (stderr, " %s\n " , xbar_feature.c_str ());
572
585
auto res = std::regex_match (xbar_feature, m, std::regex (
573
586
" .*_X([0-9]+)Y([0-9]+)\\ .IN([0-9])_XBAR_I([0-9]+)$" ));
574
587
REQUIRE (res == true );
0 commit comments