Skip to content

Commit 5c3206f

Browse files
mkurc-antvaughnbetz
authored andcommitted
Added more descriptive comments to genfasm tests, removed leftover prints.
Signed-off-by: Maciej Kurc <[email protected]>
1 parent a242fc2 commit 5c3206f

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

utils/fasm/test/test_fasm.cpp

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,22 @@ TEST_CASE("match_lut_init", "[fasm]") {
169169
CHECK(match_lut_init("16'b0000000011111111", "16'b0000111100001111"));
170170
}
171171

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) {
173188
auto& device_ctx = g_vpr_ctx.device();
174189

175190
// Get tile physical tile and the pin number
@@ -178,7 +193,8 @@ std::string get_pin_feature (size_t inode) {
178193
auto physical_tile = device_ctx.grid[ilow][jlow].type;
179194
int pin_num = device_ctx.rr_nodes[inode].ptc_num();
180195

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.
182198
const t_sub_tile* sub_tile_type = nullptr;
183199
int sub_tile_pin = -1;
184200

@@ -200,14 +216,13 @@ std::string get_pin_feature (size_t inode) {
200216
REQUIRE(sub_tile_type != nullptr);
201217
REQUIRE(sub_tile_pin != -1);
202218

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.
204220
for (const auto& port : sub_tile_type->ports) {
205221
int pin_lo = port.absolute_first_pin_index;
206222
int pin_hi = pin_lo + port.num_pins;
207223

208224
if (sub_tile_pin >= pin_lo && sub_tile_pin < pin_hi) {
209225
int port_pin = sub_tile_pin - pin_lo;
210-
fprintf(stderr, " %zu %s %d\n", inode, port.name, port_pin);
211226
return vtr::string_fmt("PIN_%d_%d_%s_%s_%d", ilow, jlow, sub_tile_type->name, port.name, port_pin);
212227
}
213228
}
@@ -331,7 +346,6 @@ TEST_CASE("fasm_integration_test", "[fasm]") {
331346
if (line.find(".names") != std::string::npos) {
332347
REQUIRE(lut_def.length() > 0);
333348
lut_defs.push_back(lut_def);
334-
//fprintf(stderr, "'%s'\n", lut_def.c_str());
335349
lut_def = "";
336350
continue;
337351
}
@@ -568,7 +582,6 @@ TEST_CASE("fasm_integration_test", "[fasm]") {
568582
// Decompose the xbar feature - extract only the necessary information
569583
// such as block location and pin index.
570584
std::smatch m;
571-
fprintf(stderr, "%s\n", xbar_feature.c_str());
572585
auto res = std::regex_match(xbar_feature, m, std::regex(
573586
".*_X([0-9]+)Y([0-9]+)\\.IN([0-9])_XBAR_I([0-9]+)$"));
574587
REQUIRE(res == true);

0 commit comments

Comments
 (0)