aboutsummaryrefslogtreecommitdiffstats
path: root/mistral/io.cc
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2021-05-08 11:00:58 +0100
committergatecat <gatecat@ds0.me>2021-05-15 14:54:33 +0100
commit879ac39e53c76558766460cfa948d97227119f37 (patch)
treeed6955d396152ab47b9e54550279afecba8784c9 /mistral/io.cc
parent29386822955f072e6472ae4ab42e2bd16858e3c5 (diff)
downloadnextpnr-879ac39e53c76558766460cfa948d97227119f37.tar.gz
nextpnr-879ac39e53c76558766460cfa948d97227119f37.tar.bz2
nextpnr-879ac39e53c76558766460cfa948d97227119f37.zip
mistral: Renamed arch from cyclonev
Signed-off-by: gatecat <gatecat@ds0.me>
Diffstat (limited to 'mistral/io.cc')
-rw-r--r--mistral/io.cc53
1 files changed, 53 insertions, 0 deletions
diff --git a/mistral/io.cc b/mistral/io.cc
new file mode 100644
index 00000000..f2517e5d
--- /dev/null
+++ b/mistral/io.cc
@@ -0,0 +1,53 @@
+/*
+ * nextpnr -- Next Generation Place and Route
+ *
+ * Copyright (C) 2021 gatecat <gatecat@ds0.me>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#include "log.h"
+#include "nextpnr.h"
+#include "util.h"
+
+NEXTPNR_NAMESPACE_BEGIN
+
+void Arch::create_gpio(int x, int y)
+{
+ for (int z = 0; z < 4; z++) {
+ // Notional pad wire
+ WireId pad = add_wire(x, y, id(stringf("PAD[%d]", z)));
+ BelId bel = add_bel(x, y, id(stringf("IO[%d]", z)), id_MISTRAL_IO);
+ add_bel_pin(bel, id_PAD, PORT_INOUT, pad);
+ // FIXME: is the port index of zero always correct?
+ add_bel_pin(bel, id_I, PORT_IN, get_port(CycloneV::GPIO, x, y, z, CycloneV::DATAIN, 0));
+ add_bel_pin(bel, id_OE, PORT_IN, get_port(CycloneV::GPIO, x, y, z, CycloneV::OEIN, 0));
+ add_bel_pin(bel, id_O, PORT_OUT, get_port(CycloneV::GPIO, x, y, z, CycloneV::DATAOUT, 0));
+ }
+}
+
+bool Arch::is_io_cell(IdString cell_type) const
+{
+ // Return true if a cell is an IO buffer cell type
+ switch (cell_type.index) {
+ case ID_MISTRAL_IB:
+ case ID_MISTRAL_OB:
+ case ID_MISTRAL_IO:
+ return true;
+ default:
+ return false;
+ }
+}
+
+NEXTPNR_NAMESPACE_END \ No newline at end of file