aboutsummaryrefslogtreecommitdiffstats
path: root/ecp5/lpf.cc
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2020-07-12 12:53:16 +0100
committerDavid Shah <dave@ds0.me>2020-07-12 12:53:16 +0100
commit6016e54d6c2e658a046dfffb2a9fecf9adfa4f36 (patch)
treea0689c03c337654f0d6dd426c5ec48d3562f472e /ecp5/lpf.cc
parent3cafb16aa634d2bc369077d8d36760d23973a35b (diff)
downloadnextpnr-6016e54d6c2e658a046dfffb2a9fecf9adfa4f36.tar.gz
nextpnr-6016e54d6c2e658a046dfffb2a9fecf9adfa4f36.tar.bz2
nextpnr-6016e54d6c2e658a046dfffb2a9fecf9adfa4f36.zip
ecp5: Add parsing of SYSCONFIG line in LPF
Signed-off-by: David Shah <dave@ds0.me>
Diffstat (limited to 'ecp5/lpf.cc')
-rw-r--r--ecp5/lpf.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/ecp5/lpf.cc b/ecp5/lpf.cc
index e740b737..18c81237 100644
--- a/ecp5/lpf.cc
+++ b/ecp5/lpf.cc
@@ -23,6 +23,14 @@
NEXTPNR_NAMESPACE_BEGIN
+static const std::unordered_set<std::string> sysconfig_keys = {
+ "SLAVE_SPI_PORT", "MASTER_SPI_PORT", "SLAVE_PARALLEL_PORT",
+ "BACKGROUND_RECONFIG", "DONE_EX", "DONE_OD",
+ "DONE_PULL", "MCCLK_FREQ", "TRANSFR",
+ "CONFIG_IOVOLTAGE", "CONFIG_SECURE", "WAKE_UP",
+ "COMPRESS_CONFIG", "CONFIG_MODE", "INBUF",
+};
+
bool Arch::applyLPF(std::string filename, std::istream &in)
{
auto isempty = [](const std::string &str) {
@@ -66,10 +74,21 @@ 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") {
+ if (verb == "BLOCK") {
if (words.size() != 2 || (words.at(1) != "ASYNCPATHS" && words.at(1) != "RESETPATHS"))
log_warning(" ignoring unsupported LPF command '%s' (on line %d)\n", command.c_str(),
lineno);
+ } else if (verb == "SYSCONFIG") {
+ for (size_t i = 1; i < words.size(); i++) {
+ std::string setting = words.at(i);
+ size_t eqpos = setting.find('=');
+ if (eqpos == std::string::npos)
+ log_error("expected syntax 'SYSCONFIG <attr>=<value>...' (on line %d)\n", lineno);
+ std::string key = setting.substr(0, eqpos), value = setting.substr(eqpos + 1);
+ if (!sysconfig_keys.count(key))
+ log_error("unexpected SYSCONFIG key '%s' (on line %d)\n", key.c_str(), lineno);
+ settings[id("arch.sysconfig." + key)] = value;
+ }
} else if (verb == "FREQUENCY") {
if (words.size() < 2)
log_error("expected object type after FREQUENCY (on line %d)\n", lineno);