rename some methods in technology library and start building associated XML parser
This commit is contained in:
parent
b1501223cc
commit
88a96673e3
|
@ -9,32 +9,34 @@
|
|||
-->
|
||||
<openfpga_architecture>
|
||||
<technology_library>
|
||||
<device name="logic" type="transistor">
|
||||
<model type="academia" corner="TOP_TT" ref="M" path="${OPENFPGA_PATH}/openfpga_flow/tech/PTM_45nm/45nm.pm"/>
|
||||
<design vdd="0.9" pn_ratio="2"/>
|
||||
<nmos name="nch" chan_length="40e-9" min_width="140e-9" variation="logic_transistor_var"/>
|
||||
<pmos name="pch" chan_length="40e-9" min_width="140e-9" variation="logic_transistor_var"/>
|
||||
</device>
|
||||
<device name="io" type="transistor"/>
|
||||
<model type="academia" corner="TT" ref="M" path="${OPENFPGA_PATH}/openfpga_flow/tech/PTM_45nm/45nm.pm"/>
|
||||
<design vdd="2.5" pn_ratio="3"/>
|
||||
<nmos name="nch_25" chan_length="270e-9" min_width="320e-9" variation="io_transistor_var"/>
|
||||
<pmos name="pch_25" chan_length="270e-9" min_width="320e-9" variation="io_transistor_var"/>
|
||||
</device>
|
||||
<device name="mem_rram" type="rram">
|
||||
<model type="academia" ref="X" path="${OPENFPGA_PATH}/openfpga_flow/tech/PTM_45nm/rram.pm"/>
|
||||
<rram rlrs="1e4" rhrs="1e5" variation="mem_rram_var"/>
|
||||
</device>
|
||||
<device name="logic_rram" type="rram">
|
||||
<model type="academia" ref="X" path="${OPENFPGA_PATH}/openfpga_flow/tech/PTM_45nm/rram.pm"/>
|
||||
<rram rlrs="5e3" rhrs="20e6" variation="logic_rram_var"/>
|
||||
</device>
|
||||
<device_variation>
|
||||
<device_library>
|
||||
<device_model name="logic" type="transistor">
|
||||
<lib type="academia" corner="TOP_TT" ref="M" path="${OPENFPGA_PATH}/openfpga_flow/tech/PTM_45nm/45nm.pm"/>
|
||||
<design vdd="0.9" pn_ratio="2"/>
|
||||
<nmos name="nch" chan_length="40e-9" min_width="140e-9" variation="logic_transistor_var"/>
|
||||
<pmos name="pch" chan_length="40e-9" min_width="140e-9" variation="logic_transistor_var"/>
|
||||
</device_model>
|
||||
<device_model name="io" type="transistor"/>
|
||||
<lib type="academia" corner="TT" ref="M" path="${OPENFPGA_PATH}/openfpga_flow/tech/PTM_45nm/45nm.pm"/>
|
||||
<design vdd="2.5" pn_ratio="3"/>
|
||||
<nmos name="nch_25" chan_length="270e-9" min_width="320e-9" variation="io_transistor_var"/>
|
||||
<pmos name="pch_25" chan_length="270e-9" min_width="320e-9" variation="io_transistor_var"/>
|
||||
</device_model>
|
||||
<device_model name="mem_rram" type="rram">
|
||||
<lib type="academia" ref="X" path="${OPENFPGA_PATH}/openfpga_flow/tech/PTM_45nm/rram.pm"/>
|
||||
<rram rlrs="1e4" rhrs="1e5" variation="mem_rram_var"/>
|
||||
</device_model>
|
||||
<device_model name="logic_rram" type="rram">
|
||||
<lib type="academia" ref="X" path="${OPENFPGA_PATH}/openfpga_flow/tech/PTM_45nm/rram.pm"/>
|
||||
<rram rlrs="5e3" rhrs="20e6" variation="logic_rram_var"/>
|
||||
</device_model>
|
||||
</device_library>
|
||||
<variation_library>
|
||||
<variation name="logic_transistor_var" abs_variation="0.1" num_sigma="3"/>
|
||||
<variation name="io_transistor_var" abs_variation="0.1" num_sigma="3"/>
|
||||
<variation name="mem_rram_var" abs_variation="0.1" num_sigma="3"/>
|
||||
<variation name="logic_rram_var" abs_variation="0.1" num_sigma="3"/>
|
||||
</device_variation>
|
||||
</variation_library>
|
||||
</technology_library>
|
||||
<circuit_library>
|
||||
<circuit_model type="inv_buf" name="INVTX1" prefix="INVTX1" is_default="true">
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define OPENFPGA_ARCH_H
|
||||
|
||||
#include "circuit_library.h"
|
||||
#include "technology_library.h"
|
||||
|
||||
/* namespace openfpga begins */
|
||||
namespace openfpga {
|
||||
|
@ -11,6 +12,7 @@ namespace openfpga {
|
|||
*/
|
||||
struct Arch {
|
||||
CircuitLibrary circuit_lib;
|
||||
TechnologyLibrary tech_lib;
|
||||
};
|
||||
|
||||
} /* namespace openfpga ends */
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "arch_error.h"
|
||||
#include "read_xml_util.h"
|
||||
|
||||
#include "read_xml_technology_library.h"
|
||||
#include "read_xml_circuit_library.h"
|
||||
#include "read_xml_openfpga_arch.h"
|
||||
|
||||
|
@ -33,12 +34,12 @@ openfpga::Arch read_xml_openfpga_arch(const char* arch_file_name) {
|
|||
loc_data = pugiutil::load_xml(doc, arch_file_name);
|
||||
|
||||
/* First node should be <openfpga_architecture> */
|
||||
auto xml_circuit_settings = get_single_child(doc, "openfpga_architecture", loc_data);
|
||||
auto xml_openfpga_arch = get_single_child(doc, "openfpga_architecture", loc_data);
|
||||
|
||||
/* Parse circuit_models to circuit library
|
||||
* under the node <module_circuit_models>
|
||||
*/
|
||||
auto xml_circuit_models = get_single_child(xml_circuit_settings, "circuit_library", loc_data);
|
||||
auto xml_circuit_models = get_single_child(xml_openfpga_arch, "circuit_library", loc_data);
|
||||
openfpga_arch.circuit_lib = read_xml_circuit_library(xml_circuit_models, loc_data);
|
||||
|
||||
/* Build the internal links for the circuit library */
|
||||
|
@ -47,6 +48,10 @@ openfpga::Arch read_xml_openfpga_arch(const char* arch_file_name) {
|
|||
/* Build the timing graph inside the circuit library */
|
||||
openfpga_arch.circuit_lib.build_timing_graphs();
|
||||
|
||||
/* Parse technology library */
|
||||
auto xml_tech_lib = get_single_child(xml_openfpga_arch, "technology_library", loc_data);
|
||||
openfpga_arch.tech_lib = read_xml_technology_library(xml_tech_lib, loc_data);
|
||||
|
||||
/* Second node should be <openfpga_simulation_setting> */
|
||||
auto xml_simulation_settings = get_single_child(doc, "openfpga_simulation_setting", loc_data);
|
||||
|
||||
|
|
|
@ -16,20 +16,20 @@ TechnologyLibrary::TechnologyLibrary() {
|
|||
/************************************************************************
|
||||
* Public Accessors : aggregates
|
||||
***********************************************************************/
|
||||
TechnologyLibrary::technology_device_range TechnologyLibrary::devices() const {
|
||||
return vtr::make_range(device_ids_.begin(), device_ids_.end());
|
||||
TechnologyLibrary::technology_model_range TechnologyLibrary::models() const {
|
||||
return vtr::make_range(model_ids_.begin(), model_ids_.end());
|
||||
}
|
||||
|
||||
TechnologyLibrary::technology_variation_range TechnologyLibrary::variations() const {
|
||||
return vtr::make_range(variation_ids_.begin(), variation_ids_.end());
|
||||
}
|
||||
|
||||
/* Find technology devices in the same type (defined by users) and return a list of ids */
|
||||
std::vector<TechnologyDeviceId> TechnologyLibrary::devices_by_type(const enum e_tech_lib_device_type& type) const {
|
||||
std::vector<TechnologyDeviceId> type_ids;
|
||||
for (auto id : devices()) {
|
||||
/* Find technology models in the same type (defined by users) and return a list of ids */
|
||||
std::vector<TechnologyModelId> TechnologyLibrary::models_by_type(const enum e_tech_lib_model_type& type) const {
|
||||
std::vector<TechnologyModelId> type_ids;
|
||||
for (auto id : models()) {
|
||||
/* Skip unmatched types */
|
||||
if (type != device_type(id)) {
|
||||
if (type != model_type(id)) {
|
||||
continue;
|
||||
}
|
||||
/* Matched type, update the vector */
|
||||
|
@ -39,170 +39,170 @@ std::vector<TechnologyDeviceId> TechnologyLibrary::devices_by_type(const enum e_
|
|||
}
|
||||
|
||||
/************************************************************************
|
||||
* Public Accessors : Basic data query on technology devices
|
||||
* Public Accessors : Basic data query on technology models
|
||||
***********************************************************************/
|
||||
/* Access the name of a technology device */
|
||||
std::string TechnologyLibrary::device_name(const TechnologyDeviceId& device_id) const {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
return device_names_[device_id];
|
||||
/* Access the name of a technology model */
|
||||
std::string TechnologyLibrary::model_name(const TechnologyModelId& model_id) const {
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
return model_names_[model_id];
|
||||
}
|
||||
|
||||
/* Access the id of a technology device by name,
|
||||
/* Access the id of a technology model by name,
|
||||
* If the name is valid, we return a valid id
|
||||
* Otherwise, return an invalid id
|
||||
*/
|
||||
TechnologyDeviceId TechnologyLibrary::device(const std::string& name) const {
|
||||
std::map<std::string, TechnologyDeviceId>::const_iterator it = device_name2ids_.find(name);
|
||||
if (it != device_name2ids_.end()) {
|
||||
return TechnologyDeviceId::INVALID();
|
||||
TechnologyModelId TechnologyLibrary::model(const std::string& name) const {
|
||||
std::map<std::string, TechnologyModelId>::const_iterator it = model_name2ids_.find(name);
|
||||
if (it != model_name2ids_.end()) {
|
||||
return TechnologyModelId::INVALID();
|
||||
}
|
||||
|
||||
return device_name2ids_.at(name);
|
||||
return model_name2ids_.at(name);
|
||||
}
|
||||
|
||||
/* Access the type of a technology device */
|
||||
enum e_tech_lib_device_type TechnologyLibrary::device_type(const TechnologyDeviceId& device_id) const {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
return device_types_[device_id];
|
||||
/* Access the type of a technology model */
|
||||
enum e_tech_lib_model_type TechnologyLibrary::model_type(const TechnologyModelId& model_id) const {
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
return model_types_[model_id];
|
||||
}
|
||||
|
||||
/* Access the model type of a technology device */
|
||||
enum e_tech_lib_model_type TechnologyLibrary::device_model_type(const TechnologyDeviceId& device_id) const {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
return device_model_types_[device_id];
|
||||
/* Access the model type of a technology model */
|
||||
enum e_tech_lib_type TechnologyLibrary::model_lib_type(const TechnologyModelId& model_id) const {
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
return model_lib_types_[model_id];
|
||||
}
|
||||
|
||||
/* Access the process corner name of a technology device */
|
||||
std::string TechnologyLibrary::device_corner(const TechnologyDeviceId& device_id) const {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
return device_corners_[device_id];
|
||||
/* Access the process corner name of a technology model */
|
||||
std::string TechnologyLibrary::model_corner(const TechnologyModelId& model_id) const {
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
return model_corners_[model_id];
|
||||
}
|
||||
|
||||
/* Access the model reference name of a technology device */
|
||||
std::string TechnologyLibrary::device_model_ref(const TechnologyDeviceId& device_id) const {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
return device_model_refs_[device_id];
|
||||
/* Access the model reference name of a technology model */
|
||||
std::string TechnologyLibrary::model_ref(const TechnologyModelId& model_id) const {
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
return model_refs_[model_id];
|
||||
}
|
||||
|
||||
/* Access the path of library for a technology device */
|
||||
std::string TechnologyLibrary::device_lib_path(const TechnologyDeviceId& device_id) const {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
return device_lib_paths_[device_id];
|
||||
/* Access the path of library for a technology model */
|
||||
std::string TechnologyLibrary::model_lib_path(const TechnologyModelId& model_id) const {
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
return model_lib_paths_[model_id];
|
||||
}
|
||||
|
||||
/* Access the VDD of a technology device
|
||||
* Note: This is ONLY applicable to transistor device
|
||||
/* Access the VDD of a technology model
|
||||
* Note: This is ONLY applicable to transistor model
|
||||
*/
|
||||
float TechnologyLibrary::device_vdd(const TechnologyDeviceId& device_id) const {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
/* This is only applicable to transistor device */
|
||||
VTR_ASSERT(TECH_LIB_DEVICE_TRANSISTOR == device_type(device_id));
|
||||
return device_vdds_[device_id];
|
||||
float TechnologyLibrary::model_vdd(const TechnologyModelId& model_id) const {
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
/* This is only applicable to transistor model */
|
||||
VTR_ASSERT(TECH_LIB_MODEL_TRANSISTOR == model_type(model_id));
|
||||
return model_vdds_[model_id];
|
||||
}
|
||||
|
||||
/* Access the width ratio between PMOS and NMOS for a technology device
|
||||
* Note: This is ONLY applicable to transistor device
|
||||
/* Access the width ratio between PMOS and NMOS for a technology model
|
||||
* Note: This is ONLY applicable to transistor model
|
||||
*/
|
||||
float TechnologyLibrary::device_pn_ratio(const TechnologyDeviceId& device_id) const {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
/* This is only applicable to transistor device */
|
||||
VTR_ASSERT(TECH_LIB_DEVICE_TRANSISTOR == device_type(device_id));
|
||||
return device_pn_ratios_[device_id];
|
||||
float TechnologyLibrary::model_pn_ratio(const TechnologyModelId& model_id) const {
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
/* This is only applicable to transistor model */
|
||||
VTR_ASSERT(TECH_LIB_MODEL_TRANSISTOR == model_type(model_id));
|
||||
return model_pn_ratios_[model_id];
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Public Accessors : Basic data query on transistors
|
||||
***********************************************************************/
|
||||
/* Access the model name of a transistor (either PMOS or NMOS) for a technology device
|
||||
* Note: This is ONLY applicable to transistor device
|
||||
/* Access the model name of a transistor (either PMOS or NMOS) for a technology model
|
||||
* Note: This is ONLY applicable to transistor model
|
||||
*/
|
||||
std::string TechnologyLibrary::transistor_model_name(const TechnologyDeviceId& device_id,
|
||||
const e_tech_lib_trans_type& transistor_type) const {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
/* This is only applicable to transistor device */
|
||||
VTR_ASSERT(TECH_LIB_DEVICE_TRANSISTOR == device_type(device_id));
|
||||
return transistor_model_names_[device_id][transistor_type];
|
||||
std::string TechnologyLibrary::transistor_model_name(const TechnologyModelId& model_id,
|
||||
const e_tech_lib_transistor_type& transistor_type) const {
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
/* This is only applicable to transistor model */
|
||||
VTR_ASSERT(TECH_LIB_MODEL_TRANSISTOR == model_type(model_id));
|
||||
return transistor_model_names_[model_id][transistor_type];
|
||||
}
|
||||
|
||||
/* Access the channel length of a transistor (either PMOS or NMOS) for a technology device
|
||||
* Note: This is ONLY applicable to transistor device
|
||||
/* Access the channel length of a transistor (either PMOS or NMOS) for a technology model
|
||||
* Note: This is ONLY applicable to transistor model
|
||||
*/
|
||||
float TechnologyLibrary::transistor_model_chan_length(const TechnologyDeviceId& device_id,
|
||||
const e_tech_lib_trans_type& transistor_type) const {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
/* This is only applicable to transistor device */
|
||||
VTR_ASSERT(TECH_LIB_DEVICE_TRANSISTOR == device_type(device_id));
|
||||
return transistor_model_chan_lengths_[device_id][transistor_type];
|
||||
float TechnologyLibrary::transistor_model_chan_length(const TechnologyModelId& model_id,
|
||||
const e_tech_lib_transistor_type& transistor_type) const {
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
/* This is only applicable to transistor model */
|
||||
VTR_ASSERT(TECH_LIB_MODEL_TRANSISTOR == model_type(model_id));
|
||||
return transistor_model_chan_lengths_[model_id][transistor_type];
|
||||
}
|
||||
|
||||
/* Access the minimum width of a transistor (either PMOS or NMOS) for a technology device
|
||||
* Note: This is ONLY applicable to transistor device
|
||||
/* Access the minimum width of a transistor (either PMOS or NMOS) for a technology model
|
||||
* Note: This is ONLY applicable to transistor model
|
||||
*/
|
||||
float TechnologyLibrary::transistor_model_min_width(const TechnologyDeviceId& device_id,
|
||||
const e_tech_lib_trans_type& transistor_type) const {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
/* This is only applicable to transistor device */
|
||||
VTR_ASSERT(TECH_LIB_DEVICE_TRANSISTOR == device_type(device_id));
|
||||
return transistor_model_min_widths_[device_id][transistor_type];
|
||||
float TechnologyLibrary::transistor_model_min_width(const TechnologyModelId& model_id,
|
||||
const e_tech_lib_transistor_type& transistor_type) const {
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
/* This is only applicable to transistor model */
|
||||
VTR_ASSERT(TECH_LIB_MODEL_TRANSISTOR == model_type(model_id));
|
||||
return transistor_model_min_widths_[model_id][transistor_type];
|
||||
}
|
||||
|
||||
/* Access the minimum width of a transistor (either PMOS or NMOS) for a technology device
|
||||
* Note: This is ONLY applicable to transistor device
|
||||
/* Access the minimum width of a transistor (either PMOS or NMOS) for a technology model
|
||||
* Note: This is ONLY applicable to transistor model
|
||||
*/
|
||||
TechnologyVariationId TechnologyLibrary::transistor_model_variation(const TechnologyDeviceId& device_id,
|
||||
const e_tech_lib_trans_type& transistor_type) const {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
/* This is only applicable to transistor device */
|
||||
VTR_ASSERT(TECH_LIB_DEVICE_TRANSISTOR == device_type(device_id));
|
||||
return transistor_model_variation_ids_[device_id][transistor_type];
|
||||
TechnologyVariationId TechnologyLibrary::transistor_model_variation(const TechnologyModelId& model_id,
|
||||
const e_tech_lib_transistor_type& transistor_type) const {
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
/* This is only applicable to transistor model */
|
||||
VTR_ASSERT(TECH_LIB_MODEL_TRANSISTOR == model_type(model_id));
|
||||
return transistor_model_variation_ids_[model_id][transistor_type];
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Public Accessors : Basic data query on RRAM devices
|
||||
* Public Accessors : Basic data query on RRAM models
|
||||
***********************************************************************/
|
||||
/* Access the Low Resistence of a RRAM for a technology device
|
||||
* Note: This is ONLY applicable to RRAM device
|
||||
/* Access the Low Resistence of a RRAM for a technology model
|
||||
* Note: This is ONLY applicable to RRAM model
|
||||
*/
|
||||
float TechnologyLibrary::rram_rlrs(const TechnologyDeviceId& device_id) const {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
/* This is only applicable to transistor device */
|
||||
VTR_ASSERT(TECH_LIB_DEVICE_RRAM == device_type(device_id));
|
||||
return rram_resistances_[device_id].x();
|
||||
float TechnologyLibrary::rram_rlrs(const TechnologyModelId& model_id) const {
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
/* This is only applicable to transistor model */
|
||||
VTR_ASSERT(TECH_LIB_MODEL_RRAM == model_type(model_id));
|
||||
return rram_resistances_[model_id].x();
|
||||
}
|
||||
|
||||
/* Access the High Resistence of a RRAM for a technology device
|
||||
* Note: This is ONLY applicable to RRAM device
|
||||
/* Access the High Resistence of a RRAM for a technology model
|
||||
* Note: This is ONLY applicable to RRAM model
|
||||
*/
|
||||
float TechnologyLibrary::rram_rhrs(const TechnologyDeviceId& device_id) const {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
/* This is only applicable to transistor device */
|
||||
VTR_ASSERT(TECH_LIB_DEVICE_RRAM == device_type(device_id));
|
||||
return rram_resistances_[device_id].y();
|
||||
float TechnologyLibrary::rram_rhrs(const TechnologyModelId& model_id) const {
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
/* This is only applicable to transistor model */
|
||||
VTR_ASSERT(TECH_LIB_MODEL_RRAM == model_type(model_id));
|
||||
return rram_resistances_[model_id].y();
|
||||
}
|
||||
|
||||
/* Access the Variation id of a RRAM for a technology device
|
||||
* Note: This is ONLY applicable to RRAM device
|
||||
/* Access the Variation id of a RRAM for a technology model
|
||||
* Note: This is ONLY applicable to RRAM model
|
||||
*/
|
||||
TechnologyVariationId TechnologyLibrary::rram_variation(const TechnologyDeviceId& device_id) const {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
/* This is only applicable to RRAM device */
|
||||
VTR_ASSERT(TECH_LIB_DEVICE_RRAM == device_type(device_id));
|
||||
return rram_variation_ids_[device_id];
|
||||
TechnologyVariationId TechnologyLibrary::rram_variation(const TechnologyModelId& model_id) const {
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
/* This is only applicable to RRAM model */
|
||||
VTR_ASSERT(TECH_LIB_MODEL_RRAM == model_type(model_id));
|
||||
return rram_variation_ids_[model_id];
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
|
@ -243,29 +243,29 @@ size_t TechnologyLibrary::variation_num_sigma(const TechnologyVariationId& varia
|
|||
}
|
||||
|
||||
/************************************************************************
|
||||
* Public Mutators: device-related
|
||||
* Public Mutators: model-related
|
||||
***********************************************************************/
|
||||
/* Add a new device to the library, return an id
|
||||
/* Add a new model to the library, return an id
|
||||
* This function will check if the name has already been used inside the data structure.
|
||||
* If used, it will return an invalid id
|
||||
*/
|
||||
TechnologyDeviceId TechnologyLibrary::add_device(const std::string& name) {
|
||||
std::map<std::string, TechnologyDeviceId>::iterator it = device_name2ids_.find(name);
|
||||
if (it != device_name2ids_.end()) {
|
||||
return TechnologyDeviceId::INVALID();
|
||||
TechnologyModelId TechnologyLibrary::add_model(const std::string& name) {
|
||||
std::map<std::string, TechnologyModelId>::iterator it = model_name2ids_.find(name);
|
||||
if (it != model_name2ids_.end()) {
|
||||
return TechnologyModelId::INVALID();
|
||||
}
|
||||
|
||||
/* This is a legal name. we can create a new id */
|
||||
TechnologyDeviceId device = TechnologyDeviceId(device_ids_.size());
|
||||
device_ids_.push_back(device);
|
||||
device_names_.push_back(name);
|
||||
device_types_.emplace_back(NUM_TECH_LIB_DEVICE_TYPES);
|
||||
device_model_types_.emplace_back(NUM_TECH_LIB_MODEL_TYPES);
|
||||
device_corners_.emplace_back();
|
||||
device_model_refs_.emplace_back();
|
||||
device_lib_paths_.emplace_back();
|
||||
device_vdds_.push_back(-1);
|
||||
device_pn_ratios_.push_back(-1);
|
||||
TechnologyModelId model = TechnologyModelId(model_ids_.size());
|
||||
model_ids_.push_back(model);
|
||||
model_names_.push_back(name);
|
||||
model_types_.emplace_back(NUM_TECH_LIB_MODEL_TYPES);
|
||||
model_lib_types_.emplace_back(NUM_TECH_LIB_TYPES);
|
||||
model_corners_.emplace_back();
|
||||
model_refs_.emplace_back();
|
||||
model_lib_paths_.emplace_back();
|
||||
model_vdds_.push_back(-1);
|
||||
model_pn_ratios_.push_back(-1);
|
||||
|
||||
transistor_model_names_.emplace_back();
|
||||
transistor_model_chan_lengths_.emplace_back();
|
||||
|
@ -278,171 +278,171 @@ TechnologyDeviceId TechnologyLibrary::add_device(const std::string& name) {
|
|||
rram_variation_ids_.emplace_back();
|
||||
|
||||
/* Register in the name-to-id map */
|
||||
device_name2ids_[name] = device;
|
||||
model_name2ids_[name] = model;
|
||||
|
||||
return device;
|
||||
return model;
|
||||
}
|
||||
|
||||
/* Set the device type of a device in the library */
|
||||
void TechnologyLibrary::set_device_type(const TechnologyDeviceId& device_id,
|
||||
const e_tech_lib_device_type& type) {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
device_types_[device_id] = type;
|
||||
/* Set the model type of a model in the library */
|
||||
void TechnologyLibrary::set_model_type(const TechnologyModelId& model_id,
|
||||
const e_tech_lib_model_type& type) {
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
model_types_[model_id] = type;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set the model type of a device in the library */
|
||||
void TechnologyLibrary::set_device_model_type(const TechnologyDeviceId& device_id,
|
||||
const e_tech_lib_model_type& model_type) {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
device_model_types_[device_id] = model_type;
|
||||
/* Set the model type of a device model in the library */
|
||||
void TechnologyLibrary::set_model_lib_type(const TechnologyModelId& model_id,
|
||||
const e_tech_lib_type& model_lib_type) {
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
model_lib_types_[model_id] = model_lib_type;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set the process corner of a device in the library */
|
||||
void TechnologyLibrary::set_device_corner(const TechnologyDeviceId& device_id,
|
||||
/* Set the process corner of a model in the library */
|
||||
void TechnologyLibrary::set_model_corner(const TechnologyModelId& model_id,
|
||||
const std::string& corner) {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
device_corners_[device_id] = corner;
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
model_corners_[model_id] = corner;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set the string used to model reference of a device in the library */
|
||||
void TechnologyLibrary::set_device_model_ref(const TechnologyDeviceId& device_id,
|
||||
const std::string& model_ref) {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
device_model_refs_[device_id] = model_ref;
|
||||
/* Set the string used to model reference of a model in the library */
|
||||
void TechnologyLibrary::set_model_ref(const TechnologyModelId& model_id,
|
||||
const std::string& model_ref) {
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
model_refs_[model_id] = model_ref;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set the library file path of a device in the library */
|
||||
void TechnologyLibrary::set_device_lib_path(const TechnologyDeviceId& device_id,
|
||||
/* Set the library file path of a model in the library */
|
||||
void TechnologyLibrary::set_model_lib_path(const TechnologyModelId& model_id,
|
||||
const std::string& lib_path) {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
device_lib_paths_[device_id] = lib_path;
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
model_lib_paths_[model_id] = lib_path;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set the operating voltage of a device in the library
|
||||
/* Set the operating voltage of a model in the library
|
||||
* This is ONLY applicable to transistors
|
||||
*/
|
||||
void TechnologyLibrary::set_device_vdd(const TechnologyDeviceId& device_id,
|
||||
void TechnologyLibrary::set_model_vdd(const TechnologyModelId& model_id,
|
||||
const float& vdd) {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
VTR_ASSERT(TECH_LIB_DEVICE_TRANSISTOR == device_type(device_id));
|
||||
device_vdds_[device_id] = vdd;
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
VTR_ASSERT(TECH_LIB_MODEL_TRANSISTOR == model_type(model_id));
|
||||
model_vdds_[model_id] = vdd;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set the width ratio between PMOS and NMOS of a device in the library
|
||||
/* Set the width ratio between PMOS and NMOS of a model in the library
|
||||
* This is ONLY applicable to transistors
|
||||
*/
|
||||
void TechnologyLibrary::set_device_pn_ratio(const TechnologyDeviceId& device_id,
|
||||
void TechnologyLibrary::set_model_pn_ratio(const TechnologyModelId& model_id,
|
||||
const float& pn_ratio) {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
VTR_ASSERT(TECH_LIB_DEVICE_TRANSISTOR == device_type(device_id));
|
||||
device_pn_ratios_[device_id] = pn_ratio;
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
VTR_ASSERT(TECH_LIB_MODEL_TRANSISTOR == model_type(model_id));
|
||||
model_pn_ratios_[model_id] = pn_ratio;
|
||||
return;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Public Mutators: transistor-related
|
||||
***********************************************************************/
|
||||
/* Set the model name for either PMOS or NMOS of a device in the library
|
||||
/* Set the model name for either PMOS or NMOS of a model in the library
|
||||
* This is ONLY applicable to transistors
|
||||
*/
|
||||
void TechnologyLibrary::set_transistor_model_name(const TechnologyDeviceId& device_id,
|
||||
const e_tech_lib_trans_type& transistor_type,
|
||||
void TechnologyLibrary::set_transistor_model_name(const TechnologyModelId& model_id,
|
||||
const e_tech_lib_transistor_type& transistor_type,
|
||||
const std::string& model_name) {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
VTR_ASSERT(TECH_LIB_DEVICE_TRANSISTOR == device_type(device_id));
|
||||
transistor_model_names_[device_id][transistor_type] = model_name;
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
VTR_ASSERT(TECH_LIB_MODEL_TRANSISTOR == model_type(model_id));
|
||||
transistor_model_names_[model_id][transistor_type] = model_name;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set the channel length for either PMOS or NMOS of a device in the library
|
||||
/* Set the channel length for either PMOS or NMOS of a model in the library
|
||||
* This is ONLY applicable to transistors
|
||||
*/
|
||||
void TechnologyLibrary::set_transistor_model_chan_length(const TechnologyDeviceId& device_id,
|
||||
const e_tech_lib_trans_type& transistor_type,
|
||||
void TechnologyLibrary::set_transistor_model_chan_length(const TechnologyModelId& model_id,
|
||||
const e_tech_lib_transistor_type& transistor_type,
|
||||
const float& chan_length) {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
VTR_ASSERT(TECH_LIB_DEVICE_TRANSISTOR == device_type(device_id));
|
||||
transistor_model_chan_lengths_[device_id][transistor_type] = chan_length;
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
VTR_ASSERT(TECH_LIB_MODEL_TRANSISTOR == model_type(model_id));
|
||||
transistor_model_chan_lengths_[model_id][transistor_type] = chan_length;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set the minimum width for either PMOS or NMOS of a device in the library
|
||||
/* Set the minimum width for either PMOS or NMOS of a model in the library
|
||||
* This is ONLY applicable to transistors
|
||||
*/
|
||||
void TechnologyLibrary::set_transistor_model_min_width(const TechnologyDeviceId& device_id,
|
||||
const e_tech_lib_trans_type& transistor_type,
|
||||
void TechnologyLibrary::set_transistor_model_min_width(const TechnologyModelId& model_id,
|
||||
const e_tech_lib_transistor_type& transistor_type,
|
||||
const float& min_width) {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
VTR_ASSERT(TECH_LIB_DEVICE_TRANSISTOR == device_type(device_id));
|
||||
transistor_model_min_widths_[device_id][transistor_type] = min_width;
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
VTR_ASSERT(TECH_LIB_MODEL_TRANSISTOR == model_type(model_id));
|
||||
transistor_model_min_widths_[model_id][transistor_type] = min_width;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set the variation name for either PMOS or NMOS of a device in the library
|
||||
/* Set the variation name for either PMOS or NMOS of a model in the library
|
||||
* This is ONLY applicable to transistors
|
||||
*/
|
||||
void TechnologyLibrary::set_transistor_model_variation_name(const TechnologyDeviceId& device_id,
|
||||
const e_tech_lib_trans_type& transistor_type,
|
||||
void TechnologyLibrary::set_transistor_model_variation_name(const TechnologyModelId& model_id,
|
||||
const e_tech_lib_transistor_type& transistor_type,
|
||||
const std::string& variation_name) {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
VTR_ASSERT(TECH_LIB_DEVICE_TRANSISTOR == device_type(device_id));
|
||||
transistor_model_variation_names_[device_id][transistor_type] = variation_name;
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
VTR_ASSERT(TECH_LIB_MODEL_TRANSISTOR == model_type(model_id));
|
||||
transistor_model_variation_names_[model_id][transistor_type] = variation_name;
|
||||
return;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Public Mutators: RRAM-related
|
||||
***********************************************************************/
|
||||
/* Set the Low Resistance State (LRS) resistance for a RRAM device in the library
|
||||
* This is ONLY applicable to RRAM devices
|
||||
/* Set the Low Resistance State (LRS) resistance for a RRAM model in the library
|
||||
* This is ONLY applicable to RRAM models
|
||||
*/
|
||||
void TechnologyLibrary::set_rram_rlrs(const TechnologyDeviceId& device_id,
|
||||
void TechnologyLibrary::set_rram_rlrs(const TechnologyModelId& model_id,
|
||||
const float& rlrs) {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
VTR_ASSERT(TECH_LIB_DEVICE_RRAM == device_type(device_id));
|
||||
rram_resistances_[device_id].set_x(rlrs);
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
VTR_ASSERT(TECH_LIB_MODEL_RRAM == model_type(model_id));
|
||||
rram_resistances_[model_id].set_x(rlrs);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set the High Resistance State (HRS) resistance for a RRAM device in the library
|
||||
* This is ONLY applicable to RRAM devices
|
||||
/* Set the High Resistance State (HRS) resistance for a RRAM model in the library
|
||||
* This is ONLY applicable to RRAM models
|
||||
*/
|
||||
void TechnologyLibrary::set_rram_rhrs(const TechnologyDeviceId& device_id,
|
||||
void TechnologyLibrary::set_rram_rhrs(const TechnologyModelId& model_id,
|
||||
const float& rhrs) {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
VTR_ASSERT(TECH_LIB_DEVICE_RRAM == device_type(device_id));
|
||||
rram_resistances_[device_id].set_y(rhrs);
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
VTR_ASSERT(TECH_LIB_MODEL_RRAM == model_type(model_id));
|
||||
rram_resistances_[model_id].set_y(rhrs);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set the variation name for a RRAM device in the library
|
||||
* This is ONLY applicable to RRAM devices
|
||||
/* Set the variation name for a RRAM model in the library
|
||||
* This is ONLY applicable to RRAM models
|
||||
*/
|
||||
void TechnologyLibrary::set_rram_variation_name(const TechnologyDeviceId& device_id,
|
||||
void TechnologyLibrary::set_rram_variation_name(const TechnologyModelId& model_id,
|
||||
const std::string& variation_name) {
|
||||
/* validate the device_id */
|
||||
VTR_ASSERT(valid_device_id(device_id));
|
||||
VTR_ASSERT(TECH_LIB_DEVICE_RRAM == device_type(device_id));
|
||||
rram_variation_names_[device_id] = variation_name;
|
||||
/* validate the model_id */
|
||||
VTR_ASSERT(valid_model_id(model_id));
|
||||
VTR_ASSERT(TECH_LIB_MODEL_RRAM == model_type(model_id));
|
||||
rram_variation_names_[model_id] = variation_name;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -490,31 +490,31 @@ void TechnologyLibrary::set_variation_num_sigma(const TechnologyVariationId& var
|
|||
/************************************************************************
|
||||
* Public mutators: linkers
|
||||
***********************************************************************/
|
||||
/* This function builds the links between devices and variations,
|
||||
/* This function builds the links between models and variations,
|
||||
* which have been defined in the technology library
|
||||
*/
|
||||
void TechnologyLibrary::link_devices_to_variations() {
|
||||
for (const TechnologyDeviceId& device : devices()) {
|
||||
void TechnologyLibrary::link_models_to_variations() {
|
||||
for (const TechnologyModelId& model : models()) {
|
||||
/* For transistors, find the variation name for each model and build a link */
|
||||
if (TECH_LIB_DEVICE_TRANSISTOR == device_type(device)) {
|
||||
if (TECH_LIB_MODEL_TRANSISTOR == model_type(model)) {
|
||||
/* PMOS transistor, if a variation name is specified, we try to build a link
|
||||
* Otherwise, we assign any invalid id */
|
||||
const std::string& pmos_var_name = transistor_model_variation_names_[device][TECH_LIB_TRANSISTOR_PMOS];
|
||||
transistor_model_variation_ids_[device][TECH_LIB_TRANSISTOR_PMOS] = variation(pmos_var_name);
|
||||
const std::string& pmos_var_name = transistor_model_variation_names_[model][TECH_LIB_TRANSISTOR_PMOS];
|
||||
transistor_model_variation_ids_[model][TECH_LIB_TRANSISTOR_PMOS] = variation(pmos_var_name);
|
||||
|
||||
/* NMOS transistor, if a variation name is specified, we try to build a link
|
||||
* Otherwise, we assign any invalid id
|
||||
*/
|
||||
const std::string& nmos_var_name = transistor_model_variation_names_[device][TECH_LIB_TRANSISTOR_NMOS];
|
||||
transistor_model_variation_ids_[device][TECH_LIB_TRANSISTOR_NMOS] = variation(nmos_var_name);
|
||||
const std::string& nmos_var_name = transistor_model_variation_names_[model][TECH_LIB_TRANSISTOR_NMOS];
|
||||
transistor_model_variation_ids_[model][TECH_LIB_TRANSISTOR_NMOS] = variation(nmos_var_name);
|
||||
/* Finish for transistors, go to the next */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Reach here it means an RRAM device, we find the variation name and try to build a link */
|
||||
VTR_ASSERT(TECH_LIB_DEVICE_RRAM == device_type(device));
|
||||
const std::string& rram_var_name = rram_variation_names_[device];
|
||||
rram_variation_ids_[device] = variation(rram_var_name);
|
||||
/* Reach here it means an RRAM model, we find the variation name and try to build a link */
|
||||
VTR_ASSERT(TECH_LIB_MODEL_RRAM == model_type(model));
|
||||
const std::string& rram_var_name = rram_variation_names_[model];
|
||||
rram_variation_ids_[model] = variation(rram_var_name);
|
||||
/* Finish for RRAMs, go to the next */
|
||||
}
|
||||
}
|
||||
|
@ -523,8 +523,8 @@ void TechnologyLibrary::link_devices_to_variations() {
|
|||
* Internal invalidators/validators
|
||||
***********************************************************************/
|
||||
/* Validators */
|
||||
bool TechnologyLibrary::valid_device_id(const TechnologyDeviceId& device_id) const {
|
||||
return ( size_t(device_id) < device_ids_.size() ) && ( device_id == device_ids_[device_id] );
|
||||
bool TechnologyLibrary::valid_model_id(const TechnologyModelId& model_id) const {
|
||||
return ( size_t(model_id) < model_ids_.size() ) && ( model_id == model_ids_[model_id] );
|
||||
}
|
||||
|
||||
bool TechnologyLibrary::valid_variation_id(const TechnologyVariationId& variation_id) const {
|
||||
|
|
|
@ -25,33 +25,33 @@
|
|||
* PTM is the Predictive Technology Model provided by the Arizona
|
||||
* State University (ASU). Available at ptm.asu.edu
|
||||
*******************************************************************/
|
||||
enum e_tech_lib_model_type {
|
||||
enum e_tech_lib_type {
|
||||
TECH_LIB_MODEL_INDUSTRY,
|
||||
TECH_LIB_MODEL_ACADEMIA,
|
||||
NUM_TECH_LIB_MODEL_TYPES
|
||||
NUM_TECH_LIB_TYPES
|
||||
};
|
||||
/* Strings correspond to each technology library type */
|
||||
constexpr std::array<const char*, NUM_TECH_LIB_MODEL_TYPES> TECH_LIB_MODEL_TYPE_STRING = {{"industry", "academia"}};
|
||||
constexpr std::array<const char*, NUM_TECH_LIB_TYPES> TECH_LIB_TYPE_STRING = {{"industry", "academia"}};
|
||||
|
||||
/********************************************************************
|
||||
* Types of device which may be defined in a technology library
|
||||
* Types of model which may be defined in a technology library
|
||||
* 1. transistor
|
||||
* 2. RRAM
|
||||
*******************************************************************/
|
||||
enum e_tech_lib_device_type {
|
||||
TECH_LIB_DEVICE_TRANSISTOR,
|
||||
TECH_LIB_DEVICE_RRAM,
|
||||
NUM_TECH_LIB_DEVICE_TYPES
|
||||
enum e_tech_lib_model_type {
|
||||
TECH_LIB_MODEL_TRANSISTOR,
|
||||
TECH_LIB_MODEL_RRAM,
|
||||
NUM_TECH_LIB_MODEL_TYPES
|
||||
};
|
||||
/* Strings correspond to transistor type */
|
||||
constexpr std::array<const char*, NUM_TECH_LIB_DEVICE_TYPES> TECH_LIB_DEVICE_TYPE_STRING = {{"transistor", "rram"}};
|
||||
constexpr std::array<const char*, NUM_TECH_LIB_MODEL_TYPES> TECH_LIB_MODEL_TYPE_STRING = {{"transistor", "rram"}};
|
||||
|
||||
/********************************************************************
|
||||
* Types of transistors which may be defined in a technology library
|
||||
* 1. NMOS transistor
|
||||
* 2. PMOS transistor
|
||||
*******************************************************************/
|
||||
enum e_tech_lib_trans_type {
|
||||
enum e_tech_lib_transistor_type {
|
||||
TECH_LIB_TRANSISTOR_PMOS,
|
||||
TECH_LIB_TRANSISTOR_NMOS,
|
||||
NUM_TECH_LIB_TRANSISTOR_TYPES
|
||||
|
@ -59,18 +59,6 @@ enum e_tech_lib_trans_type {
|
|||
/* Strings correspond to transistor type */
|
||||
constexpr std::array<const char*, NUM_TECH_LIB_TRANSISTOR_TYPES> TECH_LIB_TRANSISTOR_TYPE_STRING = {{"pmos", "nmos"}};
|
||||
|
||||
/********************************************************************
|
||||
* Process corners supported
|
||||
*******************************************************************/
|
||||
enum e_process_corner {
|
||||
TECH_LIB_CORNER_FF,
|
||||
TECH_LIB_CORNER_TT,
|
||||
TECH_LIB_CORNER_SS,
|
||||
NUM_TECH_LIB_CORNER_TYPES
|
||||
};
|
||||
/* Strings correspond to process corner type */
|
||||
constexpr std::array<const char*, NUM_TECH_LIB_CORNER_TYPES> TECH_LIB_CORNER_TYPE_STRING = {{"FF", "TT", "SS"}};
|
||||
|
||||
/********************************************************************
|
||||
* A data structure to describe technology library
|
||||
*
|
||||
|
@ -80,146 +68,146 @@ constexpr std::array<const char*, NUM_TECH_LIB_CORNER_TYPES> TECH_LIB_CORNER_TYP
|
|||
* TechnologyLibrary tech_lib;
|
||||
* // call your builder for technology library
|
||||
* // Build the internal links for the technology library
|
||||
* tech_lib.link_device_to_variation();
|
||||
* tech_lib.link_model_to_variation();
|
||||
*
|
||||
*******************************************************************/
|
||||
class TechnologyLibrary {
|
||||
public: /* Types */
|
||||
typedef vtr::vector<TechnologyDeviceId, TechnologyDeviceId>::const_iterator technology_device_iterator;
|
||||
typedef vtr::vector<TechnologyModelId, TechnologyModelId>::const_iterator technology_model_iterator;
|
||||
typedef vtr::vector<TechnologyVariationId, TechnologyVariationId>::const_iterator technology_variation_iterator;
|
||||
/* Create range */
|
||||
typedef vtr::Range<technology_device_iterator> technology_device_range;
|
||||
typedef vtr::Range<technology_model_iterator> technology_model_range;
|
||||
typedef vtr::Range<technology_variation_iterator> technology_variation_range;
|
||||
public: /* Constructors */
|
||||
TechnologyLibrary();
|
||||
public: /* Accessors: aggregates */
|
||||
technology_device_range devices() const;
|
||||
technology_model_range models() const;
|
||||
technology_variation_range variations() const;
|
||||
std::vector<TechnologyDeviceId> devices_by_type(const enum e_tech_lib_device_type& type) const;
|
||||
public: /* Public Accessors: Basic data query on devices */
|
||||
std::string device_name(const TechnologyDeviceId& device_id) const;
|
||||
TechnologyDeviceId device(const std::string& name) const;
|
||||
enum e_tech_lib_device_type device_type(const TechnologyDeviceId& device_id) const;
|
||||
enum e_tech_lib_model_type device_model_type(const TechnologyDeviceId& device_id) const;
|
||||
std::string device_corner(const TechnologyDeviceId& device_id) const;
|
||||
std::string device_model_ref(const TechnologyDeviceId& device_id) const;
|
||||
std::string device_lib_path(const TechnologyDeviceId& device_id) const;
|
||||
float device_vdd(const TechnologyDeviceId& device_id) const;
|
||||
float device_pn_ratio(const TechnologyDeviceId& device_id) const;
|
||||
std::vector<TechnologyModelId> models_by_type(const enum e_tech_lib_model_type& type) const;
|
||||
public: /* Public Accessors: Basic data query on models */
|
||||
std::string model_name(const TechnologyModelId& model_id) const;
|
||||
TechnologyModelId model(const std::string& name) const;
|
||||
enum e_tech_lib_model_type model_type(const TechnologyModelId& model_id) const;
|
||||
enum e_tech_lib_type model_lib_type(const TechnologyModelId& model_id) const;
|
||||
std::string model_corner(const TechnologyModelId& model_id) const;
|
||||
std::string model_ref(const TechnologyModelId& model_id) const;
|
||||
std::string model_lib_path(const TechnologyModelId& model_id) const;
|
||||
float model_vdd(const TechnologyModelId& model_id) const;
|
||||
float model_pn_ratio(const TechnologyModelId& model_id) const;
|
||||
public: /* Public Accessors: Basic data query on transistors */
|
||||
std::string transistor_model_name(const TechnologyDeviceId& device_id,
|
||||
const e_tech_lib_trans_type& transistor_type) const;
|
||||
float transistor_model_chan_length(const TechnologyDeviceId& device_id,
|
||||
const e_tech_lib_trans_type& transistor_type) const;
|
||||
float transistor_model_min_width(const TechnologyDeviceId& device_id,
|
||||
const e_tech_lib_trans_type& transistor_type) const;
|
||||
TechnologyVariationId transistor_model_variation(const TechnologyDeviceId& device_id,
|
||||
const e_tech_lib_trans_type& transistor_type) const;
|
||||
public: /* Public Accessors: Basic data query on RRAM devices */
|
||||
float rram_rlrs(const TechnologyDeviceId& device_id) const;
|
||||
float rram_rhrs(const TechnologyDeviceId& device_id) const;
|
||||
TechnologyVariationId rram_variation(const TechnologyDeviceId& device_id) const;
|
||||
std::string transistor_model_name(const TechnologyModelId& model_id,
|
||||
const e_tech_lib_transistor_type& transistor_type) const;
|
||||
float transistor_model_chan_length(const TechnologyModelId& model_id,
|
||||
const e_tech_lib_transistor_type& transistor_type) const;
|
||||
float transistor_model_min_width(const TechnologyModelId& model_id,
|
||||
const e_tech_lib_transistor_type& transistor_type) const;
|
||||
TechnologyVariationId transistor_model_variation(const TechnologyModelId& model_id,
|
||||
const e_tech_lib_transistor_type& transistor_type) const;
|
||||
public: /* Public Accessors: Basic data query on RRAM models */
|
||||
float rram_rlrs(const TechnologyModelId& model_id) const;
|
||||
float rram_rhrs(const TechnologyModelId& model_id) const;
|
||||
TechnologyVariationId rram_variation(const TechnologyModelId& model_id) const;
|
||||
public: /* Public Accessors: Basic data query on variations */
|
||||
std::string variation_name(const TechnologyVariationId& variation_id) const;
|
||||
TechnologyVariationId variation(const std::string& name) const;
|
||||
float variation_abs_value(const TechnologyVariationId& variation_id) const;
|
||||
size_t variation_num_sigma(const TechnologyVariationId& variation_id) const;
|
||||
public: /* Public Mutators: device-related */
|
||||
TechnologyDeviceId add_device(const std::string& name);
|
||||
void set_device_type(const TechnologyDeviceId& device_id,
|
||||
const e_tech_lib_device_type& type);
|
||||
void set_device_model_type(const TechnologyDeviceId& device_id,
|
||||
const e_tech_lib_model_type& model_type);
|
||||
void set_device_corner(const TechnologyDeviceId& device_id,
|
||||
public: /* Public Mutators: model-related */
|
||||
TechnologyModelId add_model(const std::string& name);
|
||||
void set_model_type(const TechnologyModelId& model_id,
|
||||
const e_tech_lib_model_type& type);
|
||||
void set_model_lib_type(const TechnologyModelId& model_id,
|
||||
const e_tech_lib_type& lib_type);
|
||||
void set_model_corner(const TechnologyModelId& model_id,
|
||||
const std::string& corner);
|
||||
void set_device_model_ref(const TechnologyDeviceId& device_id,
|
||||
void set_model_ref(const TechnologyModelId& model_id,
|
||||
const std::string& model_ref);
|
||||
void set_device_lib_path(const TechnologyDeviceId& device_id,
|
||||
void set_model_lib_path(const TechnologyModelId& model_id,
|
||||
const std::string& lib_path);
|
||||
void set_device_vdd(const TechnologyDeviceId& device_id,
|
||||
void set_model_vdd(const TechnologyModelId& model_id,
|
||||
const float& vdd);
|
||||
void set_device_pn_ratio(const TechnologyDeviceId& device_id,
|
||||
void set_model_pn_ratio(const TechnologyModelId& model_id,
|
||||
const float& pn_ratio);
|
||||
public: /* Public Mutators: transistor-related */
|
||||
void set_transistor_model_name(const TechnologyDeviceId& device_id,
|
||||
const e_tech_lib_trans_type& transistor_type,
|
||||
void set_transistor_model_name(const TechnologyModelId& model_id,
|
||||
const e_tech_lib_transistor_type& transistor_type,
|
||||
const std::string& model_name);
|
||||
void set_transistor_model_chan_length(const TechnologyDeviceId& device_id,
|
||||
const e_tech_lib_trans_type& transistor_type,
|
||||
void set_transistor_model_chan_length(const TechnologyModelId& model_id,
|
||||
const e_tech_lib_transistor_type& transistor_type,
|
||||
const float& chan_length);
|
||||
void set_transistor_model_min_width(const TechnologyDeviceId& device_id,
|
||||
const e_tech_lib_trans_type& transistor_type,
|
||||
void set_transistor_model_min_width(const TechnologyModelId& model_id,
|
||||
const e_tech_lib_transistor_type& transistor_type,
|
||||
const float& min_width);
|
||||
void set_transistor_model_variation_name(const TechnologyDeviceId& device_id,
|
||||
const e_tech_lib_trans_type& transistor_type,
|
||||
void set_transistor_model_variation_name(const TechnologyModelId& model_id,
|
||||
const e_tech_lib_transistor_type& transistor_type,
|
||||
const std::string& variation_name);
|
||||
public: /* Public Mutators: RRAM-related */
|
||||
void set_rram_rlrs(const TechnologyDeviceId& device_id,
|
||||
void set_rram_rlrs(const TechnologyModelId& model_id,
|
||||
const float& rlrs);
|
||||
void set_rram_rhrs(const TechnologyDeviceId& device_id,
|
||||
void set_rram_rhrs(const TechnologyModelId& model_id,
|
||||
const float& rhrs);
|
||||
void set_rram_variation_name(const TechnologyDeviceId& device_id,
|
||||
void set_rram_variation_name(const TechnologyModelId& model_id,
|
||||
const std::string& variation_name);
|
||||
public: /* Public Mutators: variation-related */
|
||||
TechnologyVariationId add_variation(const std::string& name);
|
||||
void set_variation_abs_value(const TechnologyVariationId& variation_id, const float& abs_value);
|
||||
void set_variation_num_sigma(const TechnologyVariationId& variation_id, const size_t& num_sigma);
|
||||
public: /* Public Mutators: linkers */
|
||||
void link_devices_to_variations();
|
||||
void link_models_to_variations();
|
||||
public: /* Public invalidators/validators */
|
||||
bool valid_device_id(const TechnologyDeviceId& device_id) const;
|
||||
bool valid_model_id(const TechnologyModelId& model_id) const;
|
||||
bool valid_variation_id(const TechnologyVariationId& variation_id) const;
|
||||
private: /* Internal data */
|
||||
/* Transistor-related fundamental information */
|
||||
/* Unique identifier for each device
|
||||
* A device could be either transistors (1 pair of PMOS and NMOS) or RRAMs
|
||||
/* Unique identifier for each model
|
||||
* A model could be either transistors (1 pair of PMOS and NMOS) or RRAMs
|
||||
*/
|
||||
vtr::vector<TechnologyDeviceId, TechnologyDeviceId> device_ids_;
|
||||
vtr::vector<TechnologyModelId, TechnologyModelId> model_ids_;
|
||||
|
||||
/* Unique name for each device. This is defined by XML file */
|
||||
vtr::vector<TechnologyDeviceId, std::string> device_names_;
|
||||
/* Unique name for each model. This is defined by XML file */
|
||||
vtr::vector<TechnologyModelId, std::string> model_names_;
|
||||
|
||||
/* Type of each device, either transistors or RRAMs */
|
||||
vtr::vector<TechnologyDeviceId, e_tech_lib_device_type> device_types_;
|
||||
/* Type of each model, either transistors or RRAMs */
|
||||
vtr::vector<TechnologyModelId, e_tech_lib_model_type> model_types_;
|
||||
|
||||
/* Type of models of each device, either industry or academia
|
||||
/* Type of models of each model, either industry or academia
|
||||
* This will lead to different ways when include these models
|
||||
* For industry models, we use .lib to include library
|
||||
* For academia models, we use .include to include library
|
||||
*/
|
||||
vtr::vector<TechnologyDeviceId, e_tech_lib_model_type> device_model_types_;
|
||||
vtr::vector<TechnologyModelId, e_tech_lib_type> model_lib_types_;
|
||||
|
||||
/* Name of process corner to be used for each device
|
||||
/* Name of process corner to be used for each model
|
||||
* Users can define any string for the process corner they are going to use
|
||||
* But the corner name should be consistent with their library files
|
||||
* When this is enabled, the corner name will be added when
|
||||
* include the models
|
||||
* For example, for a industry model, .lib <lib_path> <corner_name>
|
||||
*/
|
||||
vtr::vector<TechnologyDeviceId, std::string> device_corners_;
|
||||
vtr::vector<TechnologyModelId, std::string> model_corners_;
|
||||
|
||||
/* The string used to instanciate the device models
|
||||
/* The string used to instanciate the model models
|
||||
* This will really depend on the type of models
|
||||
* For most industry models, we can use 'M' to instanciate a transisitor
|
||||
* For some academia models, we have to use 'X' to do so
|
||||
*/
|
||||
vtr::vector<TechnologyDeviceId, std::string> device_model_refs_;
|
||||
vtr::vector<TechnologyModelId, std::string> model_refs_;
|
||||
|
||||
/* The path to the transistor models
|
||||
* This is going to be the <lib_path> when include the library files
|
||||
* See the example in the comments about process corner
|
||||
*/
|
||||
vtr::vector<TechnologyDeviceId, std::string> device_lib_paths_;
|
||||
vtr::vector<TechnologyModelId, std::string> model_lib_paths_;
|
||||
|
||||
/* Operating voltage for the devices. Unit: [V] */
|
||||
vtr::vector<TechnologyDeviceId, float> device_vdds_;
|
||||
/* Operating voltage for the models. Unit: [V] */
|
||||
vtr::vector<TechnologyModelId, float> model_vdds_;
|
||||
|
||||
/* The width ratio between PMOS and NMOS for a device group
|
||||
/* The width ratio between PMOS and NMOS for a model group
|
||||
* This really depend the transistor technology
|
||||
* We recommend users to characterize driving strengths of
|
||||
* PMOS and NMOS using SPICE simulators
|
||||
*/
|
||||
vtr::vector<TechnologyDeviceId, float> device_pn_ratios_;
|
||||
vtr::vector<TechnologyModelId, float> model_pn_ratios_;
|
||||
|
||||
/* The model name is the name that is defined in your library file.
|
||||
* For example, your NMOS transistor may be defined as
|
||||
|
@ -230,38 +218,39 @@ class TechnologyLibrary {
|
|||
* PMOS data will be stored in the first element of the array
|
||||
* NMOS data will be stored in the second element of the array
|
||||
*/
|
||||
vtr::vector<TechnologyDeviceId, std::array<std::string, 2>> transistor_model_names_;
|
||||
vtr::vector<TechnologyModelId, std::array<std::string, 2>> transistor_model_names_;
|
||||
|
||||
/* The channel length of a transistor.
|
||||
* This should be defined by your technology vendor
|
||||
* For example, a 22nm technology, the channel length is around 22nm
|
||||
*/
|
||||
vtr::vector<TechnologyDeviceId, std::array<float, 2>> transistor_model_chan_lengths_;
|
||||
vtr::vector<TechnologyModelId, std::array<float, 2>> transistor_model_chan_lengths_;
|
||||
|
||||
/* The minimum width of a transistor.
|
||||
* This should be defined by your technology vendor
|
||||
*/
|
||||
vtr::vector<TechnologyDeviceId, std::array<float, 2>> transistor_model_min_widths_;
|
||||
vtr::vector<TechnologyModelId, std::array<float, 2>> transistor_model_min_widths_;
|
||||
|
||||
/* The variation name and id binded to PMOS and NMOS transistor
|
||||
* We expect users to provide the exact name of variation defined in this technology library
|
||||
* the name and id will be automatically matched by using function link_device_to_variation()
|
||||
* the name and id will be automatically matched by using function link_model_to_variation()
|
||||
*/
|
||||
vtr::vector<TechnologyDeviceId, std::array<std::string, 2>> transistor_model_variation_names_;
|
||||
vtr::vector<TechnologyDeviceId, std::array<TechnologyVariationId, 2>> transistor_model_variation_ids_;
|
||||
vtr::vector<TechnologyModelId, std::array<std::string, 2>> transistor_model_variation_names_;
|
||||
vtr::vector<TechnologyModelId, std::array<TechnologyVariationId, 2>> transistor_model_variation_ids_;
|
||||
|
||||
/* ReRAM-related fundamental information:
|
||||
* Low Resistance State (LRS) resistance will be stored in the x() part of vtr::Point
|
||||
* High Resistance State (HRS) resistance will be stored in the y() part of vtr::Point
|
||||
* Unit: [Ohm]
|
||||
*/
|
||||
vtr::vector<TechnologyDeviceId, vtr::Point<float>> rram_resistances_;
|
||||
vtr::vector<TechnologyModelId, vtr::Point<float>> rram_resistances_;
|
||||
|
||||
/* The variation name and id binded to this RRAM
|
||||
* We expect users to provide the exact name of variation defined in this technology library
|
||||
* the name and id will be automatically matched by using function link_device_to_variation()
|
||||
* the name and id will be automatically matched by using function link_model_to_variation()
|
||||
*/
|
||||
vtr::vector<TechnologyDeviceId, std::string> rram_variation_names_;
|
||||
vtr::vector<TechnologyDeviceId, TechnologyVariationId> rram_variation_ids_;
|
||||
vtr::vector<TechnologyModelId, std::string> rram_variation_names_;
|
||||
vtr::vector<TechnologyModelId, TechnologyVariationId> rram_variation_ids_;
|
||||
|
||||
/* Unique identifier for each process variation */
|
||||
vtr::vector<TechnologyVariationId, TechnologyVariationId> variation_ids_;
|
||||
|
@ -275,7 +264,7 @@ class TechnologyLibrary {
|
|||
vtr::vector<TechnologyVariationId, size_t> variation_num_sigmas_;
|
||||
|
||||
/* Fast name-to-id lookup */
|
||||
std::map<std::string, TechnologyDeviceId> device_name2ids_;
|
||||
std::map<std::string, TechnologyModelId> model_name2ids_;
|
||||
std::map<std::string, TechnologyVariationId> variation_name2ids_;
|
||||
};
|
||||
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
|
||||
#include "vtr_strong_id.h"
|
||||
|
||||
struct technology_device_id_tag;
|
||||
struct technology_model_id_tag;
|
||||
struct technology_variation_id_tag;
|
||||
|
||||
typedef vtr::StrongId<technology_device_id_tag> TechnologyDeviceId;
|
||||
typedef vtr::StrongId<technology_model_id_tag> TechnologyModelId;
|
||||
typedef vtr::StrongId<technology_variation_id_tag> TechnologyVariationId;
|
||||
|
||||
/* Short declaration of class */
|
||||
|
|
Loading…
Reference in New Issue