nexus: handle SLEWRATE in pdc

This commit is contained in:
Karol Gugala 2021-12-20 14:33:29 +01:00
parent 62a3e09385
commit 500fa6f442
3 changed files with 10 additions and 2 deletions

View File

@ -109,6 +109,7 @@ X(CIB_T)
X(CIB_LR) X(CIB_LR)
X(IO_TYPE) X(IO_TYPE)
X(SLEWRATE)
X(OSCA) X(OSCA)

View File

@ -433,7 +433,7 @@ struct NexusFasmWriter
write_bit(stringf("BASE_TYPE.%s_%s", iodir, str_or_default(cell->attrs, id_IO_TYPE, "LVCMOS33").c_str())); write_bit(stringf("BASE_TYPE.%s_%s", iodir, str_or_default(cell->attrs, id_IO_TYPE, "LVCMOS33").c_str()));
write_ioattr(cell, "PULLMODE", "NONE"); write_ioattr(cell, "PULLMODE", "NONE");
write_ioattr(cell, "GLITCHFILTER", "OFF"); write_ioattr(cell, "GLITCHFILTER", "OFF");
write_ioattr(cell, "SLEWRATE", "MED"); write_ioattr(cell, "SLEWRATE", str_or_default(cell->attrs, id_SLEWRATE, "MED").c_str());
write_cell_muxes(cell); write_cell_muxes(cell);
pop(); pop();
} }
@ -458,7 +458,7 @@ struct NexusFasmWriter
const char *iodir = is_input ? "INPUT" : (is_output ? "OUTPUT" : "BIDIR"); const char *iodir = is_input ? "INPUT" : (is_output ? "OUTPUT" : "BIDIR");
write_bit(stringf("BASE_TYPE.%s_%s", iodir, str_or_default(cell->attrs, id_IO_TYPE, "LVCMOS18H").c_str())); write_bit(stringf("BASE_TYPE.%s_%s", iodir, str_or_default(cell->attrs, id_IO_TYPE, "LVCMOS18H").c_str()));
write_ioattr(cell, "PULLMODE", "NONE"); write_ioattr(cell, "PULLMODE", "NONE");
write_ioattr(cell, "SLEWRATE", "MED"); write_ioattr(cell, "SLEWRATE", str_or_default(cell->attrs, id_SLEWRATE, "MED").c_str());
pop(); pop();
write_cell_muxes(cell); write_cell_muxes(cell);
pop(); pop();

View File

@ -21,6 +21,7 @@
#include "log.h" #include "log.h"
#include "nextpnr.h" #include "nextpnr.h"
#include <algorithm>
#include <iterator> #include <iterator>
NEXTPNR_NAMESPACE_BEGIN NEXTPNR_NAMESPACE_BEGIN
@ -423,6 +424,12 @@ struct PDCParser
if (eqp == std::string::npos) if (eqp == std::string::npos)
log_error("expected key-value pair separated by '=' (line %d)", lineno); log_error("expected key-value pair separated by '=' (line %d)", lineno);
std::string k = kv.substr(0, eqp), v = kv.substr(eqp + 1); std::string k = kv.substr(0, eqp), v = kv.substr(eqp + 1);
if (k == "SLEWRATE") {
std::vector<std::string> slewrate_allowed = {"SLOW", "MED", "FAST", "NA"};
if (std::find(std::begin(slewrate_allowed), std::end(slewrate_allowed), v) ==
std::end(slewrate_allowed))
log_error("unexpected SLEWRATE configuration %s (line %d)\n", v.c_str(), lineno);
}
args[ctx->id(k)] = v; args[ctx->id(k)] = v;
} }
} else { } else {