Skip to content
Open
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
6596c75
Merge remote-tracking branch 'origin/interposer_parsing' into temp_ad…
soheilshahrouz Sep 18, 2025
c694846
add convert_interposer_cuts_to_sg_patterns()
soheilshahrouz Sep 19, 2025
1c6a086
replace x_spec/y_spec with a t_specified_loc member var
soheilshahrouz Sep 19, 2025
4376303
pass scatter-gather's specified loc to sb_not_here()
soheilshahrouz Sep 19, 2025
5308b87
Merge branch 'temp_3d_sg' into temp_add_interposer_wires
soheilshahrouz Sep 19, 2025
0aca585
Merge remote-tracking branch 'origin/interposer_parsing' into temp_ad…
soheilshahrouz Sep 19, 2025
9d705d9
add cut locs to DeviceGrid
soheilshahrouz Sep 23, 2025
f0b8ffd
call convert_interposer_cuts_to_sg_patterns() in RR graph generation
soheilshahrouz Sep 23, 2025
2f0bfb0
get rid of compilation errors in tests
soheilshahrouz Sep 23, 2025
3482540
pass the copied version of sg_patterns to alloc_and_load_scatter_gath…
soheilshahrouz Sep 24, 2025
b5a8ec2
add alloc_and_load_non_3d_sg_pattern_rr_node_indices()
soheilshahrouz Sep 24, 2025
b47ec96
remove is_flat from arguments of alloc_and_load_rr_graph()
soheilshahrouz Sep 24, 2025
d585890
add add_and_connect_non_3d_sg_links()
soheilshahrouz Sep 24, 2025
e7a88eb
Merge branch 'temp_3d_sg' into temp_add_interposer_wires
soheilshahrouz Sep 24, 2025
d55fbd9
call add_and_connect_non_3d_sg_links()
soheilshahrouz Sep 24, 2025
899c855
Merge branch 'temp_3d_sg' into temp_add_interposer_wires
soheilshahrouz Oct 2, 2025
1a503e1
renamed shadowing vars
soheilshahrouz Oct 2, 2025
be6af33
bugfix: cur_loc was added twice to offest
soheilshahrouz Oct 2, 2025
99b6b43
updated architecture file
soheilshahrouz Oct 2, 2025
c923574
compute chan width from RR graph and store in global context
soheilshahrouz Oct 2, 2025
0d66efc
fix commenting style in init_draw_coords()
soheilshahrouz Oct 6, 2025
1294079
bugfix: update drawing when update_screen() is called instead
soheilshahrouz Oct 6, 2025
db99b4c
use chand widtd extracted from rr graph to specify how far blocks sho…
soheilshahrouz Oct 6, 2025
5d8045b
initialize cost index for interposer wires
soheilshahrouz Oct 7, 2025
ccf70b1
Merge branch 'temp_draw_edges_cleanup' into temp_add_interposer_wires
soheilshahrouz Oct 7, 2025
a762189
avoid repetitive computation in draw_get_rr_chan_bbox()
soheilshahrouz Oct 8, 2025
6adced3
draw U-turn connections in SB for CHANY DEC->INC
soheilshahrouz Oct 8, 2025
9ace63f
draw nodes on top of edges
soheilshahrouz Oct 8, 2025
491a72b
Merge branch 'temp_interposer_cut_dim' into temp_add_interposer_wires
soheilshahrouz Oct 8, 2025
5a94c8b
clean drawplace()
soheilshahrouz Oct 8, 2025
7229998
Merge branch 'temp_interposer_cut_dim' into temp_add_interposer_wires
soheilshahrouz Oct 8, 2025
a28679e
fix compilation errors due to enum name change
soheilshahrouz Oct 8, 2025
7311edf
doxygen comment for rr_chanx_width and rr_chany_width
soheilshahrouz Oct 8, 2025
210a8e0
ifndef NO_GRAPHICS in draw_interposer files
soheilshahrouz Oct 8, 2025
c101faa
enum class e_pic_type
soheilshahrouz Oct 8, 2025
57c3655
Merge branch 'temp_interposer_cut_dim' into temp_add_interposer_wires
soheilshahrouz Oct 14, 2025
1074e27
update config files with --device command line arg
soheilshahrouz Oct 15, 2025
ec5332a
Merge branch 'master' into temp_add_interposer_wires and resolve conf…
soheilshahrouz Oct 15, 2025
cc19794
remove unused function
soheilshahrouz Oct 15, 2025
a8ef54b
make format
soheilshahrouz Oct 15, 2025
b47b0ba
draw interposer edges
soheilshahrouz Oct 16, 2025
ad376ef
update the interposer arch file
soheilshahrouz Oct 16, 2025
e70f165
Merge branch 'master' into temp_add_interposer_wires
soheilshahrouz Oct 16, 2025
2afc126
update doxygen comments
soheilshahrouz Oct 17, 2025
b3627f5
remove duplicate code
soheilshahrouz Oct 17, 2025
7eb7c4c
simplify the logic in draw_place and add a doxygen comment
soheilshahrouz Oct 17, 2025
97bd7b1
separate tasks for fixed custom grid
soheilshahrouz Oct 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions libs/libarchfpga/src/grid_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <string>
#include <memory>

