|
| 1 | +#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" |
| 7 | + |
| 8 | +VibInf::VibInf() { |
| 9 | + name_.clear(); |
| 10 | + pbtype_name_.clear(); |
| 11 | + seg_group_num_ = 0; |
| 12 | + switch_idx_ = -1; |
| 13 | + seg_groups_.clear(); |
| 14 | + first_stages_.clear(); |
| 15 | + second_stages_.clear(); |
| 16 | +} |
| 17 | + |
| 18 | +void VibInf::set_name(const std::string name) { |
| 19 | + VTR_ASSERT(!name.empty()); |
| 20 | + name_ = name; |
| 21 | +} |
| 22 | + |
| 23 | +void VibInf::set_pbtype_name(const std::string pbtype_name) { |
| 24 | + VTR_ASSERT(!pbtype_name.empty()); |
| 25 | + pbtype_name_ = pbtype_name; |
| 26 | +} |
| 27 | + |
| 28 | +void VibInf::set_seg_group_num(const int seg_group_num) { |
| 29 | + VTR_ASSERT(seg_group_num >= 0); |
| 30 | + seg_group_num_ = seg_group_num; |
| 31 | +} |
| 32 | + |
| 33 | +void VibInf::set_switch_idx(const int switch_idx) { |
| 34 | + VTR_ASSERT(switch_idx != -1); |
| 35 | + switch_idx_ = switch_idx; |
| 36 | +} |
| 37 | + |
| 38 | +void VibInf::set_seg_groups(const std::vector<t_seg_group> seg_groups) { |
| 39 | + VTR_ASSERT(!seg_groups.empty()); |
| 40 | + for(auto seg_group : seg_groups) { |
| 41 | + seg_groups_.push_back(seg_group); |
| 42 | + } |
| 43 | +} |
| 44 | + |
| 45 | +void VibInf::push_seg_group(const t_seg_group seg_group) { |
| 46 | + VTR_ASSERT(!seg_group.name.empty()); |
| 47 | + seg_groups_.push_back(seg_group); |
| 48 | +} |
| 49 | + |
| 50 | +void VibInf::set_first_stages(const std::vector<t_first_stage_mux_inf> first_stages) { |
| 51 | + VTR_ASSERT(!first_stages.empty()); |
| 52 | + for(auto first_stage : first_stages) { |
| 53 | + first_stages_.push_back(first_stage); |
| 54 | + } |
| 55 | +} |
| 56 | + |
| 57 | +void VibInf::push_first_stage(const t_first_stage_mux_inf first_stage) { |
| 58 | + VTR_ASSERT(!first_stage.mux_name.empty()); |
| 59 | + first_stages_.push_back(first_stage); |
| 60 | +} |
| 61 | + |
| 62 | +void VibInf::set_second_stages(const std::vector<t_second_stage_mux_inf> second_stages) { |
| 63 | + VTR_ASSERT(!second_stages.empty()); |
| 64 | + for(auto second_stage : second_stages) { |
| 65 | + second_stages_.push_back(second_stage); |
| 66 | + } |
| 67 | +} |
| 68 | + |
| 69 | +void VibInf::push_second_stage(const t_second_stage_mux_inf second_stage) { |
| 70 | + VTR_ASSERT(!second_stage.mux_name.empty()); |
| 71 | + second_stages_.push_back(second_stage); |
| 72 | +} |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | +std::string VibInf::get_name() const{ |
| 77 | + VTR_ASSERT(!name_.empty()); |
| 78 | + return name_; |
| 79 | +} |
| 80 | + |
| 81 | +std::string VibInf::get_pbtype_name() const{ |
| 82 | + VTR_ASSERT(!pbtype_name_.empty()); |
| 83 | + return pbtype_name_; |
| 84 | +} |
| 85 | + |
| 86 | +int VibInf::get_seg_group_num() const{ |
| 87 | + VTR_ASSERT(seg_group_num_ >= 0); |
| 88 | + return seg_group_num_; |
| 89 | +} |
| 90 | + |
| 91 | +int VibInf::get_switch_idx() const{ |
| 92 | + VTR_ASSERT(switch_idx_ != -1); |
| 93 | + return switch_idx_; |
| 94 | +} |
| 95 | + |
| 96 | +std::vector<t_seg_group> VibInf::get_seg_groups() const{ |
| 97 | + VTR_ASSERT(!seg_groups_.empty()); |
| 98 | + return seg_groups_; |
| 99 | +} |
| 100 | + |
| 101 | +std::vector<t_first_stage_mux_inf> VibInf::get_first_stages() const{ |
| 102 | + VTR_ASSERT(!first_stages_.empty()); |
| 103 | + return first_stages_; |
| 104 | +} |
| 105 | + |
| 106 | +std::vector<t_second_stage_mux_inf> VibInf::get_second_stages() const{ |
| 107 | + VTR_ASSERT(!second_stages_.empty()); |
| 108 | + return second_stages_; |
| 109 | +} |
0 commit comments