Skip to content

Commit fab62af

Browse files
committed
Merge branch 'floorplanning_legend' of https://github.com/verilog-to-routing/vtr-verilog-to-routing into floorplanning_legend
2 parents 680f3ce + d98a63f commit fab62af

File tree

95 files changed

+3321
-602
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+3321
-602
lines changed

doc/src/api/vprinternals/draw_files.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ draw_debug.h/cpp
2626
:project: vpr
2727
:sections: detaileddescription
2828

29+
draw_floorplanning.h/cpp
30+
--------------
31+
.. doxygenfile:: draw_floorplanning.h
32+
:project: vpr
33+
:sections: detaileddescription
34+
2935
draw_global.h/cpp
3036
--------------
3137
.. doxygenfile:: draw_global.h
@@ -120,4 +126,4 @@ ui_setup.h/cpp
120126
--------------
121127
.. doxygenfile:: ui_setup.h
122128
:project: vpr
123-
:sections: detaileddescription
129+
:sections: detaileddescription

doc/src/arch/reference.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2301,7 +2301,7 @@ The full format is documented below.
23012301
Defined under the ``<switchfuncs>`` XML node, one or more ``<func...>`` entries is used to specify permutation functions that connect different sides of a switch block.
23022302

23032303

2304-
.. arch:tag:: <wireconn num_conns="expr" from_type="string, string, string, ..." to_type="string, string, string, ..." from_switchpoint="int, int, int, ..." to_switchpoint="int, int, int, ..." from_order="{fixed | shuffled}" to_order="{fixed | shuffled}"/>
2304+
.. arch:tag:: <wireconn num_conns="expr" from_type="string, string, string, ..." to_type="string, string, string, ..." from_switchpoint="int, int, int, ..." to_switchpoint="int, int, int, ..." from_order="{fixed | shuffled}" to_order="{fixed | shuffled}" switch_override="string"/>
23052305
23062306
:req_param num_conns:
23072307
Specifies how many connections should be created between the from_type/from_switchpoint set and the to_type/to_switchpoint set.
@@ -2401,6 +2401,14 @@ The full format is documented below.
24012401
24022402
.. note:: See ``from_switchpoint_order`` for value descritpions.
24032403

2404+
:opt_param switch_override:
2405+
2406+
Specifies the name of a switch to be used to override the wire_switch of the segments in the ``to`` set.
2407+
Can be used to create switch patterns where different switches are used for different types of connections.
2408+
By using a zero-delay and zero-resistance switch one can also create T and L shaped wire segments.
2409+
2410+
**Default:** If no override is specified, the usual wire_switch that drives the ``to`` wire will be used.
2411+
24042412
.. arch:tag:: <from type="string" switchpoint="int, int, int, ..."/>
24052413
24062414
:req_param type:

doc/src/vpr/command_line_usage.rst

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -665,15 +665,26 @@ If any of init_t, exit_t or alpha_t is specified, the user schedule, with a fixe
665665
**Default:** ``on`` if timing-driven placement is specified, ``off`` otherwise.
666666

667667
.. option:: --inner_num <float>
668+
669+
The number of moves attempted at each temperature in placement can be calculated from inner_num scaled with circuit size or device-circuit size as specified in ``place_effort_scaling``.
668670

669-
The number of moves attempted at each temperature is inner_num * num_blocks^(4/3) in the circuit.
670-
The number of blocks in a circuit is the number of pads plus the number of clbs.
671671
Changing inner_num is the best way to change the speed/quality tradeoff of the placer, as it leaves the highly-efficient automatic annealing schedule on and simply changes the number of moves per temperature.
672672

673673
Specifying ``-inner_num 10`` will slow the placer by a factor of 10 while typically improving placement quality only by 10% or less (depends on the architecture).
674674
Hence users more concerned with quality than CPU time may find this a more appropriate value of inner_num.
675675

676-
**Default:** ``1.0``
676+
**Default:** ``0.5``
677+
678+
.. option:: --place_effort_scaling {circuit | device_circuit}
679+
680+
Controls how the number of placer moves level scales with circuit and device size:
681+
682+
* ``circuit``: The number of moves attempted at each temperature is inner_num * num_blocks^(4/3) in the circuit.
683+
* ``device_circuit``: The number of moves attempted at each temperature is inner_num * grid_size^(2/3) * num_blocks^(4/3) in the circuit.
684+
685+
The number of blocks in a circuit is the number of pads plus the number of clbs.
686+
687+
**Default:** ``circuit``
677688

678689
.. option:: --init_t <float>
679690

