aboutsummaryrefslogtreecommitdiffstats
path: root/ice40/pack.cc
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2018-11-18 16:11:40 +0100
committerSylvain Munaut <tnt@246tNt.com>2018-11-19 18:20:20 +0100
commitad23caef33ed768f1e11b29e3c4c10edabd1c836 (patch)
treec442693f9747e6aa1e32208a0b7ac1153a6d75f3 /ice40/pack.cc
parent78f3c2c37dbb007830704c5038c524991d171381 (diff)
downloadnextpnr-ad23caef33ed768f1e11b29e3c4c10edabd1c836.tar.gz
nextpnr-ad23caef33ed768f1e11b29e3c4c10edabd1c836.tar.bz2
nextpnr-ad23caef33ed768f1e11b29e3c4c10edabd1c836.zip
ice40/pll: Add proper support for PLLOUT_SELECT_xxx attributes
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'ice40/pack.cc')
-rw-r--r--ice40/pack.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/ice40/pack.cc b/ice40/pack.cc
index ece352a7..d689fa69 100644
--- a/ice40/pack.cc
+++ b/ice40/pack.cc
@@ -733,6 +733,24 @@ static void pack_special(Context *ctx)
for (auto param : ci->params)
packed->params[param.first] = param.second;
+ const std::map<IdString, IdString> pos_map_name = {
+ {ctx->id("PLLOUT_SELECT"), ctx->id("PLLOUT_SELECT_A")},
+ {ctx->id("PLLOUT_SELECT_PORTA"), ctx->id("PLLOUT_SELECT_A")},
+ {ctx->id("PLLOUT_SELECT_PORTB"), ctx->id("PLLOUT_SELECT_B")},
+ };
+ const std::map<std::string, int> pos_map_val = {
+ {"GENCLK", 0},
+ {"GENCLK_HALF", 1},
+ {"SHIFTREG_90deg", 2},
+ {"SHIFTREG_0deg", 3},
+ };
+ for (auto param : ci->params)
+ if (pos_map_name.find(param.first) != pos_map_name.end()) {
+ if (pos_map_val.find(param.second) == pos_map_val.end())
+ log_error("Invalid PLL output selection '%s'\n", param.second.c_str());
+ packed->params[pos_map_name.at(param.first)] = std::to_string(pos_map_val.at(param.second));
+ }
+
auto feedback_path = packed->params[ctx->id("FEEDBACK_PATH")];
packed->params[ctx->id("FEEDBACK_PATH")] =
feedback_path == "DELAY"