Skip to content

Commit fdccbc5

Browse files
Merge remote-tracking branch 'origin/master' into temp_3d_sg
2 parents e8cfa82 + 0741b49 commit fdccbc5

File tree

11 files changed

+107
-55
lines changed

11 files changed

+107
-55
lines changed

libs/EXTERNAL/libcatch2

Submodule libcatch2 updated 73 files

libs/EXTERNAL/libezgl

libs/libarchfpga/src/physical_types.h

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,22 +1531,23 @@ struct t_pb_graph_pin_power {
15311531
/* FPGA Routing architecture */
15321532
/*************************************************************************************************/
15331533

1534-
/* Description of routing channel distribution across the FPGA, only available for global routing
1535-
* Width is standard dev. for Gaussian. xpeak is where peak *
1536-
* occurs. dc is the dc offset for Gaussian and pulse waveforms. */
1534+
/// @brief Description of routing channel distribution across the FPGA, only available for global routing
15371535
enum class e_stat {
15381536
UNIFORM,
15391537
GAUSSIAN,
15401538
PULSE,
15411539
DELTA
15421540
};
15431541

1542+
/// @brief Parameters describing a channel distribution.
1543+
/// @note If detailed routing is performed, only a uniform (all channels in a given direction are the same width)
1544+
/// distribution is supported.
15441545
struct t_chan {
1545-
e_stat type;
1546-
float peak;
1547-
float width;
1548-
float xpeak;
1549-
float dc;
1546+
e_stat type; ///< Distribution type
1547+
float peak; ///< Peak value. For a UNIFORM distribution, this is the value for all channels (in a given direction).
1548+
float width; ///< Standard deviation (Gaussian)
1549+
float xpeak; ///< Peak location (Gaussian)
1550+
float dc; ///< DC offset (Gaussian, pulse)
15501551
};
15511552

15521553
/* chan_x_dist: Describes the x-directed channel width distribution. *
@@ -1730,13 +1731,14 @@ struct t_hash_segment_inf {
17301731
}
17311732
};
17321733

1734+
/// @brief Enumerates switch types used in the FPGA architecture and RR graph.
17331735
enum class e_switch_type {
1734-
MUX = 0, //A configurable (buffered) mux (single-driver)
1735-
TRISTATE, //A configurable tristate-able buffer (multi-driver)
1736-
PASS_GATE, //A configurable pass transistor switch (multi-driver)
1737-
SHORT, //A non-configurable electrically shorted connection (multi-driver)
1738-
BUFFER, //A non-configurable non-tristate-able buffer (uni-driver)
1739-
INVALID, //Unspecified, usually an error
1736+
MUX = 0, ///< A configurable (buffered) mux (single-driver)
1737+
TRISTATE, ///< A configurable tristate-able buffer (multi-driver)
1738+
PASS_GATE, ///< A configurable pass transistor switch (multi-driver)
1739+
SHORT, ///< A non-configurable electrically shorted connection (multi-driver)
1740+
BUFFER, ///< A non-configurable non-tristate-able buffer (uni-driver)
1741+
INVALID, ///< Unspecified, usually an error
17401742
NUM_SWITCH_TYPES
17411743
};
17421744

libs/librrgraph/src/base/rr_edge.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ struct t_rr_edge_info {
2929

3030
typedef std::vector<t_rr_edge_info> t_rr_edge_info_set;
3131

32+
/// @brief Sorts and removes duplicate RR edges in-place.
3233
inline void uniquify_edges(t_rr_edge_info_set& rr_edges_to_create) {
3334
std::stable_sort(rr_edges_to_create.begin(), rr_edges_to_create.end());
3435
rr_edges_to_create.erase(std::unique(rr_edges_to_create.begin(), rr_edges_to_create.end()), rr_edges_to_create.end());

libs/librrgraph/src/base/rr_switch.h

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,54 +5,48 @@
55

66
#include "physical_types.h"
77

8-
/* Lists all the important information about an rr switch type. *
9-
* The s_rr_switch_inf describes a switch derived from a switch described *
10-
* by s_arch_switch_inf. This indirection allows us to vary properties of a *
11-
* given switch, such as varying delay with switch fan-in. *
12-
* buffered: Does this switch isolate it's input/output into separate *
13-
* DC-connected sub-circuits? *
14-
* configurable: Is this switch is configurable (i.e. can the switch can be *
15-
* turned on or off)?. This allows modelling of non-optional *
16-
* switches (e.g. fixed buffers, or shorted connections) which *
17-
* must be used (e.g. expanded by the router) if a connected *
18-
* segment is used. *
19-
* R: Equivalent resistance of the buffer/switch. *
20-
* Cin: Input capacitance. *
21-
* Cout: Output capacitance. *
22-
* Cinternal: Internal capacitance, see the definition above. *
23-
* Tdel: Intrinsic delay. The delay through an unloaded switch is *
24-
* Tdel + R * Cout. *
25-
* mux_trans_size: The area of each transistor in the segment's driving mux *
26-
* measured in minimum width transistor units *
27-
* buf_size: The area of the buffer. If set to zero, area should be *
28-
* calculated from R
29-
* intra_tile: Indicate whether this rr_switch is a switch type used inside *
30-
* clusters. These switch types are not specified in the *
31-
* architecture description file and are added when flat router *
32-
* is enabled */
8+
/**
9+
* @brief Lists all the important information about an RR switch type.
10+
*
11+
* The t_rr_switch_inf describes a switch derived from a switch described
12+
* by t_arch_switch_inf. This indirection allows us to vary properties of a
13+
* given switch, such as varying delay with switch fan-in.
14+
*/
3315
struct t_rr_switch_inf {
16+
/// Equivalent resistance of the buffer/switch.
3417
float R = 0.;
18+
/// Input capacitance.
3519
float Cin = 0.;
20+
/// Output capacitance.
3621
float Cout = 0.;
22+
/// Internal capacitance.
3723
float Cinternal = 0.;
24+
/// Intrinsic delay. The delay through an unloaded switch is Tdel + R * Cout.
3825
float Tdel = 0.;
26+
/// The area of each transistor in the segment's driving mux measured in minimum width transistor units
3927
float mux_trans_size = 0.;
28+
/// The area of the buffer. If set to zero, area should be calculated from R
4029
float buf_size = 0.;
4130
std::string name;
4231
e_power_buffer_type power_buffer_type = POWER_BUFFER_TYPE_UNDEFINED;
4332
float power_buffer_size = 0.;
4433

34+
/// Indicate whether this rr_switch is a switch type used inside clusters.
35+
/// These switch types are not specified in the architecture description file
36+
/// and are added when flat router is enabled.
4537
bool intra_tile = false;
4638

47-
public:
39+
public: // Getters
4840
/// Returns the type of switch
4941
e_switch_type type() const;
5042

5143
/// Returns true if this switch type isolates its input and output into
5244
/// separate DC-connected subcircuits
5345
bool buffered() const;
5446

55-
/// Returns true if this switch type is configurable
47+
/// Returns true if this switch type is configurable (i.e. can the switch can be turned on or off)
48+
/// This allows modelling of non-optional switches (e.g. fixed buffers, or shorted connections)
49+
/// which must be used (e.g. expanded by the router) if a connected segment is used.
5650
bool configurable() const;
5751

5852
bool operator==(const t_rr_switch_inf& other) const;
@@ -67,7 +61,7 @@ struct t_rr_switch_inf {
6761
std::size_t operator()(const t_rr_switch_inf& s) const;
6862
};
6963

70-
public:
64+
public: // Setters
7165
void set_type(e_switch_type type_val);
7266

7367
private:

vpr/src/base/read_blif.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,14 @@ struct BlifAllocCallback : public blifparse::Callback {
244244
VTR_ASSERT(ports.size() == nets.size());
245245

246246
LogicalModelId blk_model_id = models_.get_model_by_name(subckt_model);
247+
if(!blk_model_id.is_valid()) {
248+
vpr_throw(VPR_ERROR_BLIF_F, filename_.c_str(), lineno_,
249+
"Subckt instantiates model '%s', but no such model exists in the architecture file.",
250+
subckt_model.c_str());
251+
}
247252
const t_model& blk_model = models_.get_model(blk_model_id);
248253

249-
//We name the subckt based on the net it's first output pin drives
254+
//We name the subckt based on the net its first output pin drives
250255
std::string subckt_name;
251256
for (size_t i = 0; i < ports.size(); ++i) {
252257
const t_model_ports* model_port = find_model_port(blk_model, ports[i]);
@@ -269,8 +274,7 @@ struct BlifAllocCallback : public blifparse::Callback {
269274
}
270275

271276
//The name for every block should be unique, check that there is no name conflict
272-
AtomBlockId blk_id = curr_model().find_block(subckt_name);
273-
if (blk_id) {
277+
if (AtomBlockId blk_id = curr_model().find_block(subckt_name)) {
274278
LogicalModelId conflicting_model = curr_model().block_model(blk_id);
275279
vpr_throw(VPR_ERROR_BLIF_F, filename_.c_str(), lineno_,
276280
"Duplicate blocks named '%s' found in netlist."
@@ -279,7 +283,7 @@ struct BlifAllocCallback : public blifparse::Callback {
279283
}
280284

281285
//Create the block
282-
blk_id = curr_model().create_block(subckt_name, blk_model_id);
286+
AtomBlockId blk_id = curr_model().create_block(subckt_name, blk_model_id);
283287
set_curr_block(blk_id);
284288

285289
for (size_t i = 0; i < ports.size(); ++i) {

vpr/src/draw/draw_debug.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ void breakpoint_info_window(std::string bpDescription, BreakpointState draw_brea
690690
gtk_widget_set_margin_left(ri_info, 5);
691691
#endif
692692
gtk_widget_set_halign(ri_info, GTK_ALIGN_START);
693-
std::string net_id = "rouet_net_id: " + std::to_string(draw_breakpoint_state.route_net_id);
693+
std::string net_id = "route_net_id: " + std::to_string(draw_breakpoint_state.route_net_id);
694694
GtkWidget* net_info = gtk_label_new(net_id.c_str());
695695
#if GTK_CHECK_VERSION(3, 12, 0)
696696
gtk_widget_set_margin_start(net_info, 5);
@@ -766,6 +766,17 @@ bool valid_expression(std::string exp) {
766766
return false;
767767
}
768768

769+
//use the formula parser for checking the validity of the formula.
770+
//we ignore the actual result here, since we only care about whether parsing succeeds without a VtrError.
771+
vtr::FormulaParser fp;
772+
vtr::t_formula_data dummy;
773+
try {
774+
int result = fp.parse_formula(exp, dummy, true);
775+
(void)result;
776+
} catch (const vtr::VtrError& e) {
777+
return false;
778+
}
779+
769780
return true;
770781
}
771782

vpr/src/route/route_utils.cpp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -672,12 +672,25 @@ void update_draw_pres_fac(const float /*new_pres_fac*/) {
672672

673673
#ifndef NO_GRAPHICS
674674
void update_router_info_and_check_bp(bp_router_type type, int net_id) {
675-
if (type == BP_ROUTE_ITER)
675+
bool hit_bp = false;
676+
if (type == BP_ROUTE_ITER) {
676677
get_bp_state_globals()->get_glob_breakpoint_state()->router_iter++;
677-
else if (type == BP_NET_ID)
678+
hit_bp = check_for_breakpoints(false);
679+
} else if (type == BP_NET_ID) {
680+
// Between net id iters, check only net id and expression breakpoints
678681
get_bp_state_globals()->get_glob_breakpoint_state()->route_net_id = net_id;
679-
f_router_debug = check_for_breakpoints(false);
680-
if (f_router_debug) {
682+
t_draw_state* draw_state = get_draw_state_vars();
683+
for (size_t i = 0; i < draw_state->list_of_breakpoints.size(); i++) {
684+
if (draw_state->list_of_breakpoints[i].type == BT_ROUTE_NET_ID && draw_state->list_of_breakpoints[i].active) {
685+
hit_bp = check_for_route_net_id_iter_breakpoints(draw_state->list_of_breakpoints[i].bt_route_net_id);
686+
break;
687+
} else if (draw_state->list_of_breakpoints[i].type == BT_EXPRESSION && draw_state->list_of_breakpoints[i].active) {
688+
hit_bp = check_for_expression_breakpoints(draw_state->list_of_breakpoints[i].bt_expression, false);
689+
break;
690+
}
691+
}
692+
}
693+
if (hit_bp) {
681694
breakpoint_info_window(get_bp_state_globals()->get_glob_breakpoint_state()->bp_description, *get_bp_state_globals()->get_glob_breakpoint_state(), false);
682695
update_screen(ScreenUpdatePriority::MAJOR, "Breakpoint Encountered", ROUTING, nullptr);
683696
}

vpr/src/route/rr_graph_generation/rr_graph_switch_utils.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11

22
#pragma once
33

4+
/**
5+
* @file
6+
* @brief Utilities for creating and initializing rr_switch structures from architecture switches.
7+
*
8+
* This header defines functions that translate high-level architecture switch
9+
* descriptions (`t_arch_switch_inf`) into detailed rr_switch items used in RR graph.
10+
* These functions:
11+
* - Copy and resolve switch electrical parameters into `t_rr_switch_inf`.
12+
* - Expand architecture switches into fanin-specific rr_switch variants.
13+
* - Provide mappings from (arch_switch, fanin) --> rr_switch index.
14+
*
15+
* They are invoked during RR graph construction to allocate, initialize,
16+
* and remap all switch information.
17+
*/
18+
419
#include <map>
520

621
#include "rr_graph_fwd.h"

vpr/src/route/rr_graph_generation/rr_graph_tile_nodes.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ void add_classes_rr_graph(RRGraphBuilder& rr_graph_builder,
1212
const std::vector<int>& class_num_vec,
1313
const t_physical_tile_loc& root_loc,
1414
t_physical_tile_type_ptr physical_type) {
15-
auto& mutable_device_ctx = g_vpr_ctx.mutable_device();
15+
DeviceContext& mutable_device_ctx = g_vpr_ctx.mutable_device();
1616

1717
for (int class_num : class_num_vec) {
1818
e_pin_type class_type = get_class_type_from_class_physical_num(physical_type, class_num);
@@ -106,7 +106,7 @@ void connect_src_sink_to_pins(RRGraphBuilder& rr_graph_builder,
106106
bool switches_remapped) {
107107
for (int class_num : class_num_vec) {
108108
const std::vector<int>& pin_list = get_pin_list_from_class_physical_num(physical_type_ptr, class_num);
109-
auto class_type = get_class_type_from_class_physical_num(physical_type_ptr, class_num);
109+
e_pin_type class_type = get_class_type_from_class_physical_num(physical_type_ptr, class_num);
110110
RRNodeId class_rr_node_id = get_class_rr_node_id(rr_graph_builder.node_lookup(), physical_type_ptr, tile_loc, class_num);
111111
VTR_ASSERT(class_rr_node_id != RRNodeId::INVALID());
112112
for (int pin_num : pin_list) {

0 commit comments

Comments
 (0)