doc/src/vpr/graphics.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,11 @@ Button Description Table
182182
| | | | |
183183
| | | | |
184184
+-------------------+-------------------+------------------------------+------------------------------+
185+
| Draw Partitions | Placement/Routing | Visualizes placement | |
186+
| | | constraints | |
187+
| | | | |
188+
| | | | |
189+
+-------------------+-------------------+------------------------------+------------------------------+
185190
| Place Macros | Placement/Routing | Visualizes placement macros | |
186191
| | | | |
187192
| | | | |

libs/libarchfpga/src/parse_switchblocks.cpp

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ using vtr::t_formula_data;
4141
/*---- Functions for Parsing Switchblocks from Architecture ----*/
4242

4343
//Load an XML wireconn specification into a t_wireconn_inf
44-
t_wireconn_inf parse_wireconn(pugi::xml_node node, const pugiutil::loc_data& loc_data);
44+
t_wireconn_inf parse_wireconn(pugi::xml_node node, const pugiutil::loc_data& loc_data, const t_arch_switch_inf* switches, int num_switches);
4545

4646
//Process the desired order of a wireconn
4747
static void parse_switchpoint_order(const char* order, SwitchPointOrder& switchpoint_order);
4848

4949
//Process a wireconn defined in the inline style (using attributes)
50-
void parse_wireconn_inline(pugi::xml_node node, const pugiutil::loc_data& loc_data, t_wireconn_inf& wc);
50+
void parse_wireconn_inline(pugi::xml_node node, const pugiutil::loc_data& loc_data, t_wireconn_inf& wc, const t_arch_switch_inf* switches, int num_switches);
5151

5252
//Process a wireconn defined in the multinode style (more advanced specification)
53-
void parse_wireconn_multinode(pugi::xml_node node, const pugiutil::loc_data& loc_data, t_wireconn_inf& wc);
53+
void parse_wireconn_multinode(pugi::xml_node node, const pugiutil::loc_data& loc_data, t_wireconn_inf& wc, const t_arch_switch_inf* switches, int num_switches);
5454

