Skip to content

Commit b1f8a15

Browse files
committed
[core] run clang-format locally to fix all the formatting errors on Cpp
1 parent 0e6f3f7 commit b1f8a15

File tree

10 files changed

+50
-33
lines changed

10 files changed

+50
-33
lines changed

libs/librtlnumber/src/include/internal_bits.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,9 @@ class BitFields {
383383
public:
384384
BitFields(bit_value_t init_v) {
385385
this->bits = static_cast<T>(
386-
(_0 == init_v) ? _All_0 : (_1 == init_v) ? _All_1 : (_z == init_v) ? _All_z : _All_x);
386+
(_0 == init_v) ? _All_0 : (_1 == init_v) ? _All_1
387+
: (_z == init_v) ? _All_z
388+
: _All_x);
387389
}
388390

389391
template<typename Addr_t>

libs/librtlnumber/src/rtl_int.cpp

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -418,42 +418,48 @@ VNumber V_LOGICAL_OR(VNumber& a, VNumber& b) {
418418

419419
VNumber V_LT(VNumber& a, VNumber& b) {
420420
compare_bit cmp = eval_op(a, b);
421-
BitSpace::bit_value_t result = cmp.is_unk() ? BitSpace::_x : cmp.is_lt() ? BitSpace::_1 : BitSpace::_0;
421+
BitSpace::bit_value_t result = cmp.is_unk() ? BitSpace::_x : cmp.is_lt() ? BitSpace::_1
422+
: BitSpace::_0;
422423
VNumber to_return(1, result, false, true);
423424
return to_return;
424425
}
425426

426427
VNumber V_GT(VNumber& a, VNumber& b) {
427428
compare_bit cmp = eval_op(a, b);
428-
BitSpace::bit_value_t result = cmp.is_unk() ? BitSpace::_x : cmp.is_gt() ? BitSpace::_1 : BitSpace::_0;
429+
BitSpace::bit_value_t result = cmp.is_unk() ? BitSpace::_x : cmp.is_gt() ? BitSpace::_1
430+
: BitSpace::_0;
429431
VNumber to_return(1, result, false, true);
430432
return to_return;
431433
}
432434

433435
VNumber V_EQUAL(VNumber& a, VNumber& b) {
434436
compare_bit cmp = eval_op(a, b);
435-
BitSpace::bit_value_t result = cmp.is_unk() ? BitSpace::_x : cmp.is_eq() ? BitSpace::_1 : BitSpace::_0;
437+
BitSpace::bit_value_t result = cmp.is_unk() ? BitSpace::_x : cmp.is_eq() ? BitSpace::_1
438+
: BitSpace::_0;
436439
VNumber to_return(1, result, false, true);
437440
return to_return;
438441
}
439442

440443
VNumber V_GE(VNumber& a, VNumber& b) {
441444
compare_bit cmp = eval_op(a, b);
442-
BitSpace::bit_value_t result = cmp.is_unk() ? BitSpace::_x : cmp.is_ge() ? BitSpace::_1 : BitSpace::_0;
445+
BitSpace::bit_value_t result = cmp.is_unk() ? BitSpace::_x : cmp.is_ge() ? BitSpace::_1
446+
: BitSpace::_0;
443447
VNumber to_return(1, result, false, true);
444448
return to_return;
445449
}
446450

447451
VNumber V_LE(VNumber& a, VNumber& b) {
448452
compare_bit cmp = eval_op(a, b);
449-
BitSpace::bit_value_t result = cmp.is_unk() ? BitSpace::_x : cmp.is_le() ? BitSpace::_1 : BitSpace::_0;
453+
BitSpace::bit_value_t result = cmp.is_unk() ? BitSpace::_x : cmp.is_le() ? BitSpace::_1
454+
: BitSpace::_0;
450455
VNumber to_return(1, result, false, true);
451456
return to_return;
452457
}
453458

454459
VNumber V_NOT_EQUAL(VNumber& a, VNumber& b) {
455460
compare_bit cmp = eval_op(a, b);
456-
BitSpace::bit_value_t result = cmp.is_unk() ? BitSpace::_x : cmp.is_ne() ? BitSpace::_1 : BitSpace::_0;
461+
BitSpace::bit_value_t result = cmp.is_unk() ? BitSpace::_x : cmp.is_ne() ? BitSpace::_1
462+
: BitSpace::_0;
457463
VNumber to_return(1, result, false, true);
458464
return to_return;
459465
}
@@ -603,11 +609,14 @@ VNumber V_POWER(VNumber& a, VNumber& b) {
603609
}
604610

605611
compare_bit res_a = eval_op(a, 0);
606-
short val_a = (res_a.is_eq()) ? 0 : (res_a.is_lt()) ? (eval_op(a, -1).is_lt()) ? -2 : -1 :
607-
/* GREATHER_THAN */ (eval_op(a, 1).is_gt()) ? 2 : 1;
612+
short val_a = (res_a.is_eq()) ? 0 : (res_a.is_lt()) ? (eval_op(a, -1).is_lt()) ? -2 : -1
613+
:
614+
/* GREATHER_THAN */ (eval_op(a, 1).is_gt()) ? 2
615+
: 1;
608616

609617
compare_bit res_b = eval_op(b, 0);
610-
short val_b = (res_b.is_eq()) ? 0 : (res_b.is_lt()) ? -1 :
618+
short val_b = (res_b.is_eq()) ? 0 : (res_b.is_lt()) ? -1
619+
:
611620
/* GREATHER_THAN */ 1;
612621

613622
// Compute: Case Where 'val_a <= -2' or 'val_a >= 2'; As-Per the Spec:
@@ -742,5 +751,6 @@ VNumber V_TERNARY(VNumber& a_in, VNumber& b_in, VNumber& c_in) {
742751
/* if a evaluates properly */
743752
compare_bit eval = eval_op(V_LOGICAL_NOT(a_in), 0);
744753

745-
return (eval.is_unk()) ? b_in.bitwise(c_in, l_ternary) : (eval.is_eq()) ? VNumber(b_in) : VNumber(c_in);
754+
return (eval.is_unk()) ? b_in.bitwise(c_in, l_ternary) : (eval.is_eq()) ? VNumber(b_in)
755+
: VNumber(c_in);
746756
}

libs/libvtrutil/src/vtr_geometry.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ class Point {
7171
T y() const;
7272

7373
///@brief == operator
74-
friend bool operator== <>(Point<T> lhs, Point<T> rhs);
74+
friend bool operator==<>(Point<T> lhs, Point<T> rhs);
7575

7676
///@brief != operator
77-
friend bool operator!= <>(Point<T> lhs, Point<T> rhs);
77+
friend bool operator!=<>(Point<T> lhs, Point<T> rhs);
7878

7979
///@brief < operator
80-
friend bool operator< <>(Point<T> lhs, Point<T> rhs);
80+
friend bool operator<<>(Point<T> lhs, Point<T> rhs);
8181

8282
public: //Mutators
8383
///@brief Set x and y values
@@ -172,10 +172,10 @@ class Rect {
172172
bool empty() const;
173173

174174
///@brief == operator
175-
friend bool operator== <>(const Rect<T>& lhs, const Rect<T>& rhs);
175+
friend bool operator==<>(const Rect<T>& lhs, const Rect<T>& rhs);
176176

177177
///@brief != operator
178-
friend bool operator!= <>(const Rect<T>& lhs, const Rect<T>& rhs);
178+
friend bool operator!=<>(const Rect<T>& lhs, const Rect<T>& rhs);
179179

180180
public: //Mutators
181181
///@brief set xmin to a point
@@ -296,10 +296,10 @@ class RectUnion {
296296
*
297297
* Note: does not check whether the representations they are equivalent
298298
*/
299-
friend bool operator== <>(const RectUnion<T>& lhs, const RectUnion<T>& rhs);
299+
friend bool operator==<>(const RectUnion<T>& lhs, const RectUnion<T>& rhs);
300300

301301
///@brief != operator
302-
friend bool operator!= <>(const RectUnion<T>& lhs, const RectUnion<T>& rhs);
302+
friend bool operator!=<>(const RectUnion<T>& lhs, const RectUnion<T>& rhs);
303303

304304
private:
305305
// Note that a union of rectanges may have holes and may not be contiguous

libs/libvtrutil/src/vtr_pair_util.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class pair_first_iter {
3636
auto operator*() { return iter_->first; }
3737

3838
///@brief -> operator
39-
auto operator-> () { return &iter_->first; }
39+
auto operator->() { return &iter_->first; }
4040

4141
///@brief == operator
4242
friend bool operator==(const pair_first_iter lhs, const pair_first_iter rhs) { return lhs.iter_ == rhs.iter_; }
@@ -80,7 +80,7 @@ class pair_second_iter {
8080
auto operator*() { return iter_->second; }
8181

8282
///@brief -> operator
83-
auto operator-> () { return &iter_->second; }
83+
auto operator->() { return &iter_->second; }
8484

8585
///@brief == operator
8686
friend bool operator==(const pair_second_iter lhs, const pair_second_iter rhs) { return lhs.iter_ == rhs.iter_; }

libs/libvtrutil/src/vtr_strong_id.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,11 @@ class StrongId {
202202
* Note that since these are templated functions we provide an empty set of template parameters
203203
* after the function name (i.e. <>)
204204
*/
205-
friend bool operator== <>(const StrongId<tag, T, sentinel>& lhs, const StrongId<tag, T, sentinel>& rhs);
205+
friend bool operator==<>(const StrongId<tag, T, sentinel>& lhs, const StrongId<tag, T, sentinel>& rhs);
206206
///@brief != operator
207-
friend bool operator!= <>(const StrongId<tag, T, sentinel>& lhs, const StrongId<tag, T, sentinel>& rhs);
207+
friend bool operator!=<>(const StrongId<tag, T, sentinel>& lhs, const StrongId<tag, T, sentinel>& rhs);
208208
///@brief < operator
209-
friend bool operator< <>(const StrongId<tag, T, sentinel>& lhs, const StrongId<tag, T, sentinel>& rhs);
209+
friend bool operator<<>(const StrongId<tag, T, sentinel>& lhs, const StrongId<tag, T, sentinel>& rhs);
210210

211211
private:
212212
T id_;

odin_ii/src/core/adders.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,8 @@ static void connect_output_pin_to_node(int* width, int current_pin, int output_p
11311131
if (subtraction) {
11321132
remap_pin_to_new_node(node->output_pins[current_pin], current_adder, output_pin_id);
11331133
} else {
1134-
npin_t* node_pin_select = node->output_pins[(node->num_input_port_sizes == 2) ? current_pin : (current_pin < width[output_pin_id] - 1) ? current_pin + 1 : 0];
1134+
npin_t* node_pin_select = node->output_pins[(node->num_input_port_sizes == 2) ? current_pin : (current_pin < width[output_pin_id] - 1) ? current_pin + 1
1135+
: 0];
11351136
if (node_pin_select) {
11361137
if (node_pin_select->type != NO_ID || (node->num_input_port_sizes == 2)) {
11371138
remap_pin_to_new_node(node_pin_select, current_adder, output_pin_id);

odin_ii/src/simulate/simulate_blif.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1850,7 +1850,10 @@ static void instantiate_memory(nnode_t* node, long data_width, long addr_width)
18501850
}
18511851

18521852
static int parse_mif_radix(std::string radix) {
1853-
return (radix == "HEX") ? 16 : (radix == "DEC") ? 10 : (radix == "OCT") ? 8 : (radix == "BIN") ? 2 : 0;
1853+
return (radix == "HEX") ? 16 : (radix == "DEC") ? 10
1854+
: (radix == "OCT") ? 8
1855+
: (radix == "BIN") ? 2
1856+
: 0;
18541857
}
18551858

18561859
static void assign_memory_from_mif_file(nnode_t* node, const char* filename, int width, long address_width) {

odin_ii/src/utils/atomic_buffer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ class atomic_buffer {
115115
void print() {
116116
for (int i = 0; i < BUFFER_SIZE; i++) {
117117
uint8_t value = get_bits(i);
118-
printf("%s", (value == 0) ? "0" : (value == 1) ? "1" : "x");
118+
printf("%s", (value == 0) ? "0" : (value == 1) ? "1"
119+
: "x");
119120
}
120121
printf("\n");
121122
}

vpr/src/power/power_sizing.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ static double power_count_transistors_connectionbox() {
9898
/* Muxes to IPINs */
9999
transistor_cnt += inputs
100100
* power_count_transistors_mux(
101-
power_get_mux_arch(power_ctx.commonly_used->max_IPIN_fanin,
102-
power_ctx.arch->mux_transistor_size));
101+
power_get_mux_arch(power_ctx.commonly_used->max_IPIN_fanin,
102+
power_ctx.arch->mux_transistor_size));
103103
}
104104
return transistor_cnt;
105105
}
@@ -234,9 +234,9 @@ static double power_count_transistors_interc(t_interconnect* interc) {
234234
transistor_cnt += interc->interconnect_power->num_output_ports
235235
* interc->interconnect_power->num_pins_per_port
236236
* power_count_transistors_mux(
237-
power_get_mux_arch(
238-
interc->interconnect_power->num_input_ports,
239-
power_ctx.arch->mux_transistor_size));
237+
power_get_mux_arch(
238+
interc->interconnect_power->num_input_ports,
239+
power_ctx.arch->mux_transistor_size));
240240
break;
241241
}
242242
default:

vpr/src/util/vpr_utils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ int get_max_primitives_in_pb_type(t_pb_type* pb_type) {
870870
for (j = 0; j < pb_type->modes[i].num_pb_type_children; j++) {
871871
temp_size += pb_type->modes[i].pb_type_children[j].num_pb
872872
* get_max_primitives_in_pb_type(
873-
&pb_type->modes[i].pb_type_children[j]);
873+
&pb_type->modes[i].pb_type_children[j]);
874874
}
875875
if (temp_size > max_size) {
876876
max_size = temp_size;
@@ -893,7 +893,7 @@ int get_max_nets_in_pb_type(const t_pb_type* pb_type) {
893893
for (j = 0; j < pb_type->modes[i].num_pb_type_children; j++) {
894894
temp_nets += pb_type->modes[i].pb_type_children[j].num_pb
895895
* get_max_nets_in_pb_type(
896-
&pb_type->modes[i].pb_type_children[j]);
896+
&pb_type->modes[i].pb_type_children[j]);
897897
}
898898
if (temp_nets > max_nets) {
899899
max_nets = temp_nets;

0 commit comments

Comments
 (0)