aboutsummaryrefslogtreecommitdiffstats
path: root/passes
diff options
context:
space:
mode:
authorIcenowy Zheng <icenowy@aosc.io>2018-12-18 15:37:43 +0800
committerIcenowy Zheng <icenowy@aosc.io>2018-12-18 15:37:43 +0800
commitfec8b3c81ffcf1f8a27e79250c05b6ea91571bbe (patch)
tree8a1f7af4638ae16e8812dfe93b8935ebc264ba7f /passes
parent847fd360773d72933f1c728dba0755e0033350a6 (diff)
downloadyosys-fec8b3c81ffcf1f8a27e79250c05b6ea91571bbe.tar.gz
yosys-fec8b3c81ffcf1f8a27e79250c05b6ea91571bbe.tar.bz2
yosys-fec8b3c81ffcf1f8a27e79250c05b6ea91571bbe.zip
Add "dffinit -strinit high low"
On some platforms the string to initialize DFF might not be "high" and "low", e.g. with Anlogic TD it's "SET" and "RESET". Add a "-strinit" parameter for dffinit to allow specify the strings used for high and low. Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Diffstat (limited to 'passes')
-rw-r--r--passes/techmap/dffinit.cc18
1 files changed, 16 insertions, 2 deletions
diff --git a/passes/techmap/dffinit.cc b/passes/techmap/dffinit.cc
index a8eecc970..4fa15a35b 100644
--- a/passes/techmap/dffinit.cc
+++ b/passes/techmap/dffinit.cc
@@ -43,6 +43,11 @@ struct DffinitPass : public Pass {
log(" initial value of 1 or 0. (multi-bit values are not supported in this\n");
log(" mode.)\n");
log("\n");
+ log(" -strinit <string for high> <string for low> \n");
+ log(" use string values in the command line to represent a single-bit\n");
+ log(" initial value of 1 or 0. (multi-bit values are not supported in this\n");
+ log(" mode.)\n");
+ log("\n");
}
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
{
@@ -50,11 +55,20 @@ struct DffinitPass : public Pass {
dict<IdString, dict<IdString, IdString>> ff_types;
bool highlow_mode = false;
+ std::string high_string, low_string;
size_t argidx;
for (argidx = 1; argidx < args.size(); argidx++) {
if (args[argidx] == "-highlow") {
highlow_mode = true;
+ high_string = "high";
+ low_string = "low";
+ continue;
+ }
+ if (args[argidx] == "-strinit" && argidx+2 < args.size()) {
+ highlow_mode = true;
+ high_string = args[++argidx];
+ low_string = args[++argidx];
continue;
}
if (args[argidx] == "-ff" && argidx+3 < args.size()) {
@@ -121,9 +135,9 @@ struct DffinitPass : public Pass {
log_error("Multi-bit init value for %s.%s.%s is incompatible with -highlow mode.\n",
log_id(module), log_id(cell), log_id(it.second));
if (value[0] == State::S1)
- value = Const("high");
+ value = Const(high_string);
else
- value = Const("low");
+ value = Const(low_string);
}
log("Setting %s.%s.%s (port=%s, net=%s) to %s.\n", log_id(module), log_id(cell), log_id(it.second),