split sdc option into two categories which will be called by different commands

This commit is contained in:
tangxifan 2020-02-28 09:48:58 -07:00
parent fdcb982903
commit 89c51b70e3
4 changed files with 94 additions and 40 deletions

View File

@ -0,0 +1,39 @@
/********************************************************************
* Member functions for a data structure which includes all the options for the SDC generator
********************************************************************/
#include "analysis_sdc_option.h"
/* begin namespace openfpga */
namespace openfpga {
/********************************************************************
* Public Constructors
********************************************************************/
AnalysisSdcOption::AnalysisSdcOption(const std::string& sdc_dir) {
sdc_dir_ = sdc_dir;
generate_sdc_analysis_ = false;
}
/********************************************************************
* Public accessors
********************************************************************/
std::string AnalysisSdcOption::sdc_dir() const {
return sdc_dir_;
}
bool AnalysisSdcOption::generate_sdc_analysis() const {
return generate_sdc_analysis_;
}
/********************************************************************
* Public mutators
********************************************************************/
void AnalysisSdcOption::set_sdc_dir(const std::string& sdc_dir) {
sdc_dir_ = sdc_dir;
}
void AnalysisSdcOption::set_generate_sdc_analysis(const bool& generate_sdc_analysis) {
generate_sdc_analysis_ = generate_sdc_analysis;
}
} /* end namespace openfpga */

View File

@ -0,0 +1,30 @@
#ifndef ANALYSIS_SDC_OPTION_H
#define ANALYSIS_SDC_OPTION_H
/********************************************************************
* A data structure to include all the options for the SDC generator
* in purpose of analyzing users' implementations
********************************************************************/
#include <string>
/* begin namespace openfpga */
namespace openfpga {
class AnalysisSdcOption {
public: /* Public Constructors */
AnalysisSdcOption(const std::string& sdc_dir);
public: /* Public accessors */
std::string sdc_dir() const;
bool generate_sdc_analysis() const;
public: /* Public mutators */
void set_sdc_dir(const std::string& sdc_dir);
void set_generate_sdc_analysis(const bool& generate_sdc_analysis);
private: /* Internal data */
std::string sdc_dir_;
bool generate_sdc_analysis_;
};
} /* end namespace openfpga */
#endif

View File

