Skip to content

Commit df78a62

Browse files
committed
Clock Modeling: Changed dynamic casts to make_unique and move
1 parent 1c6deeb commit df78a62

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

vpr/src/base/setup_clocks.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ void setup_clock_network_wires(const t_arch& Arch, std::vector<t_segment_inf>& s
4040
for(auto clock_network_arch : clock_networks_arch) {
4141
switch(clock_network_arch.type) {
4242
case e_clock_type::SPINE: {
43-
clock_networks_device.emplace_back(new ClockSpine());
44-
ClockSpine* spine = dynamic_cast<ClockSpine*>(clock_networks_device.back().get());
43+
std::unique_ptr<ClockSpine> spine = std::make_unique<ClockSpine>();
4544

4645
spine->set_clock_name(clock_network_arch.name);
4746
spine->set_num_instance(clock_network_arch.num_inst);
@@ -65,10 +64,11 @@ void setup_clock_network_wires(const t_arch& Arch, std::vector<t_segment_inf>& s
6564
spine->set_tap_name(clock_network_arch.tap.name);
6665

6766
spine->create_segments(segment_inf);
67+
68+
clock_networks_device.push_back(std::move(spine));
6869
break;
6970
} case e_clock_type::RIB: {
70-
clock_networks_device.emplace_back(new ClockRib());
71-
ClockRib* rib = dynamic_cast<ClockRib*>(clock_networks_device.back().get());
71+
std::unique_ptr<ClockRib> rib = std::make_unique<ClockRib>();
7272

7373
rib->set_clock_name(clock_network_arch.name);
7474
rib->set_num_instance(clock_network_arch.num_inst);
@@ -92,6 +92,7 @@ void setup_clock_network_wires(const t_arch& Arch, std::vector<t_segment_inf>& s
9292
rib->set_tap_name(clock_network_arch.tap.name);
9393

9494
rib->create_segments(segment_inf);
95+
clock_networks_device.push_back(std::move(rib));
9596
break;
9697
} case e_clock_type::H_TREE: {
9798
vpr_throw(VPR_ERROR_OTHER, __FILE__, __LINE__, "HTrees not yet supported.\n");

0 commit comments

Comments
 (0)