|
2 | 2 | #include "arch_types.h" |
3 | 3 | #include "vtr_math.h" |
4 | 4 | #include "vtr_util.h" |
5 | | -#include "vtr_log.h" |
6 | 5 |
|
7 | 6 | #include "arch_util.h" |
8 | 7 |
|
9 | | -static bool switch_type_is_buffered(SwitchType type); |
10 | | -static bool switch_type_is_configurable(SwitchType type); |
11 | | -static e_directionality switch_type_directionality(SwitchType type); |
12 | | - |
13 | | -//Ensure the constant has external linkage to avoid linking errors |
14 | | -constexpr int t_arch_switch_inf::UNDEFINED_FANIN; |
15 | | - |
16 | 8 | /* |
17 | 9 | * t_arch_switch_inf |
18 | 10 | */ |
19 | 11 |
|
20 | | -SwitchType t_arch_switch_inf::type() const { |
| 12 | +e_switch_type t_arch_switch_inf::type() const { |
21 | 13 | return type_; |
22 | 14 | } |
23 | 15 |
|
@@ -52,88 +44,32 @@ void t_arch_switch_inf::set_Tdel(int fanin, float delay) { |
52 | 44 | Tdel_map_[fanin] = delay; |
53 | 45 | } |
54 | 46 |
|
55 | | -void t_arch_switch_inf::set_type(SwitchType type_val) { |
56 | | - type_ = type_val; |
57 | | -} |
58 | | - |
59 | | -/* |
60 | | - * t_rr_switch_inf |
61 | | - */ |
62 | | - |
63 | | -SwitchType t_rr_switch_inf::type() const { |
64 | | - return type_; |
65 | | -} |
66 | | - |
67 | | -bool t_rr_switch_inf::buffered() const { |
68 | | - return switch_type_is_buffered(type()); |
69 | | -} |
70 | | - |
71 | | -bool t_rr_switch_inf::configurable() const { |
72 | | - return switch_type_is_configurable(type()); |
73 | | -} |
74 | | - |
75 | | -bool t_rr_switch_inf::operator==(const t_rr_switch_inf& other) const { |
76 | | - return R == other.R |
77 | | - && Cin == other.Cin |
78 | | - && Cout == other.Cout |
79 | | - && Cinternal == other.Cinternal |
80 | | - && Tdel == other.Tdel |
81 | | - && mux_trans_size == other.mux_trans_size |
82 | | - && buf_size == other.buf_size |
83 | | - && power_buffer_type == other.power_buffer_type |
84 | | - && power_buffer_size == other.power_buffer_size |
85 | | - && intra_tile == other.intra_tile |
86 | | - && type() == other.type(); |
87 | | -} |
88 | | - |
89 | | -std::size_t t_rr_switch_inf::Hasher::operator()(const t_rr_switch_inf& s) const { |
90 | | - std::size_t hash_val = 0; |
91 | | - |
92 | | - auto hash_combine = [&hash_val](auto&& val) { |
93 | | - hash_val ^= std::hash<std::decay_t<decltype(val)>>{}(val) + 0x9e3779b9 + (hash_val << 6) + (hash_val >> 2); |
94 | | - }; |
95 | | - |
96 | | - hash_combine(s.R); |
97 | | - hash_combine(s.Cin); |
98 | | - hash_combine(s.Cout); |
99 | | - hash_combine(s.Cinternal); |
100 | | - hash_combine(s.Tdel); |
101 | | - hash_combine(s.mux_trans_size); |
102 | | - hash_combine(s.buf_size); |
103 | | - hash_combine(static_cast<int>(s.power_buffer_type)); |
104 | | - hash_combine(s.power_buffer_size); |
105 | | - hash_combine(s.intra_tile); |
106 | | - hash_combine(static_cast<int>(s.type())); |
107 | | - |
108 | | - return hash_val; |
109 | | -} |
110 | | - |
111 | | -void t_rr_switch_inf::set_type(SwitchType type_val) { |
| 47 | +void t_arch_switch_inf::set_type(e_switch_type type_val) { |
112 | 48 | type_ = type_val; |
113 | 49 | } |
114 | 50 |
|
115 | | -static bool switch_type_is_buffered(SwitchType type) { |
| 51 | +bool switch_type_is_buffered(e_switch_type type) { |
116 | 52 | //Muxes and Tristates isolate their input and output into |
117 | 53 | //separate DC connected sub-circuits |
118 | | - return type == SwitchType::MUX |
119 | | - || type == SwitchType::TRISTATE |
120 | | - || type == SwitchType::BUFFER; |
| 54 | + return type == e_switch_type::MUX |
| 55 | + || type == e_switch_type::TRISTATE |
| 56 | + || type == e_switch_type::BUFFER; |
121 | 57 | } |
122 | 58 |
|
123 | | -static bool switch_type_is_configurable(SwitchType type) { |
| 59 | +bool switch_type_is_configurable(e_switch_type type) { |
124 | 60 | //Shorts and buffers are non-configurable |
125 | | - return !(type == SwitchType::SHORT |
126 | | - || type == SwitchType::BUFFER); |
| 61 | + return !(type == e_switch_type::SHORT |
| 62 | + || type == e_switch_type::BUFFER); |
127 | 63 | } |
128 | 64 |
|
129 | | -static e_directionality switch_type_directionality(SwitchType type) { |
130 | | - if (type == SwitchType::SHORT || type == SwitchType::PASS_GATE) { |
| 65 | +e_directionality switch_type_directionality(e_switch_type type) { |
| 66 | + if (type == e_switch_type::SHORT || type == e_switch_type::PASS_GATE) { |
131 | 67 | //Shorts and pass gates can conduct in either direction |
132 | 68 | return e_directionality::BI_DIRECTIONAL; |
133 | 69 | } else { |
134 | | - VTR_ASSERT_SAFE(type == SwitchType::MUX |
135 | | - || type == SwitchType::TRISTATE |
136 | | - || type == SwitchType::BUFFER); |
| 70 | + VTR_ASSERT_SAFE(type == e_switch_type::MUX |
| 71 | + || type == e_switch_type::TRISTATE |
| 72 | + || type == e_switch_type::BUFFER); |
137 | 73 | //Buffered switches can only drive in one direction |
138 | 74 | return e_directionality::UNI_DIRECTIONAL; |
139 | 75 | } |
|
0 commit comments