Skip to content

Conversation

soheilshahrouz
Copy link
Contributor

@soheilshahrouz soheilshahrouz commented Sep 4, 2025

Whenever we want to iterate over all tile locations, we use a nested loop with three variables for x, y, and layer. This causes three levels of indentation. In RR graph generation code, additional conditional statements and loops incease indentation level to as high as 6-7, making some lines really long. This PR adds a new function to DeviceGrid to allow iterating over all tile location using a single loop.

In addition, the root location of tiles are passed in deep function call hierarchies using three separate arguments for x, y, and layer. I replaces these three arguments with a t_physical_tile_loc argument to make function calls more concise.

I also changed the return type of DeviceGrid::get_num_layers() to size_t to be consistent with width() and height() methods.

@github-actions github-actions bot added VPR VPR FPGA Placement & Routing Tool libarchfpga Library for handling FPGA Architecture descriptions lang-cpp C/C++ code libvtrutil labels Sep 4, 2025
@soheilshahrouz soheilshahrouz changed the title [WIP] Cleanups in RR graph generation Cleanups in RR graph generation Sep 5, 2025
Copy link
Contributor

@AmirhosseinPoolad AmirhosseinPoolad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR Soheil! Great changes. Had some small nitpicks here and there.

@AmirhosseinPoolad
Copy link
Contributor

LGTM

Copy link
Contributor

@AlexandreSinger AlexandreSinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I like this change. Adding an iterator like this is a neat way to make iteration easier.

@AlexandreSinger AlexandreSinger merged commit 4cf678a into master Sep 5, 2025
30 checks passed
@AlexandreSinger AlexandreSinger deleted the temp_num_layers_size_t branch September 5, 2025 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang-cpp C/C++ code libarchfpga Library for handling FPGA Architecture descriptions libvtrutil VPR VPR FPGA Placement & Routing Tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants