diff --git a/nexus/constids.inc b/nexus/constids.inc index 48b0ca2b..ca6bed5a 100644 --- a/nexus/constids.inc +++ b/nexus/constids.inc @@ -109,6 +109,7 @@ X(CIB_T) X(CIB_LR) X(IO_TYPE) +X(SLEWRATE) X(OSCA) diff --git a/nexus/fasm.cc b/nexus/fasm.cc index bb0a7941..4aaecdf4 100644 --- a/nexus/fasm.cc +++ b/nexus/fasm.cc @@ -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_ioattr(cell, "PULLMODE", "NONE"); 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); pop(); } @@ -458,7 +458,7 @@ struct NexusFasmWriter 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_ioattr(cell, "PULLMODE", "NONE"); - write_ioattr(cell, "SLEWRATE", "MED"); + write_ioattr(cell, "SLEWRATE", str_or_default(cell->attrs, id_SLEWRATE, "MED").c_str()); pop(); write_cell_muxes(cell); pop(); diff --git a/nexus/pdc.cc b/nexus/pdc.cc index 67bab3c9..af622158 100644 --- a/nexus/pdc.cc +++ b/nexus/pdc.cc @@ -21,6 +21,7 @@ #include "log.h" #include "nextpnr.h" +#include #include NEXTPNR_NAMESPACE_BEGIN @@ -423,6 +424,12 @@ struct PDCParser if (eqp == std::string::npos) log_error("expected key-value pair separated by '=' (line %d)", lineno); std::string k = kv.substr(0, eqp), v = kv.substr(eqp + 1); + if (k == "SLEWRATE") { + std::vector 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; } } else {