From 89c51b70e353543ccbcd5d477988a5516e2685f0 Mon Sep 17 00:00:00 2001 From: tangxifan Date: Fri, 28 Feb 2020 09:48:58 -0700 Subject: [PATCH] split sdc option into two categories which will be called by different commands --- openfpga/src/fpga_sdc/analysis_sdc_option.cpp | 39 ++++++++++++++ openfpga/src/fpga_sdc/analysis_sdc_option.h | 30 +++++++++++ .../{sdc_option.cpp => pnr_sdc_option.cpp} | 52 +++++++------------ .../{sdc_option.h => pnr_sdc_option.h} | 13 ++--- 4 files changed, 94 insertions(+), 40 deletions(-) create mode 100644 openfpga/src/fpga_sdc/analysis_sdc_option.cpp create mode 100644 openfpga/src/fpga_sdc/analysis_sdc_option.h rename openfpga/src/fpga_sdc/{sdc_option.cpp => pnr_sdc_option.cpp} (60%) rename openfpga/src/fpga_sdc/{sdc_option.h => pnr_sdc_option.h} (85%) diff --git a/openfpga/src/fpga_sdc/analysis_sdc_option.cpp b/openfpga/src/fpga_sdc/analysis_sdc_option.cpp new file mode 100644 index 000000000..444e73fb4 --- /dev/null +++ b/openfpga/src/fpga_sdc/analysis_sdc_option.cpp @@ -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 */ diff --git a/openfpga/src/fpga_sdc/analysis_sdc_option.h b/openfpga/src/fpga_sdc/analysis_sdc_option.h new file mode 100644 index 000000000..514e5e81c --- /dev/null +++ b/openfpga/src/fpga_sdc/analysis_sdc_option.h @@ -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 + +/* 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 diff --git a/openfpga/src/fpga_sdc/sdc_option.cpp b/openfpga/src/fpga_sdc/pnr_sdc_option.cpp similarity index 60% rename from openfpga/src/fpga_sdc/sdc_option.cpp rename to openfpga/src/fpga_sdc/pnr_sdc_option.cpp index 4b8c4666f..3a3906b50 100644 --- a/openfpga/src/fpga_sdc/sdc_option.cpp +++ b/openfpga/src/fpga_sdc/pnr_sdc_option.cpp @@ -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; } diff --git a/openfpga/src/fpga_sdc/sdc_option.h b/openfpga/src/fpga_sdc/pnr_sdc_option.h similarity index 85% rename from openfpga/src/fpga_sdc/sdc_option.h rename to openfpga/src/fpga_sdc/pnr_sdc_option.h index d53c08e94..a485a1946 100644 --- a/openfpga/src/fpga_sdc/sdc_option.h +++ b/openfpga/src/fpga_sdc/pnr_sdc_option.h @@ -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 @@ -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 */