diff options
author | David Shah <davey1576@gmail.com> | 2018-12-20 20:52:54 +0000 |
---|---|---|
committer | David Shah <davey1576@gmail.com> | 2018-12-20 20:52:54 +0000 |
commit | 953a3ac5521c720cd920a0e7e7315c37dfaf3680 (patch) | |
tree | a2812e11a9e74804a504b95330f697d691906861 /ice40/bitstream.cc | |
parent | 580f6fbd213111d2b8b3d5b21b67420c7bfbcba1 (diff) | |
download | nextpnr-953a3ac5521c720cd920a0e7e7315c37dfaf3680.tar.gz nextpnr-953a3ac5521c720cd920a0e7e7315c37dfaf3680.tar.bz2 nextpnr-953a3ac5521c720cd920a0e7e7315c37dfaf3680.zip |
ice40: Add PCF support for -pullup, -pullup_resistor and -nowarn
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'ice40/bitstream.cc')
-rw-r--r-- | ice40/bitstream.cc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/ice40/bitstream.cc b/ice40/bitstream.cc index d1f51676..141c218b 100644 --- a/ice40/bitstream.cc +++ b/ice40/bitstream.cc @@ -527,10 +527,23 @@ void write_asc(const Context *ctx, std::ostream &out) } if (ctx->args.type == ArchArgs::UP5K) { + std::string pullup_resistor = "100K"; + if (cell.second->attrs.count(ctx->id("PULLUP_RESISTOR"))) + pullup_resistor = cell.second->attrs.at(ctx->id("PULLUP_RESISTOR")); + NPNR_ASSERT(pullup_resistor == "100K" || pullup_resistor == "10K" || pullup_resistor == "6P8K" || + pullup_resistor == "3P3K"); if (iez == 0) { - set_config(ti, config.at(iey).at(iex), "IoCtrl.cf_bit_39", !pullup); + set_config(ti, config.at(iey).at(iex), "IoCtrl.cf_bit_39", + (!pullup) || (pullup_resistor != "100K")); + set_config(ti, config.at(iey).at(iex), "IoCtrl.cf_bit_36", pullup && pullup_resistor == "3P3K"); + set_config(ti, config.at(iey).at(iex), "IoCtrl.cf_bit_37", pullup && pullup_resistor == "6P8K"); + set_config(ti, config.at(iey).at(iex), "IoCtrl.cf_bit_38", pullup && pullup_resistor == "10K"); } else if (iez == 1) { - set_config(ti, config.at(iey).at(iex), "IoCtrl.cf_bit_35", !pullup); + set_config(ti, config.at(iey).at(iex), "IoCtrl.cf_bit_35", + (!pullup) || (pullup_resistor != "100K")); + set_config(ti, config.at(iey).at(iex), "IoCtrl.cf_bit_32", pullup && pullup_resistor == "3P3K"); + set_config(ti, config.at(iey).at(iex), "IoCtrl.cf_bit_33", pullup && pullup_resistor == "6P8K"); + set_config(ti, config.at(iey).at(iex), "IoCtrl.cf_bit_34", pullup && pullup_resistor == "10K"); } } } else { |