add mutators to simulation setting data structure

This commit is contained in:
tangxifan 2020-01-18 14:07:37 -07:00
parent 0de9908d52
commit 2a902c7e55
2 changed files with 142 additions and 10 deletions

View File

@ -32,7 +32,7 @@ size_t SimulationSetting::num_clock_cycles() const {
return num_clock_cycles_;
}
size_t SimulationSetting::operating_clock_frequency_slack() const {
float SimulationSetting::operating_clock_frequency_slack() const {
return operating_clock_frequency_slack_;
}
@ -119,7 +119,112 @@ float SimulationSetting::stimuli_input_slew(const e_sim_signal_type& signal_type
/************************************************************************
* Public Mutators
***********************************************************************/
void SimulationSetting::set_operating_clock_freqency(const float& clock_freq) {
clock_frequencies_.set_x(clock_freq);
}
void SimulationSetting::set_programming_clock_freqency(const float& clock_freq) {
clock_frequencies_.set_y(clock_freq);
}
void SimulationSetting::set_num_clock_cycles(const size_t& num_clk_cycles) {
num_clock_cycles_ = num_clk_cycles;
}
void SimulationSetting::set_operating_clock_frequency_slack(const float& op_clk_freq_slack) {
operating_clock_frequency_slack_ = op_clk_freq_slack;
}
void SimulationSetting::set_simulation_temperature(const float& sim_temp) {
simulation_temperature_ = sim_temp;
}
void SimulationSetting::set_verbose_output(const bool& verbose_output) {
verbose_output_ = verbose_output;
}
void SimulationSetting::set_capacitance_output(const bool& cap_output) {
capacitance_output_ = cap_output;
}
void SimulationSetting::set_simulation_accuracy_type(const e_sim_accuracy_type& type) {
VTR_ASSERT(NUM_SIM_ACCURACY_TYPES != type);
simulation_accuracy_type_ = type;
}
void SimulationSetting::set_simulation_accuracy(const float& accuracy) {
/* If fractional accuracy is selected, we do nothing */
if (SIM_ACCURACY_FRAC == simulation_accuracy_type()) {
return;
}
simulation_accuracy_ = accuracy;
}
void SimulationSetting::set_fast_simulation(const bool& fast_sim) {
fast_simulation_ = fast_sim;
}
void SimulationSetting::set_monte_carlo_simulation_points(const size_t& num_mc_points) {
monte_carlo_simulation_points_ = num_mc_points;
}
void SimulationSetting::set_measure_slew_upper_threshold(const e_sim_signal_type& signal_type,
const float& upper_thres) {
VTR_ASSERT(NUM_SIM_SIGNAL_TYPES != signal_type);
VTR_ASSERT (true == valid_signal_threshold(upper_thres));
slew_upper_thresholds_[signal_type] = upper_thres;
}
void SimulationSetting::set_measure_slew_lower_threshold(const e_sim_signal_type& signal_type,
const float& lower_thres) {
VTR_ASSERT(NUM_SIM_SIGNAL_TYPES != signal_type);
VTR_ASSERT (true == valid_signal_threshold(lower_thres));
slew_lower_thresholds_[signal_type] = lower_thres;
}
void SimulationSetting::set_measure_delay_input_threshold(const e_sim_signal_type& signal_type,
const float& input_thres) {
VTR_ASSERT(NUM_SIM_SIGNAL_TYPES != signal_type);
VTR_ASSERT (true == valid_signal_threshold(input_thres));
delay_input_thresholds_[signal_type] = input_thres;
}
void SimulationSetting::set_measure_delay_output_threshold(const e_sim_signal_type& signal_type,
const float& output_thres) {
VTR_ASSERT(NUM_SIM_SIGNAL_TYPES != signal_type);
VTR_ASSERT (true == valid_signal_threshold(output_thres));
delay_output_thresholds_[signal_type] = output_thres;
}
void SimulationSetting::set_stimuli_clock_slew_type(const e_sim_signal_type& signal_type,
const e_sim_accuracy_type& slew_type) {
VTR_ASSERT(NUM_SIM_SIGNAL_TYPES != signal_type);
clock_slew_types_[signal_type] = slew_type;
}
void SimulationSetting::set_stimuli_clock_slew(const e_sim_signal_type& signal_type,
const float& clock_slew) {
/* If fractional accuracy is selected, we do nothing */
if (SIM_ACCURACY_FRAC == stimuli_clock_slew_type(signal_type)) {
return;
}
clock_slews_[signal_type] = clock_slew;
}
void SimulationSetting::set_stimuli_input_slew_type(const e_sim_signal_type& signal_type,
const e_sim_accuracy_type& input_type) {
VTR_ASSERT(NUM_SIM_SIGNAL_TYPES != signal_type);
input_slew_types_[signal_type] = input_type;
}
void SimulationSetting::set_stimuli_input_slew(const e_sim_signal_type& signal_type,
const float& input_slew) {
/* If fractional accuracy is selected, we do nothing */
if (SIM_ACCURACY_FRAC == stimuli_input_slew_type(signal_type)) {
return;
}
input_slews_[signal_type] = input_slew;
}
/************************************************************************
* Public Validators

View File

@ -52,7 +52,7 @@ class SimulationSetting {
float programming_clock_freqency() const;
bool auto_select_num_clock_cycles() const;
size_t num_clock_cycles() const;
size_t operating_clock_frequency_slack() const;
float operating_clock_frequency_slack() const;
float simulation_temperature() const;
bool verbose_output() const;
bool capacitance_output() const;
@ -70,6 +70,33 @@ class SimulationSetting {
e_sim_accuracy_type stimuli_input_slew_type(const e_sim_signal_type& signal_type) const;
float stimuli_input_slew(const e_sim_signal_type& signal_type) const;
public: /* Public Mutators */
void set_operating_clock_freqency(const float& clock_freq);
void set_programming_clock_freqency(const float& clock_freq);
void set_num_clock_cycles(const size_t& num_clk_cycles);
void set_operating_clock_frequency_slack(const float& op_clk_freq_slack);
void set_simulation_temperature(const float& sim_temp);
void set_verbose_output(const bool& verbose_output);
void set_capacitance_output(const bool& cap_output);
void set_simulation_accuracy_type(const e_sim_accuracy_type& type);
void set_simulation_accuracy(const float& accuracy);
void set_fast_simulation(const bool& fast_sim);
void set_monte_carlo_simulation_points(const size_t& num_mc_points);
void set_measure_slew_upper_threshold(const e_sim_signal_type& signal_type,
const float& upper_thres);
void set_measure_slew_lower_threshold(const e_sim_signal_type& signal_type,
const float& lower_thres);
void set_measure_delay_input_threshold(const e_sim_signal_type& signal_type,
const float& input_thres);
void set_measure_delay_output_threshold(const e_sim_signal_type& signal_type,
const float& output_thres);
void set_stimuli_clock_slew_type(const e_sim_signal_type& signal_type,
const e_sim_accuracy_type& slew_type);
void set_stimuli_clock_slew(const e_sim_signal_type& signal_type,
const float& clock_slew);
void set_stimuli_input_slew_type(const e_sim_signal_type& signal_type,
const e_sim_accuracy_type& slew_type);
void set_stimuli_input_slew(const e_sim_signal_type& signal_type,
const float& input_slew);
public: /* Public Validators */
bool valid_signal_threshold(const float& threshold) const;
private: /* Internal data */
@ -132,8 +159,8 @@ class SimulationSetting {
* Thresholds related to rising edge will be stored in the first element
* Thresholds related to falling edge will be stored in the second element
*/
std::array<float, 2> slew_upper_thresholds_;
std::array<float, 2> slew_lower_thresholds_;
std::array<float, NUM_SIM_SIGNAL_TYPES> slew_upper_thresholds_;
std::array<float, NUM_SIM_SIGNAL_TYPES> slew_lower_thresholds_;
/* The thresholds (in percentage) to be used in the measuring signal delays
* Thresholds related to rising edge will be stored in the first element
@ -163,8 +190,8 @@ class SimulationSetting {
* v
* 50% of full swing of output signal
*/
std::array<float, 2> delay_input_thresholds_;
std::array<float, 2> delay_output_thresholds_;
std::array<float, NUM_SIM_SIGNAL_TYPES> delay_input_thresholds_;
std::array<float, NUM_SIM_SIGNAL_TYPES> delay_output_thresholds_;
/* Stimulus to be given to each type of port.
* We support two types of ports:
@ -178,10 +205,10 @@ class SimulationSetting {
* Fractional accuracy will be determined by the clock frequency
* to be defined by user in the clock_setting
*/
std::array<e_sim_accuracy_type, 2> clock_slew_types_;
std::array<float, 2> clock_slews_;
std::array<e_sim_accuracy_type, 2> input_slew_types_;
std::array<float, 2> input_slews_;
std::array<e_sim_accuracy_type, NUM_SIM_ACCURACY_TYPES> clock_slew_types_;
std::array<float, NUM_SIM_ACCURACY_TYPES> clock_slews_;
std::array<e_sim_accuracy_type, NUM_SIM_ACCURACY_TYPES> input_slew_types_;
std::array<float, NUM_SIM_ACCURACY_TYPES> input_slews_;
};
#endif