Skip to content

Commit af27706

Browse files
committed
[lib][arch] pass set funcitons params by reference
1 parent bb9a338 commit af27706

File tree

4 files changed

+45
-36
lines changed

4 files changed

+45
-36
lines changed

libs/libarchfpga/src/arch_util.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,10 @@ void ProcessMemoryClass(t_pb_type* mem_pb_type) {
700700
mem_pb_type->model_id = LogicalModelId::INVALID();
701701

702702
mem_pb_type->modes[0].num_interconnect = mem_pb_type->num_ports * num_pb;
703-
VTR_ASSERT(mem_pb_type->modes[0].num_interconnect > 0);
703+
704+
std::stringstream ss;
705+
ss << "Memory pb_type " << mem_pb_type->name << " has no interconnect";
706+
VTR_ASSERT_MSG(mem_pb_type->modes[0].num_interconnect > 0, ss.str().c_str());
704707
mem_pb_type->modes[0].interconnect = new t_interconnect[mem_pb_type->modes[0].num_interconnect];
705708

706709
for (i = 0; i < mem_pb_type->modes[0].num_interconnect; i++) {

libs/libarchfpga/src/physical_types.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2293,14 +2293,34 @@ struct t_arch {
22932293
char* architecture_id;
22942294

22952295
// Options for tileable routing architectures
2296+
2297+
/// Whether the routing architecture is tileable
22962298
bool tileable;
2299+
2300+
/// Allow connection blocks to appear around the perimeter programmable block
22972301
bool perimeter_cb;
2302+
2303+
/// Remove all the routing wires in empty regions
22982304
bool shrink_boundary;
2305+
2306+
/// Allow routing channels to pass through multi-width and
2307+
/// multi-height programable blocks
22992308
bool through_channel;
2309+
2310+
/// Allow each output pin of a programmable block to drive the
2311+
/// routing tracks on all the sides of its adjacent switch block
23002312
bool opin2all_sides;
2313+
2314+
/// Whether the routing architecture has concat wire
2315+
/// For further detail, please refer to documentation
23012316
bool concat_wire;
2317+
2318+
/// Whether the routing architecture has concat pass wire
2319+
/// For further detail, please refer to documentation
23022320
bool concat_pass_wire;
23032321

2322+
// End of tileable architecture options
2323+
23042324
t_chan_width_dist Chans;
23052325
enum e_switch_block_type SBType;
23062326
enum e_switch_block_type SBSubType;

libs/libarchfpga/src/vib_inf.cpp

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
#include "vib_inf.h"
2-
// #include "vtr_math.h"
3-
// #include "vtr_util.h"
4-
// #include "vtr_log.h"
5-
6-
// #include "arch_util.h"
72

83
VibInf::VibInf() {
94
name_.clear();
@@ -15,12 +10,12 @@ VibInf::VibInf() {
1510
second_stages_.clear();
1611
}
1712

18-
void VibInf::set_name(const std::string name) {
13+
void VibInf::set_name(const std::string& name) {
1914
VTR_ASSERT(!name.empty());
2015
name_ = name;
2116
}
2217

23-
void VibInf::set_pbtype_name(const std::string pbtype_name) {
18+
void VibInf::set_pbtype_name(const std::string& pbtype_name) {
2419
VTR_ASSERT(!pbtype_name.empty());
2520
pbtype_name_ = pbtype_name;
2621
}
@@ -35,46 +30,37 @@ void VibInf::set_switch_idx(const int switch_idx) {
3530
switch_idx_ = switch_idx;
3631
}
3732

38-
void VibInf::set_switch_name(const std::string switch_name) {
33+
void VibInf::set_switch_name(const std::string& switch_name) {
3934
VTR_ASSERT(!switch_name.empty());
4035
switch_name_ = switch_name;
4136
}
4237

43-
void VibInf::set_seg_groups(const std::vector<t_seg_group> seg_groups) {
38+
void VibInf::set_seg_groups(const std::vector<t_seg_group>& seg_groups) {
4439
VTR_ASSERT(!seg_groups.empty());
45-
seg_groups_.clear();
46-
for (auto seg_group : seg_groups) {
47-
seg_groups_.push_back(seg_group);
48-
}
40+
seg_groups_ = seg_groups;
4941
}
5042

51-
void VibInf::push_seg_group(const t_seg_group seg_group) {
43+
void VibInf::push_seg_group(const t_seg_group& seg_group) {
5244
VTR_ASSERT(!seg_group.name.empty());
5345
seg_groups_.push_back(seg_group);
5446
}
5547

56-
void VibInf::set_first_stages(const std::vector<t_first_stage_mux_inf> first_stages) {
48+
void VibInf::set_first_stages(const std::vector<t_first_stage_mux_inf>& first_stages) {
5749
VTR_ASSERT(!first_stages.empty());
58-
first_stages_.clear();
59-
for (auto first_stage : first_stages) {
60-
first_stages_.push_back(first_stage);
61-
}
50+
first_stages_ = first_stages;
6251
}
6352

64-
void VibInf::push_first_stage(const t_first_stage_mux_inf first_stage) {
53+
void VibInf::push_first_stage(const t_first_stage_mux_inf& first_stage) {
6554
VTR_ASSERT(!first_stage.mux_name.empty());
6655
first_stages_.push_back(first_stage);
6756
}
6857

69-
void VibInf::set_second_stages(const std::vector<t_second_stage_mux_inf> second_stages) {
58+
void VibInf::set_second_stages(const std::vector<t_second_stage_mux_inf>& second_stages) {
7059
VTR_ASSERT(!second_stages.empty());
71-
second_stages_.clear();
72-
for (auto second_stage : second_stages) {
73-
second_stages_.push_back(second_stage);
74-
}
60+
second_stages_ = second_stages;
7561
}
7662

77-
void VibInf::push_second_stage(const t_second_stage_mux_inf second_stage) {
63+
void VibInf::push_second_stage(const t_second_stage_mux_inf& second_stage) {
7864
VTR_ASSERT(!second_stage.mux_name.empty());
7965
second_stages_.push_back(second_stage);
8066
}

libs/libarchfpga/src/vib_inf.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,17 @@ class VibInf {
121121
VibInf();
122122

123123
public:
124-
void set_name(const std::string name);
125-
void set_pbtype_name(const std::string pbtype_name);
124+
void set_name(const std::string& name);
125+
void set_pbtype_name(const std::string& pbtype_name);
126126
void set_seg_group_num(const int seg_group_num);
127127
void set_switch_idx(const int switch_idx);
128-
void set_switch_name(const std::string switch_name);
129-
void set_seg_groups(const std::vector<t_seg_group> seg_groups);
130-
void push_seg_group(const t_seg_group seg_group);
131-
void set_first_stages(const std::vector<t_first_stage_mux_inf> first_stages);
132-
void push_first_stage(const t_first_stage_mux_inf first_stage);
133-
void set_second_stages(const std::vector<t_second_stage_mux_inf> second_stages);
134-
void push_second_stage(const t_second_stage_mux_inf second_stage);
128+
void set_switch_name(const std::string& switch_name);
129+
void set_seg_groups(const std::vector<t_seg_group>& seg_groups);
130+
void push_seg_group(const t_seg_group& seg_group);
131+
void set_first_stages(const std::vector<t_first_stage_mux_inf>& first_stages);
132+
void push_first_stage(const t_first_stage_mux_inf& first_stage);
133+
void set_second_stages(const std::vector<t_second_stage_mux_inf>& second_stages);
134+
void push_second_stage(const t_second_stage_mux_inf& second_stage);
135135

136136
std::string get_name() const;
137137
std::string get_pbtype_name() const;

0 commit comments

Comments
 (0)