5555
//Process a <from> or <to> sub-node of a multinode wireconn
5656
t_wire_switchpoints parse_wireconn_from_to_node(pugi::xml_node node, const pugiutil::loc_data& loc_data);
@@ -65,6 +65,9 @@ static void parse_comma_separated_wire_points(const char* ch, std::vector<t_wire
6565
/* Parses the number of connections type */
6666
static void parse_num_conns(std::string num_conns, t_wireconn_inf& wireconn);
6767

68+
/* parse switch_override in wireconn */
69+
static void parse_switch_override(const char* switch_override, t_wireconn_inf& wireconn, const t_arch_switch_inf* switches, int num_switches);
70+
6871
/* checks for correctness of a unidir switchblock. */
6972
static void check_unidir_switchblock(const t_switchblock_inf* sb);
7073

@@ -79,7 +82,7 @@ static void check_wireconn(const t_arch* arch, const t_wireconn_inf& wireconn);
7982
/*---- Functions for Parsing Switchblocks from Architecture ----*/
8083

8184
/* Reads-in the wire connections specified for the switchblock in the xml arch file */
82-
void read_sb_wireconns(const t_arch_switch_inf* /*switches*/, int /*num_switches*/, pugi::xml_node Node, t_switchblock_inf* sb, const pugiutil::loc_data& loc_data) {
85+
void read_sb_wireconns(const t_arch_switch_inf* switches, int num_switches, pugi::xml_node Node, t_switchblock_inf* sb, const pugiutil::loc_data& loc_data) {
8386
/* Make sure that Node is a switchblock */
8487
check_node(Node, "switchblock", loc_data);
8588

@@ -94,33 +97,33 @@ void read_sb_wireconns(const t_arch_switch_inf* /*switches*/, int /*num_switches
9497
SubElem = get_first_child(Node, "wireconn", loc_data);
9598
}
9699
for (int i = 0; i < num_wireconns; i++) {
97-
t_wireconn_inf wc = parse_wireconn(SubElem, loc_data);
100+
t_wireconn_inf wc = parse_wireconn(SubElem, loc_data, switches, num_switches); // need to pass in switch info for switch override
98101
sb->wireconns.push_back(wc);
99102
SubElem = SubElem.next_sibling(SubElem.name());
100103
}
101104

102105
return;
103106
}
104107

105-
t_wireconn_inf parse_wireconn(pugi::xml_node node, const pugiutil::loc_data& loc_data) {
108+
t_wireconn_inf parse_wireconn(pugi::xml_node node, const pugiutil::loc_data& loc_data, const t_arch_switch_inf* switches, int num_switches) {
106109
t_wireconn_inf wc;
107110

108111
size_t num_children = count_children(node, "from", loc_data, ReqOpt::OPTIONAL);
109112
num_children += count_children(node, "to", loc_data, ReqOpt::OPTIONAL);
110113

111114
if (num_children == 0) {
112-
parse_wireconn_inline(node, loc_data, wc);
115+
parse_wireconn_inline(node, loc_data, wc, switches, num_switches);
113116
} else {
114117
VTR_ASSERT(num_children > 0);
115-
parse_wireconn_multinode(node, loc_data, wc);
118+
parse_wireconn_multinode(node, loc_data, wc, switches, num_switches);
116119
}
117120

118121
return wc;
119122
}
120123

121-
void parse_wireconn_inline(pugi::xml_node node, const pugiutil::loc_data& loc_data, t_wireconn_inf& wc) {
124+
void parse_wireconn_inline(pugi::xml_node node, const pugiutil::loc_data& loc_data, t_wireconn_inf& wc, const t_arch_switch_inf* switches, int num_switches) {
122125
//Parse an inline wireconn definition, using attributes
123-
expect_only_attributes(node, {"num_conns", "from_type", "to_type", "from_switchpoint", "to_switchpoint", "from_order", "to_order"}, loc_data);
126+
expect_only_attributes(node, {"num_conns", "from_type", "to_type", "from_switchpoint", "to_switchpoint", "from_order", "to_order", "switch_override"}, loc_data);
124127

125128
/* get the connection style */
126129
const char* char_prop = get_attribute(node, "num_conns", loc_data).value();
@@ -147,9 +150,13 @@ void parse_wireconn_inline(pugi::xml_node node, const pugiutil::loc_data& loc_da
147150

148151
char_prop = get_attribute(node, "to_order", loc_data, ReqOpt::OPTIONAL).value();
149152
parse_switchpoint_order(char_prop, wc.to_switchpoint_order);
153+
154+
// parse switch overrides if they exist:
155+
char_prop = get_attribute(node, "switch_override", loc_data, ReqOpt::OPTIONAL).value();
156+
parse_switch_override(char_prop, wc, switches, num_switches);
150157
}
151158

152-
void parse_wireconn_multinode(pugi::xml_node node, const pugiutil::loc_data& loc_data, t_wireconn_inf& wc) {
159+
void parse_wireconn_multinode(pugi::xml_node node, const pugiutil::loc_data& loc_data, t_wireconn_inf& wc, const t_arch_switch_inf* switches, int num_switches) {
153160
expect_only_children(node, {"from", "to"}, loc_data);
154161

155162
/* get the connection style */
@@ -162,6 +169,9 @@ void parse_wireconn_multinode(pugi::xml_node node, const pugiutil::loc_data& loc
162169
char_prop = get_attribute(node, "to_order", loc_data, ReqOpt::OPTIONAL).value();
163170
parse_switchpoint_order(char_prop, wc.to_switchpoint_order);
164171

172+
char_prop = get_attribute(node, "switch_override", loc_data, ReqOpt::OPTIONAL).value();
173+
parse_switch_override(char_prop, wc, switches, num_switches);
174+
165175
size_t num_from_children = count_children(node, "from", loc_data);
166176
size_t num_to_children = count_children(node, "to", loc_data);
167177

@@ -331,6 +341,24 @@ void read_sb_switchfuncs(pugi::xml_node Node, t_switchblock_inf* sb, const pugiu
331341
return;
332342
}
333343

344+
static void parse_switch_override(const char* switch_override, t_wireconn_inf& wireconn, const t_arch_switch_inf* switches, int num_switches) {
345+
// sentinel value to use default driving switch for the receiving wire type
346+
if (switch_override == std::string("")) {
347+
wireconn.switch_override_indx = DEFAULT_SWITCH; //Default
348+
return;
349+
}
350+
351+
// iterate through the valid switch names in the arch looking for the requested switch_override
352+
for (int i = 0; i < num_switches; i++) {
353+
if (0 == strcmp(switch_override, switches[i].name)) {
354+
wireconn.switch_override_indx = i;
355+
return;
356+
}
357+
}
358+
// if we haven't found a switch that matched, then throw an error
359+
archfpga_throw(__FILE__, __LINE__, "Unknown switch_override specified in wireconn of custom switch blocks: \"%s\"\n", switch_override);
360+
}
361+
334362
/* checks for correctness of switch block read-in from the XML architecture file */
335363
void check_switchblock(const t_switchblock_inf* sb, const t_arch* arch) {
336364
/* get directionality */

libs/libarchfpga/src/physical_types.h

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,10 @@ struct t_class {
450450
struct t_class_range {
451451
int low = 0;
452452
int high = 0;
453+
// Returns the total number of classes
454+
int total_num() const {
455+
return high - low + 1;
456+
}
453457
};
454458

455459
enum e_power_wire_type {
@@ -613,11 +617,14 @@ struct t_physical_tile_type {
613617

614618
std::vector<t_class> class_inf; /* [0..num_class-1] */
615619

620+
std::unordered_map<int, t_class> internal_class_inf;
621+
616622
std::vector<int> pin_width_offset; // [0..num_pins-1]
617623
std::vector<int> pin_height_offset; // [0..num_pins-1]
618624
std::vector<int> pin_class; // [0..num_pins-1]
619-
std::vector<bool> is_ignored_pin; // [0..num_pins-1]
620-
std::vector<bool> is_pin_global; // [0..num_pins-1]
625+
std::unordered_map<int, int> internal_pin_class;
626+
std::vector<bool> is_ignored_pin; // [0..num_pins-1]
627+
std::vector<bool> is_pin_global; // [0..num_pins-1]
621628

622629
std::vector<t_fc_specification> fc_specs;
623630

@@ -725,6 +732,9 @@ struct t_sub_tile {
725732
///> indices ranging from 4 to 7.
726733
t_class_range class_range;
727734

735+
std::vector<std::unordered_map<t_logical_block_type_ptr, int>> starting_internal_class_idx;
736+
std::vector<std::unordered_map<t_logical_block_type_ptr, int>> starting_internal_pin_idx;
737+
728738
int num_phy_pins = 0;
729739

730740
int index = -1;
@@ -818,6 +828,15 @@ struct t_physical_tile_port {
818828
* index: Keep track of type in array for easy access
819829
* physical_tile_index: index of the corresponding physical tile type
820830
*
831+
* pin_logical_num_to_pb_pin_mapping: Contains all the pins, including pins on the root-level block and internal pins, in
832+
* the logical block. The key of this map is the logical number of the pin, and the value is a pointer to the
833+
* corresponding pb_graph_pin
834+
*
835+
* pb_pin_to_class_logical_num_mapping: Maps each pin to its corresponding class's logical number. To retrieve the actual class, use this number as an
836+
* index to logical_class_inf.
837+
*
838+
* logical_class_inf: Contains all the classes inside the logical block. The index of each class is the logical number associate with the class.
839+
*
821840
* A logical block is the implementation of a component's functionality of the FPGA device
822841
* and it identifies its logical behaviour and internal connections.
823842
*
@@ -840,6 +859,10 @@ struct t_logical_block_type {
840859
std::vector<t_physical_tile_type_ptr> equivalent_tiles; ///>List of physical tiles at which one could
841860
///>place this type of netlist block.
842861

862+
std::unordered_map<int, const t_pb_graph_pin*> pin_logical_num_to_pb_pin_mapping; /* pin_logical_num_to_pb_pin_mapping[pin logical number] -> pb_graph_pin ptr} */
863+
std::unordered_map<const t_pb_graph_pin*, int> pb_pin_to_class_logical_num_mapping; /* pb_pin_to_class_logical_num_mapping[pb_graph_pin ptr] -> class logical number */
864+
std::vector<t_class> logical_class_inf; /* logical_class_inf[class_logical_number] -> class */
865+
843866
// Is this t_logical_block_type empty?
844867
bool is_empty() const;
845868
};
@@ -1688,6 +1711,8 @@ struct t_wireconn_inf {
16881711
std::vector<t_wire_switchpoints> to_switchpoint_set; //The set of segment/wirepoints representing the 'to' set (union of all t_wire_switchpoints in vector)
16891712
SwitchPointOrder from_switchpoint_order = SwitchPointOrder::FIXED; //The desired from_switchpoint_set ordering
16901713
SwitchPointOrder to_switchpoint_order = SwitchPointOrder::FIXED; //The desired to_switchpoint_set ordering
1714+
int switch_override_indx = DEFAULT_SWITCH; // index in switch array of the switch used to override wire_switch of the 'to' set.
1715+
// DEFAULT_SWITCH is a sentinel value (i.e. the usual driving switch from a wire for the receiving wire will be used)
16911716

16921717
std::string num_conns_formula; /* Specifies how many connections should be made for this wireconn.
16931718
*

0 commit comments

Comments
 (0)