diff options
author | David Shah <davey1576@gmail.com> | 2019-02-22 11:46:43 +0000 |
---|---|---|
committer | David Shah <davey1576@gmail.com> | 2019-02-24 10:28:25 +0100 |
commit | 0bc88e622cd1819d8ec1624c8a4c98a6ee1dc47f (patch) | |
tree | 0994c075019d56fd3c2d7c30c53e4303f9a6736f | |
parent | ae6c1170ef485d600d58a87101f78bd97f3f47b4 (diff) | |
download | nextpnr-0bc88e622cd1819d8ec1624c8a4c98a6ee1dc47f.tar.gz nextpnr-0bc88e622cd1819d8ec1624c8a4c98a6ee1dc47f.tar.bz2 nextpnr-0bc88e622cd1819d8ec1624c8a4c98a6ee1dc47f.zip |
ecp5: Add support for 'FREQUENCY NET' and 'FREQUENCY PORT' in lpf
Signed-off-by: David Shah <davey1576@gmail.com>
-rw-r--r-- | ecp5/lpf.cc | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/ecp5/lpf.cc b/ecp5/lpf.cc index 4bde660e..df3687cf 100644 --- a/ecp5/lpf.cc +++ b/ecp5/lpf.cc @@ -60,8 +60,31 @@ bool Arch::applyLPF(std::string filename, std::istream &in) words.push_back(tmp); if (words.size() >= 0) { std::string verb = words.at(0); - if (verb == "BLOCK" || verb == "SYSCONFIG" || verb == "FREQUENCY") { + if (verb == "BLOCK" || verb == "SYSCONFIG") { log_warning(" ignoring unsupported LPF command '%s'\n", command.c_str()); + } else if (verb == "FREQUENCY") { + std::string etype = words.at(1); + if (etype == "PORT" || etype == "NET") { + std::string target = words.at(2); + if (target.at(0) == '\"') { + NPNR_ASSERT(target.back() == '\"'); + target = target.substr(1, target.length() - 2); + } + float freq = std::stof(words.at(3)); + std::string unit = words.at(4); + if (unit == "MHz") + ; + else if (unit == "kHz") + freq /= 1.0e3; + else if (unit == "Hz") + freq /= 1.0e6; + else + log_error("unsupported frequency unit '%s'\n", unit.c_str()); + addClock(id(target), freq); + } else { + log_warning(" ignoring unsupported LPF command '%s %s'\n", command.c_str(), + etype.c_str()); + } } else if (verb == "LOCATE") { NPNR_ASSERT(words.at(1) == "COMP"); std::string cell = strip_quotes(words.at(2)); |