@ -1,7 +1,7 @@
/********************************************************************
* Member functions for a data structure which includes all the options for the SDC generator
********************************************************************/
#include "sdc_option.h"
#include "pnr_sdc_option.h"
/* begin namespace openfpga */
namespace openfpga {
@ -9,7 +9,7 @@ namespace openfpga {
/********************************************************************
* Public Constructors
********************************************************************/
SdcOption::SdcOption(const std::string& sdc_dir) {
PnrSdcOption::PnrSdcOption(const std::string& sdc_dir) {
sdc_dir_ = sdc_dir;
constrain_global_port_ = false;
constrain_grid_ = false;
@ -23,15 +23,11 @@ SdcOption::SdcOption(const std::string& sdc_dir) {
/********************************************************************
* Public accessors
********************************************************************/
std::string SdcOption::sdc_dir() const {
std::string PnrSdcOption::sdc_dir() const {
return sdc_dir_;
}
bool SdcOption::generate_sdc() const {
return generate_sdc_pnr() && generate_sdc_analysis_;
}
bool SdcOption::generate_sdc_pnr() const {
bool PnrSdcOption::generate_sdc_pnr() const {
return constrain_global_port_
|| constrain_grid_
|| constrain_sb_
@ -41,46 +37,42 @@ bool SdcOption::generate_sdc_pnr() const {
|| constrain_switch_block_outputs_;
}
bool SdcOption::generate_sdc_analysis() const {
return generate_sdc_analysis_;
}
bool SdcOption::constrain_global_port() const {
bool PnrSdcOption::constrain_global_port() const {
return constrain_global_port_;
}
bool SdcOption::constrain_grid() const {
bool PnrSdcOption::constrain_grid() const {
return constrain_grid_;
}
bool SdcOption::constrain_sb() const {
bool PnrSdcOption::constrain_sb() const {
return constrain_sb_;
}
bool SdcOption::constrain_cb() const {
bool PnrSdcOption::constrain_cb() const {
return constrain_cb_;
}
bool SdcOption::constrain_configurable_memory_outputs() const {
bool PnrSdcOption::constrain_configurable_memory_outputs() const {
return constrain_configurable_memory_outputs_;
}
bool SdcOption::constrain_routing_multiplexer_outputs() const {
bool PnrSdcOption::constrain_routing_multiplexer_outputs() const {
return constrain_routing_multiplexer_outputs_;
}
bool SdcOption::constrain_switch_block_outputs() const {
bool PnrSdcOption::constrain_switch_block_outputs() const {
return constrain_switch_block_outputs_;
}
/********************************************************************
* Public mutators
********************************************************************/
void SdcOption::set_sdc_dir(const std::string& sdc_dir) {
void PnrSdcOption::set_sdc_dir(const std::string& sdc_dir) {
sdc_dir_ = sdc_dir;
}
void SdcOption::set_generate_sdc_pnr(const bool& generate_sdc_pnr) {
void PnrSdcOption::set_generate_sdc_pnr(const bool& generate_sdc_pnr) {
constrain_global_port_ = generate_sdc_pnr;
constrain_grid_ = generate_sdc_pnr;
constrain_sb_ = generate_sdc_pnr;
@ -90,35 +82,31 @@ void SdcOption::set_generate_sdc_pnr(const bool& generate_sdc_pnr) {
constrain_switch_block_outputs_ = generate_sdc_pnr;
}
void SdcOption::set_generate_sdc_analysis(const bool& generate_sdc_analysis) {
generate_sdc_analysis_ = generate_sdc_analysis;
}
void SdcOption::set_constrain_global_port(const bool& constrain_global_port) {
void PnrSdcOption::set_constrain_global_port(const bool& constrain_global_port) {
constrain_global_port_ = constrain_global_port;
}
void SdcOption::set_constrain_grid(const bool& constrain_grid) {
void PnrSdcOption::set_constrain_grid(const bool& constrain_grid) {
constrain_grid_ = constrain_grid;
}
void SdcOption::set_constrain_sb(const bool& constrain_sb) {
void PnrSdcOption::set_constrain_sb(const bool& constrain_sb) {
constrain_sb_ = constrain_sb;
}
void SdcOption::set_constrain_cb(const bool& constrain_cb) {
void PnrSdcOption::set_constrain_cb(const bool& constrain_cb) {
constrain_cb_ = constrain_cb;
}
void SdcOption::set_constrain_configurable_memory_outputs(const bool& constrain_config_mem_outputs) {
void PnrSdcOption::set_constrain_configurable_memory_outputs(const bool& constrain_config_mem_outputs) {
constrain_configurable_memory_outputs_ = constrain_config_mem_outputs;
}
void SdcOption::set_constrain_routing_multiplexer_outputs(const bool& constrain_routing_mux_outputs) {
void PnrSdcOption::set_constrain_routing_multiplexer_outputs(const bool& constrain_routing_mux_outputs) {
constrain_routing_multiplexer_outputs_ = constrain_routing_mux_outputs;
}
void SdcOption::set_constrain_switch_block_outputs(const bool& constrain_sb_outputs) {
void PnrSdcOption::set_constrain_switch_block_outputs(const bool& constrain_sb_outputs) {
constrain_switch_block_outputs_ = constrain_sb_outputs;
}

View File

@ -1,8 +1,9 @@
#ifndef SDC_OPTION_H
#define SDC_OPTION_H
#ifndef PNR_SDC_OPTION_H
#define PNR_SDC_OPTION_H
/********************************************************************
* A data structure to include all the options for the SDC generator
* in purpose of constraining physical design of FPGA fabric in back-end flow
********************************************************************/
#include <string>
@ -10,14 +11,12 @@
/* begin namespace openfpga */
namespace openfpga {
class SdcOption {
class PnrSdcOption {
public: /* Public Constructors */
SdcOption(const std::string& sdc_dir);
PnrSdcOption(const std::string& sdc_dir);
public: /* Public accessors */
std::string sdc_dir() const;
bool generate_sdc() const;
bool generate_sdc_pnr() const;
bool generate_sdc_analysis() const;
bool constrain_global_port() const;
bool constrain_grid() const;
bool constrain_sb() const;
@ -28,7 +27,6 @@ class SdcOption {
public: /* Public mutators */
void set_sdc_dir(const std::string& sdc_dir);
void set_generate_sdc_pnr(const bool& generate_sdc_pnr);
void set_generate_sdc_analysis(const bool& generate_sdc_analysis);
void set_constrain_global_port(const bool& constrain_global_port);
void set_constrain_grid(const bool& constrain_grid);
void set_constrain_sb(const bool& constrain_sb);
@ -45,7 +43,6 @@ class SdcOption {
bool constrain_configurable_memory_outputs_;
bool constrain_routing_multiplexer_outputs_;
bool constrain_switch_block_outputs_;
bool generate_sdc_analysis_;
};
} /* end namespace openfpga */