Skip to content

Commit

Permalink
More detail in root bank clkmux resource
Browse files Browse the repository at this point in the history
  • Loading branch information
chungshien-chai committed Aug 27, 2024
1 parent 88549d2 commit d68685e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 19 deletions.
11 changes: 9 additions & 2 deletions src/Configuration/ModelConfig/ModelConfig_IO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1101,8 +1101,15 @@ void ModelConfig_IO::allocate_and_set_root_bank_routing() {
POST_DEBUG_MSG(2, "%s %s", module.c_str(), name.c_str());
std::string src_location = get_location(name);
PIN_INFO src_pin_info = get_pin_info(src_location);
std::pair<bool, std::string> status =
m_resource->use_root_bank_clkmux(name, src_location, src_pin_info);
std::string sub_resource = "CORE";
if (module == "I_SERDES" && instance["parameters"].contains("DPA_MODE")) {
if (instance["parameters"]["DPA_MODE"] == "DPA" ||
instance["parameters"]["DPA_MODE"] == "CDR") {
sub_resource = "CDR";
}
}
std::pair<bool, std::string> status = m_resource->use_root_bank_clkmux(
name, src_location, sub_resource, src_pin_info);
if (status.first) {
POST_DEBUG_MSG(3, "Resource: %s", status.second.c_str());
// Set ROOT_BANK_CLKMUX
Expand Down
18 changes: 9 additions & 9 deletions src/Configuration/ModelConfig/ModelConfig_IO_resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,19 +189,19 @@ bool ModelConfig_IO_RESOURCE::use_resource(const std::string& resource,
*/
std::pair<bool, std::string> ModelConfig_IO_RESOURCE::use_root_bank_clkmux(
const std::string& module, const std::string& location,
PIN_INFO& pin_info) {
const std::string& sub_resource, PIN_INFO& pin_info) {
CFG_ASSERT(sub_resource == "CORE" || sub_resource == "CDR");
std::string resource = CFG_print(
"%s(%s)", pin_info.root_bank_mux_resource.c_str(), sub_resource.c_str());
std::pair<bool, std::string> status;
if (m_root_bank_clkmuxes.find(pin_info.root_bank_mux_resource) !=
m_root_bank_clkmuxes.end()) {
if (m_root_bank_clkmuxes.find(resource) != m_root_bank_clkmuxes.end()) {
status = std::make_pair(
false,
CFG_print(
"%s is already used by %s", pin_info.root_bank_mux_resource.c_str(),
m_root_bank_clkmuxes.at(pin_info.root_bank_mux_resource).c_str()));
false, CFG_print("%s is already used by %s", resource.c_str(),
m_root_bank_clkmuxes.at(resource).c_str()));
} else {
m_root_bank_clkmuxes[pin_info.root_bank_mux_resource] =
m_root_bank_clkmuxes[resource] =
CFG_print("module %s (location: %s)", module.c_str(), location.c_str());
status = std::make_pair(true, pin_info.root_bank_mux_resource);
status = std::make_pair(true, resource);
}
return status;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Configuration/ModelConfig/ModelConfig_IO_resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ struct ModelConfig_IO_RESOURCE {
const std::string& type);
bool use_resource(const std::string& resource,
const std::string& instantiator, const std::string& name);
std::pair<bool, std::string> use_root_bank_clkmux(const std::string& module,
const std::string& location,
PIN_INFO& pin_info);
std::pair<bool, std::string> use_root_bank_clkmux(
const std::string& module, const std::string& location,
const std::string& sub_resource, PIN_INFO& pin_info);
// Fail-safe mechanism
void backup();
void restore();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@
" Warning: Not able to route clock-capable pin clk_buf40 (location:HR_2_CC_38_19P) to gearbox module o_serdes_clk clock (module:O_SERDES_CLK) (location:HR_2_8_4P). Reason: Attemp to use FCLK: hvl_fclk_1_A, but it had been used by PLL:HR_1_CC_38_19P",
"Allocate ROOT BANK routing resource (and set configuration attributes)",
" CLK_BUF clk_buf00",
" Resource: u_GBOX_HP_40X2.u_gbox_root_bank_clkmux_0 (Bank A)",
" Resource: u_GBOX_HP_40X2.u_gbox_root_bank_clkmux_0 (Bank A)(CORE)",
" CLK_BUF $clkbuf$top.$ibuf_clk20",
" Resource: u_GBOX_HP_40X2.u_gbox_root_bank_clkmux_0 (Bank B)",
" Resource: u_GBOX_HP_40X2.u_gbox_root_bank_clkmux_0 (Bank B)(CORE)",
"Set CLKBUF remaining configuration attributes (FCLK)",
" Set FCLK configuration attributes",
" CLKBUF clk_buf00 (location:HP_1_CC_18_9P) use hp_fclk_0_B",
Expand Down
6 changes: 3 additions & 3 deletions tests/unittest/ModelConfig/golden/model_config.ppdb.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@
" CLKBUF $clkbuf$top.$ibuf_clk2 (location:HR_5_CC_38_19P)",
"Allocate ROOT BANK routing resource (and set configuration attributes)",
" CLK_BUF $clkbuf$top.$ibuf_clk0",
" Resource: u_GBOX_HV_40X2_VL.u_gbox_root_bank_clkmux_0 (Bank B)",
" Resource: u_GBOX_HV_40X2_VL.u_gbox_root_bank_clkmux_0 (Bank B)(CORE)",
" CLK_BUF $clkbuf$top.$ibuf_clk2",
" Resource: u_GBOX_HV_40X2_VR.u_gbox_root_bank_clkmux_1 (Bank B)",
" Resource: u_GBOX_HV_40X2_VR.u_gbox_root_bank_clkmux_1 (Bank B)(CORE)",
" I_SERDES i_serdes",
" Resource: u_GBOX_HV_40X2_VL.u_gbox_root_bank_clkmux_1 (Bank A)",
" Resource: u_GBOX_HV_40X2_VL.u_gbox_root_bank_clkmux_1 (Bank A)(CDR)",
"Set CLKBUF remaining configuration attributes (FCLK)",
" Set FCLK configuration attributes",
" CLKBUF $clkbuf$top.$ibuf_clk0 (location:HR_1_CC_38_19P) use hvl_fclk_0_A",
Expand Down

0 comments on commit d68685e

Please sign in to comment.