// Forward declerations
// Forward declarations

struct t_metadata_dict;

Expand Down Expand Up @@ -112,7 +112,6 @@ struct t_grid_loc_def {
* @brief When 1 metadata tag is split among multiple t_grid_loc_def, one
* t_grid_loc_def is arbitrarily chosen to own the metadata, and the other
* t_grid_loc_def point to the owned version.
*
*/
std::unique_ptr<t_metadata_dict> owned_meta;

Expand All @@ -125,7 +124,7 @@ struct t_grid_loc_def {
};

/**
* @brief Enum for specfying if the architecture grid specification is for an auto sized device (variable size)
* @brief Enum for specifying if the architecture grid specification is for an auto sized device (variable size)
* or a fixed size device.
*/
enum class e_grid_def_type {
Expand Down
11 changes: 11 additions & 0 deletions libs/libarchfpga/src/physical_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "arch_types.h"
#include "vtr_math.h"
#include "vtr_util.h"
#include "vtr_assert.h"

#include "arch_util.h"

Expand Down Expand Up @@ -408,3 +409,13 @@ const t_physical_tile_port* t_sub_tile::get_port_by_pin(int pin) const {

return nullptr;
}

const t_grid_def& t_arch::grid_layout() const {
for (const t_grid_def& layout : grid_layouts) {
if (layout.name == device_layout) {
return layout;
}
}
VTR_ASSERT_SAFE_MSG(false, "Device layout not found.");
return grid_layouts.front(); // unreachable, keeps compiler happy
}
6 changes: 5 additions & 1 deletion libs/libarchfpga/src/physical_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -2067,7 +2067,11 @@ struct t_arch {
// types of connections requires a different switch, all names should correspond to a switch in Switches.
std::vector<std::string> ipin_cblock_switch_name;

std::vector<t_grid_def> grid_layouts; //Set of potential device layouts
/// Set of potential device layouts
std::vector<t_grid_def> grid_layouts;

/// Returns the selected layout
const t_grid_def& grid_layout() const;

// the layout that is chosen to be used with command line options
// It is used to generate custom SB for a specific locations within the device
Expand Down
6 changes: 4 additions & 2 deletions libs/libarchfpga/src/scatter_gather_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@ enum class e_scatter_gather_type {
};

/**
* @brief Struct containing information of an <sg_location> tag. An <sg_location> tag instantiates the scatter-gather pattern in some switchblock locations around the device.
* @brief Struct containing information of an <sg_location> tag.
* An <sg_location> tag instantiates the scatter-gather pattern in some switchblock locations around the device.
* `x_spec` and `y_spec` are only valid if type == e_sb_location::E_XY_SPECIFIED.
*/
struct t_sg_location {
e_sb_location type; ///< Type of locations that the pattern is instantiated at.
t_specified_loc region; ///< Specification of the region where gather is applied
int num; ///< Number of scatter-gather pattern instantiations per location.
std::string sg_link_name; ///< Name of scatter-gather link to be used.
};

/**
* @brief Struct containing information of a <sg_link> tag. This tag describes how and where the scatter (fanout) happens relative to the gather (fanin).
*
*/
struct t_sg_link {
std::string name; ///< Name of the sg_link.
Expand Down
8 changes: 3 additions & 5 deletions libs/libarchfpga/src/switchblock_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ inline const std::unordered_map<std::string, e_sb_location> SB_LOCATION_STRING_M
{"FRINGE", e_sb_location::E_FRINGE},
{"XY_SPECIFIED", e_sb_location::E_XY_SPECIFIED}};

/**
* @brief Describes regions that a specific switch block specifications should be applied to
*/
/// @brief Describes regions that a specific switch block specifications should be applied to
struct t_sb_loc_spec {
int start = -1;
int repeat = -1;
Expand All @@ -97,8 +95,8 @@ struct t_sb_loc_spec {
class SBSideConnection {
public:
// Specify the two SB sides that form a connection
enum e_side from_side = TOP;
enum e_side to_side = TOP;
e_side from_side = TOP;
e_side to_side = TOP;

void set_sides(enum e_side from, enum e_side to) {
from_side = from;
Expand Down
54 changes: 31 additions & 23 deletions vpr/src/draw/draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@
#include "draw_rr.h"
/****************************** Define Macros *******************************/

#define DEFAULT_RR_NODE_COLOR ezgl::BLACK
#define OLD_BLK_LOC_COLOR blk_GOLD
#define NEW_BLK_LOC_COLOR blk_GREEN
static constexpr ezgl::color DEFAULT_RR_NODE_COLOR = ezgl::BLACK;
static constexpr ezgl::color OLD_BLK_LOC_COLOR = blk_GOLD;
static constexpr ezgl::color NEW_BLK_LOC_COLOR = blk_GREEN;
//#define TIME_DRAWSCREEN /* Enable if want to track runtime for drawscreen() */

void act_on_key_press(ezgl::application* /*app*/, GdkEventKey* /*event*/, char* key_name);
Expand Down Expand Up @@ -462,54 +462,64 @@ void init_draw_coords(float clb_width, const BlkLocRegistry& blk_loc_registry) {
const DeviceGrid& grid = device_ctx.grid;
const RRGraphView& rr_graph = device_ctx.rr_graph;

/* Store a reference to block location variables so that other drawing
* functions can access block location information without accessing
* the global placement state, which is inaccessible during placement.*/
// Store a reference to block location variables so that other drawing
// functions can access block location information without accessing
// the global placement state, which is inaccessible during placement.
draw_state->set_graphics_blk_loc_registry_ref(blk_loc_registry);

// do not initialize only if --disp off and --save_graphics off
if (!draw_state->show_graphics && !draw_state->save_graphics && draw_state->graphics_commands.empty()) {
return;
}

/* Each time routing is on screen, need to reallocate the color of each *
* rr_node, as the number of rr_nodes may change. */
// Each time routing is on screen, need to reallocate the color of each
// rr_node, as the number of rr_nodes may change.
if (rr_graph.num_nodes() != 0) {
draw_state->draw_rr_node.resize(rr_graph.num_nodes());
for (RRNodeId inode : rr_graph.nodes()) {
draw_state->draw_rr_node[inode].color = DEFAULT_RR_NODE_COLOR;
draw_state->draw_rr_node[inode].node_highlighted = false;
}
}

draw_coords->set_tile_width(clb_width);
draw_coords->pin_size = 0.3;
for (const auto& type : device_ctx.physical_tile_types) {
for (const t_physical_tile_type& type : device_ctx.physical_tile_types) {
int num_pins = type.num_pins;
if (num_pins > 0) {
draw_coords->pin_size = std::min(draw_coords->pin_size,
(draw_coords->get_tile_width() / (4.0F * num_pins)));
draw_coords->get_tile_width() / (4.0F * num_pins));
}
}

size_t j = 0;
for (size_t i = 0; i < grid.width() - 1; i++) {
draw_coords->tile_x[i] = (i * draw_coords->get_tile_width()) + j;
draw_coords->tile_x[i] = i * draw_coords->get_tile_width() + j;
j += device_ctx.rr_chany_width[i] + 1; // N wires need N+1 units of space
}
draw_coords->tile_x[grid.width() - 1] = (grid.width() - 1) * draw_coords->get_tile_width() + j;

j = 0;
for (size_t i = 0; i < device_ctx.grid.height() - 1; ++i) {
draw_coords->tile_y[i] = (i * draw_coords->get_tile_width()) + j;
for (size_t i = 0; i < grid.height() - 1; ++i) {
draw_coords->tile_y[i] = i * draw_coords->get_tile_width() + j;
j += device_ctx.rr_chanx_width[i] + 1;
}
draw_coords->tile_y[grid.height() - 1] = (grid.height() - 1) * draw_coords->get_tile_width() + j;

/* Load coordinates of sub-blocks inside the clbs */
// Load coordinates of sub-blocks inside the clbs
draw_internal_init_blk();
//Margin beyond edge of the drawn device to extend the visible world
//Setting this to > 0.0 means 'Zoom Fit' leave some fraction of white
//space around the device edges
// Margin beyond edge of the drawn device to extend the visible world
// Setting this to > 0.0 means 'Zoom Fit' leave some fraction of white
// space around the device edges
constexpr float VISIBLE_MARGIN = 0.01;

float draw_width = draw_coords->tile_x[grid.width() - 1] + draw_coords->get_tile_width();
float draw_height = draw_coords->tile_y[grid.height() - 1] + draw_coords->get_tile_height();

initial_world = ezgl::rectangle(
{-VISIBLE_MARGIN * draw_width, -VISIBLE_MARGIN * draw_height},
{(1. + VISIBLE_MARGIN) * draw_width, (1. + VISIBLE_MARGIN)
* draw_height});
#else
(void)clb_width;
(void)blk_loc_registry;
Expand Down Expand Up @@ -550,8 +560,6 @@ void set_initial_world_ap() {

int get_track_num(int inode, const vtr::OffsetMatrix<int>& chanx_track, const vtr::OffsetMatrix<int>& chany_track) {
/* Returns the track number of this routing resource node. */

int i, j;
e_rr_type rr_type;
const DeviceContext& device_ctx = g_vpr_ctx.device();
const RRGraphView& rr_graph = device_ctx.rr_graph;
Expand All @@ -563,8 +571,8 @@ int get_track_num(int inode, const vtr::OffsetMatrix<int>& chanx_track, const vt
/* GLOBAL route stuff below. */

rr_type = rr_graph.node_type(rr_node);
i = rr_graph.node_xlow(rr_node); /* NB: Global rr graphs must have only unit */
j = rr_graph.node_ylow(rr_node); /* length channel segments. */
int i = rr_graph.node_xlow(rr_node); // Global rr graphs must have only unit
int j = rr_graph.node_ylow(rr_node); // length channel segments.

switch (rr_type) {
case e_rr_type::CHANX:
Expand Down Expand Up @@ -1156,7 +1164,7 @@ static void set_force_pause(GtkWidget* /*widget*/, gint /*response_id*/, gpointe
}

static void run_graphics_commands(const std::string& commands) {
//A very simmple command interpreter for scripting graphics
// A very simple command interpreter for scripting graphics
t_draw_state* draw_state = get_draw_state_vars();

t_draw_state backup_draw_state = *draw_state;
Expand Down Expand Up @@ -1251,7 +1259,7 @@ static void run_graphics_commands(const std::string& commands) {
}
}

*draw_state = backup_draw_state; //Restor original draw state
*draw_state = backup_draw_state; // Restore original draw state

//Advance the sequence number
++draw_state->sequence_number;
Expand Down
39 changes: 15 additions & 24 deletions vpr/src/draw/draw_basic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,41 +76,37 @@ void drawplace(ezgl::renderer* g) {
t_draw_state* draw_state = get_draw_state_vars();
t_draw_coords* draw_coords = get_draw_coords_vars();
const DeviceContext& device_ctx = g_vpr_ctx.device();
const DeviceGrid& grid = device_ctx.grid;
const ClusteringContext& cluster_ctx = g_vpr_ctx.clustering();
const auto& grid_blocks = draw_state->get_graphics_blk_loc_registry_ref().grid_blocks();

ClusterBlockId bnum;
int num_sub_tiles;

int total_num_layers = device_ctx.grid.get_num_layers();
int total_num_layers = grid.get_num_layers();

g->set_line_width(0);
for (int layer_num = 0; layer_num < total_num_layers; layer_num++) {
if (draw_state->draw_layer_display[layer_num].visible) {
for (int i = 0; i < (int)device_ctx.grid.width(); i++) {
for (int j = 0; j < (int)device_ctx.grid.height(); j++) {
/* Only the first block of a group should control drawing */
const auto& type = device_ctx.grid.get_physical_type({i, j, layer_num});
int width_offset = device_ctx.grid.get_width_offset({i, j, layer_num});
int height_offset = device_ctx.grid.get_height_offset({i, j, layer_num});
for (int i = 0; i < (int)grid.width(); i++) {
for (int j = 0; j < (int)grid.height(); j++) {
if (!grid.is_root_location({i, j, layer_num})) {
continue;
}

// Only the first block of a group should control drawing
const t_physical_tile_type_ptr type = grid.get_physical_type({i, j, layer_num});

//The transparency level for the current layer being drawn (0-255)
// 0 - opaque, 255 - transparent
int transparency_factor = draw_state->draw_layer_display[layer_num].alpha;

if (width_offset > 0
|| height_offset > 0)
continue;

num_sub_tiles = type->capacity;
int num_sub_tiles = type->capacity;
/* Don't draw if tile capacity is zero. eg-> corners. */
if (num_sub_tiles == 0) {
continue;
}

for (int k = 0; k < num_sub_tiles; ++k) {
/* Look at the tile at start of large block */
bnum = grid_blocks.block_at_location({i, j, k, layer_num});
ClusterBlockId bnum = grid_blocks.block_at_location({i, j, k, layer_num});
/* Fill background for the clb. Do not fill if "show_blk_internal"
* is toggled.
*/
Expand Down Expand Up @@ -170,17 +166,12 @@ void drawplace(ezgl::renderer* g) {
abs_clb_bbox.height());
}
/* Draw text for block type so that user knows what block */
if (width_offset == 0
&& height_offset == 0) {
if (grid.is_root_location({i, j, layer_num})) {
std::string block_type_loc = type->name;
block_type_loc += vtr::string_fmt(" (%d,%d)", i, j);

g->draw_text(
center
- ezgl::point2d(0,
abs_clb_bbox.height() / 4),
block_type_loc.c_str(), abs_clb_bbox.width(),
abs_clb_bbox.height());
g->draw_text(center - ezgl::point2d(0, abs_clb_bbox.height() / 4),
block_type_loc.c_str(), abs_clb_bbox.width(), abs_clb_bbox.height());
}
}
}
Expand Down
12 changes: 5 additions & 7 deletions vpr/src/draw/draw_interposer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ void draw_interposer_cuts(ezgl::renderer* g) {
{draw_coords->tile_x.front() - draw_coords->get_tile_width(),
draw_coords->tile_y.front() - draw_coords->get_tile_height()},
{draw_coords->tile_x.back() + 2 * draw_coords->get_tile_width(),
draw_coords->tile_y.back() + 2 * draw_coords->get_tile_height()}
};

g->set_color(ezgl::BLACK, 255);
g->set_line_dash(ezgl::line_dash::asymmetric_5_3);
g->set_line_width(2);
draw_coords->tile_y.back() + 2 * draw_coords->get_tile_height()}};

const std::vector<std::vector<int>>& horizontal_cuts = grid.get_horizontal_interposer_cuts();
const std::vector<std::vector<int>>& vertical_cuts = grid.get_vertical_interposer_cuts();
Expand Down Expand Up @@ -75,9 +70,12 @@ void draw_interposer_cuts(ezgl::renderer* g) {
}
}

g->set_color(ezgl::BLACK, 255);
g->set_line_dash(ezgl::line_dash::asymmetric_5_3);
g->set_line_width(2);
for (const auto& [start, end] : lines_to_draw) {
g->draw_line(start, end);
}
}

#endif
#endif
2 changes: 1 addition & 1 deletion vpr/src/draw/draw_interposer.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ class renderer;
/// which side of the cut owns the channel.
void draw_interposer_cuts(ezgl::renderer* g);

#endif
#endif
Loading
Loading