aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorN. Engelhardt <nak@symbioticeda.com>2020-01-28 17:24:54 +0100
committerGitHub <noreply@github.com>2020-01-28 17:24:54 +0100
commit086c133ea58179b1b1a14bff972355c68f926e8d (patch)
tree7b0c1b159931be87b14147434685af7627a0690e
parent409e5324333d881dadd64fa211b9a6aa86ce36e9 (diff)
parentdd7d2d8db615f7d54d9bbee257fad9fb11bdc9f8 (diff)
downloadyosys-086c133ea58179b1b1a14bff972355c68f926e8d.tar.gz
yosys-086c133ea58179b1b1a14bff972355c68f926e8d.tar.bz2
yosys-086c133ea58179b1b1a14bff972355c68f926e8d.zip
Merge pull request #1573 from YosysHQ/eddie/xilinx_tristate
synth_xilinx: error out if tristate without '-iopad'
-rw-r--r--passes/techmap/tribuf.cc6
-rw-r--r--techlibs/xilinx/synth_xilinx.cc3
-rw-r--r--tests/arch/xilinx/tribuf.sh5
3 files changed, 13 insertions, 1 deletions
diff --git a/passes/techmap/tribuf.cc b/passes/techmap/tribuf.cc
index 41fdc8f3d..decf9a202 100644
--- a/passes/techmap/tribuf.cc
+++ b/passes/techmap/tribuf.cc
@@ -86,6 +86,7 @@ struct TribufWorker {
cell->unsetPort(ID(S));
cell->type = tri_type;
tribuf_cells[sigmap(cell->getPort(ID::Y))].push_back(cell);
+ module->design->scratchpad_set_bool("tribuf.added_something", true);
continue;
}
@@ -95,6 +96,7 @@ struct TribufWorker {
cell->unsetPort(ID(S));
cell->type = tri_type;
tribuf_cells[sigmap(cell->getPort(ID::Y))].push_back(cell);
+ module->design->scratchpad_set_bool("tribuf.added_something", true);
continue;
}
}
@@ -130,8 +132,10 @@ struct TribufWorker {
if (no_tribuf)
module->connect(it.first, muxout);
- else
+ else {
module->addTribuf(NEW_ID, muxout, module->ReduceOr(NEW_ID, pmux_s), it.first);
+ module->design->scratchpad_set_bool("tribuf.added_something", true);
+ }
}
}
}
diff --git a/techlibs/xilinx/synth_xilinx.cc b/techlibs/xilinx/synth_xilinx.cc
index 5c3b5179d..5ba8c0e10 100644
--- a/techlibs/xilinx/synth_xilinx.cc
+++ b/techlibs/xilinx/synth_xilinx.cc
@@ -316,7 +316,10 @@ struct SynthXilinxPass : public ScriptPass
run("proc");
if (flatten || help_mode)
run("flatten", "(with '-flatten')");
+ active_design->scratchpad_unset("tribuf.added_something");
run("tribuf -logic");
+ if (!do_iopad && active_design->scratchpad_get_bool("tribuf.added_something"))
+ log_error("Tristate buffers are unsupported without the '-iopad' option.\n");
run("deminout");
run("opt_expr");
run("opt_clean");
diff --git a/tests/arch/xilinx/tribuf.sh b/tests/arch/xilinx/tribuf.sh
new file mode 100644
index 000000000..636aed12a
--- /dev/null
+++ b/tests/arch/xilinx/tribuf.sh
@@ -0,0 +1,5 @@
+! ../../../yosys ../common/tribuf.v -qp "synth_xilinx"
+../../../yosys ../common/tribuf.v -qp "synth_xilinx -iopad; \
+select -assert-count 2 t:IBUF; \
+select -assert-count 1 t:INV; \
+select -assert-count 1 t:OBUFT"