aboutsummaryrefslogtreecommitdiffstats
path: root/ice40/pack.cc
diff options
context:
space:
mode:
authorD. Shah <dave@ds0.me>2021-01-27 18:34:41 +0000
committerD. Shah <dave@ds0.me>2021-01-27 18:35:49 +0000
commitc10238de8c6087282ff1d6092929585277cbd17c (patch)
tree0134a98527433c3aef4b626661466656f70678ea /ice40/pack.cc
parente049d5f2fc126a7157d0c33a36f094332da7bace (diff)
downloadnextpnr-c10238de8c6087282ff1d6092929585277cbd17c.tar.gz
nextpnr-c10238de8c6087282ff1d6092929585277cbd17c.tar.bz2
nextpnr-c10238de8c6087282ff1d6092929585277cbd17c.zip
ice40: Switch from RelPtr to RelSlice
This replaces RelPtrs and a separate length field with a Rust-style slice containing both a pointer and a length; with bounds checking always enforced. Thus iterating over these structures is both cleaner and safer. Signed-off-by: D. Shah <dave@ds0.me>
Diffstat (limited to 'ice40/pack.cc')
-rw-r--r--ice40/pack.cc13
1 files changed, 5 insertions, 8 deletions
diff --git a/ice40/pack.cc b/ice40/pack.cc
index 9eb7d7c1..bac8e170 100644
--- a/ice40/pack.cc
+++ b/ice40/pack.cc
@@ -1357,14 +1357,11 @@ void pack_plls(Context *ctx)
auto feedback_path = packed->params[ctx->id("FEEDBACK_PATH")].is_string
? packed->params[ctx->id("FEEDBACK_PATH")].as_string()
: std::to_string(packed->params[ctx->id("FEEDBACK_PATH")].as_int64());
- std::string fbp_value =
- feedback_path == "DELAY"
- ? "0"
- : feedback_path == "SIMPLE"
- ? "1"
- : feedback_path == "PHASE_AND_DELAY"
- ? "2"
- : feedback_path == "EXTERNAL" ? "6" : std::string(feedback_path);
+ std::string fbp_value = feedback_path == "DELAY" ? "0"
+ : feedback_path == "SIMPLE" ? "1"
+ : feedback_path == "PHASE_AND_DELAY" ? "2"
+ : feedback_path == "EXTERNAL" ? "6"
+ : std::string(feedback_path);
if (!std::all_of(fbp_value.begin(), fbp_value.end(), isdigit))
log_error("PLL '%s' has unsupported FEEDBACK_PATH value '%s'\n", ci->name.c_str(ctx),
feedback_path.c_str());