Skip to content

Commit 5a6249a

Browse files
authored
Merge pull request #2330 from verilog-to-routing/inter_die_communication
Route 3d
2 parents 00b25eb + 2330613 commit 5a6249a

26 files changed

+104160
-358
lines changed

libs/libarchfpga/src/echo_arch.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,11 @@ void PrintArchInfo(FILE* Echo, const t_arch* arch) {
231231
break;
232232
}
233233

234-
fprintf(Echo, "\tInput Connect Block Switch Name: %s\n", arch->ipin_cblock_switch_name.c_str());
234+
fprintf(Echo, "\tInput Connect Block Switch Name Within a Same Die: %s\n", arch->ipin_cblock_switch_name[0].c_str());
235+
//if there is more than one layer available, print the connection block switch name that is used for connection between two dice
236+
if (arch->grid_layouts.size() > 1) {
237+
fprintf(Echo, "\tInput Connect Block Switch Name Between Two Dice: %s\n", arch->ipin_cblock_switch_name[1].c_str());
238+
}
235239

236240
fprintf(Echo, "*************************************************\n\n");
237241
//Switch list
@@ -280,8 +284,13 @@ void PrintArchInfo(FILE* Echo, const t_arch* arch) {
280284

281285
if (seg.directionality == UNI_DIRECTIONAL) {
282286
//wire_switch == arch_opin_switch
283-
fprintf(Echo, "\t\t\t\ttype unidir mux_name %s\n",
287+
fprintf(Echo, "\t\t\t\ttype unidir mux_name for within die connections: %s\n",
284288
arch->Switches[seg.arch_wire_switch].name.c_str());
289+
//if there is more than one layer available, print the segment switch name that is used for connection between two dice
290+
if (arch->grid_layouts.size() > 1) {
291+
fprintf(Echo, "\t\t\t\ttype unidir mux_name for between two dice connections: %s\n",
292+
arch->Switches[seg.arch_opin_between_dice_switch].name.c_str());
293+
}
285294
} else { //Should be bidir
286295
fprintf(Echo, "\t\t\t\ttype bidir wire_switch %s arch_opin_switch %s\n",
287296
arch->Switches[seg.arch_wire_switch].name.c_str(),

libs/libarchfpga/src/physical_types.h

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,9 @@ constexpr int DEFAULT_SWITCH = -2;
575575
* pinloc: Is set to true if a given pin exists on a certain position of a
576576
* block. Derived from pin_location_distribution/pin_loc_assignments
577577
*
578+
* pin_layer_offset/pin_width_offset/pin_height_offset: offset from the anchor point
579+
* of the block type in the x,y, and layer (dice number) direction.
580+
*
578581
* pin_location_distribution: The pin distribution type
579582
* num_pin_loc_assignments: The number of strings within each pin_loc_assignments
580583
* pin_loc_assignments: The strings for a custom pin location distribution.
@@ -609,17 +612,18 @@ constexpr int DEFAULT_SWITCH = -2;
609612
* logical_tile_index: index of the corresponding logical block type
610613
*
611614
* In general, the physical tile is a placeable physical resource on the FPGA device,
612-
* and it is allowed to contain an heterogeneous set of logical blocks (pb_types).
615+
* and it is allowed to contain a heterogeneous set of logical blocks (pb_types).
613616
*
614617
* Each physical tile must specify at least one sub tile, that is a physical location
615618
* on the sub tiles stacks. This means that a physical tile occupies an (x, y) location on the grid,
616619
* and it has at least one sub tile slot that allows for a placement within the (x, y) location.
617620
*
618621
* Therefore, to identify the location of a logical block within the device grid, we need to
619-
* specify three different coordinates:
622+
* specify four different coordinates:
620623
* - x : horizontal coordinate
621624
* - y : vertical coordinate
622625
* - sub tile : location within the sub tile stack at an (x, y) physical location
626+
* -layer_num : the layer that block is located at. In case of a single die, layer_num is 0.
623627
*
624628
* A physical tile is heterogeneous as it allows the placement of different kinds of logical blocks within,
625629
* that can share the same (x, y) placement location.
@@ -650,6 +654,7 @@ struct t_physical_tile_type {
650654
int primitive_class_starting_idx = -1;
651655
std::unordered_map<int, t_class> primitive_class_inf; // [primitive_class_num] -> primitive_class_inf
652656

657+
std::vector<int> pin_layer_offset; // [0..num_pins-1]
653658
std::vector<int> pin_width_offset; // [0..num_pins-1]
654659
std::vector<int> pin_height_offset; // [0..num_pins-1]
655660
std::vector<int> pin_class; // [0..num_pins-1]
@@ -1531,6 +1536,14 @@ enum e_Fc_type {
15311536
* relation to the switches from the architecture file, *
15321537
* not the expanded list of switches that is built *
15331538
* at the end of build_rr_graph *
1539+
* *
1540+
* @param arch_opin_between_dice_switch: Index of the switch type that *
1541+
* connects output pins (OPINs) *to* this segment from *
1542+
* *another die (layer)*. Note that this index is in *
1543+
* relation to the switches from the architecture file, *
1544+
* not the expanded list of switches that is built at *
1545+
* the end of build_rr_graph *
1546+
* *
15341547
* frac_cb: The fraction of logic blocks along its length to which this *
15351548
* segment can connect. (i.e. internal population). *
15361549
* frac_sb: The fraction of the length + 1 switch blocks along the segment *
@@ -1554,6 +1567,7 @@ struct t_segment_inf {
15541567
int length;
15551568
short arch_wire_switch;
15561569
short arch_opin_switch;
1570+
short arch_opin_between_dice_switch = -1;
15571571
float frac_cb;
15581572
float frac_sb;
15591573
bool longline;
@@ -1568,7 +1582,7 @@ struct t_segment_inf {
15681582
};
15691583

15701584
inline bool operator==(const t_segment_inf& a, const t_segment_inf& b) {
1571-
return a.name == b.name && a.frequency == b.frequency && a.length == b.length && a.arch_wire_switch == b.arch_wire_switch && a.arch_opin_switch == b.arch_opin_switch && a.frac_cb == b.frac_cb && a.frac_sb == b.frac_sb && a.longline == b.longline && a.Rmetal == b.Rmetal && a.Cmetal == b.Cmetal && a.directionality == b.directionality && a.parallel_axis == b.parallel_axis && a.cb == b.cb && a.sb == b.sb;
1585+
return a.name == b.name && a.frequency == b.frequency && a.length == b.length && a.arch_wire_switch == b.arch_wire_switch && a.arch_opin_switch == b.arch_opin_switch && a.arch_opin_between_dice_switch == b.arch_opin_between_dice_switch && a.frac_cb == b.frac_cb && a.frac_sb == b.frac_sb && a.longline == b.longline && a.Rmetal == b.Rmetal && a.Cmetal == b.Cmetal && a.directionality == b.directionality && a.parallel_axis == b.parallel_axis && a.cb == b.cb && a.sb == b.sb;
15721586
}
15731587

15741588
/*provide hashing for t_segment_inf to enable the use of many std containers.
@@ -1963,6 +1977,9 @@ struct t_arch {
19631977
t_power_arch* power = nullptr;
19641978
t_clock_arch* clocks = nullptr;
19651979

1980+
//determine which layers in multi-die FPGAs require to build global routing resources
1981+
std::vector<bool> layer_global_routing;
1982+
19661983
// Constants
19671984
// VCC and GND cells are special virtual cells that are
19681985
// used to handle the constant network of the device.
@@ -1990,9 +2007,10 @@ struct t_arch {
19902007
std::unordered_map<std::string, std::vector<t_lut_element>> lut_elements;
19912008

19922009
//The name of the switch used for the input connection block (i.e. to
1993-
//connect routing tracks to block pins).
1994-
//This should correspond to a switch in Switches
1995-
std::string ipin_cblock_switch_name;
2010+
//connect routing tracks to block pins). tracks can be connected to
2011+
// ipins through the same die or from other dice, each of these
2012+
//types of connections requires a different switch, all names should correspond to a switch in Switches.
2013+
std::vector<std::string> ipin_cblock_switch_name;
19962014

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

libs/libarchfpga/src/physical_types_util.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,24 @@ bool is_opin(int ipin, t_physical_tile_type_ptr type) {
670670
return false;
671671
}
672672

673+
bool is_pin_conencted_to_layer(t_physical_tile_type_ptr type, int ipin, int from_layer, int to_layer, int num_of_avail_layer) {
674+
if (type->is_empty()) { //if type is empty, there is no pins
675+
return false;
676+
}
677+
//ipin should be a valid pin in physical type
678+
VTR_ASSERT(ipin < type->num_pins);
679+
int pin_layer = from_layer + type->pin_layer_offset[ipin];
680+
//if pin_offset specifies a layer that doesn't exist in arch file, we do a wrap around
681+
pin_layer = (pin_layer < num_of_avail_layer) ? pin_layer : pin_layer % num_of_avail_layer;
682+
if (from_layer == to_layer || pin_layer == to_layer) {
683+
return true;
684+
} else {
685+
return false;
686+
}
687+
//not reachable
688+
return false;
689+
}
690+
673691
// TODO: Remove is_input_type / is_output_type / is_io_type as part of
674692
// https://github.com/verilog-to-routing/vtr-verilog-to-routing/issues/1193
675693
bool is_input_type(t_physical_tile_type_ptr type) {

libs/libarchfpga/src/physical_types_util.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@
117117
///@brief Returns true if the absolute physical pin index is an output of the given physical tile type
118118
bool is_opin(int ipin, t_physical_tile_type_ptr type);
119119

120+
///@brief Returns true if the specified pin is located at "from_layer" and it is connected to "to_layer"
121+
bool is_pin_conencted_to_layer(t_physical_tile_type_ptr type, int ipin, int from_layer, int to_layer, int num_of_avail_layer);
122+
120123
///@brief Returns true if the given physical tile type can implement a .input block type
121124
bool is_input_type(t_physical_tile_type_ptr type);
122125
///@brief Returns true if the given physical tile type can implement a .output block type

libs/libarchfpga/src/read_fpga_interchange_arch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2337,7 +2337,7 @@ struct ArchReader {
23372337
arch_->Chans.chan_y_dist.width = 0;
23382338
arch_->Chans.chan_y_dist.xpeak = 0;
23392339
arch_->Chans.chan_y_dist.dc = 0;
2340-
arch_->ipin_cblock_switch_name = std::string("generic");
2340+
arch_->ipin_cblock_switch_name.push_back(std::string("generic"));
23412341
arch_->SBType = WILTON;
23422342
arch_->Fs = 3;
23432343
default_fc_.specified = true;

0 commit comments

Comments
 (0)