From 9fd85e4fada83a2e909c6919088a171b99a93982 Mon Sep 17 00:00:00 2001 From: Pepijn de Vos Date: Thu, 19 Nov 2020 12:02:36 +0100 Subject: [PATCH] add IOB --- gowin/arch.cc | 50 +++++++++++++++++++++++++++++++++++++++++++--- gowin/constids.inc | 18 ++++++++++++++++- 2 files changed, 64 insertions(+), 4 deletions(-) diff --git a/gowin/arch.cc b/gowin/arch.cc index da3fa605..36652d23 100644 --- a/gowin/arch.cc +++ b/gowin/arch.cc @@ -305,10 +305,20 @@ IdString Arch::wireToGlobal(int row, int col, const DatabasePOD* db, IdString wi return id(buf); } +PairPOD pairLookup(const PairPOD* list, const size_t len, const int src, const int dest) { + for(size_t i=0; i(bel->type_id)) @@ -405,8 +416,41 @@ Arch::Arch(ArchArgs args) : args(args) wirename = id(buf); addBelOutput(belname, id_Q, wirename); } - break; + case ID_IOBJ: + z++; + case ID_IOBI: + z++; + case ID_IOBH: + z++; + case ID_IOBG: + z++; + case ID_IOBF: + z++; + case ID_IOBE: + z++; + case ID_IOBD: + z++; + case ID_IOBC: + z++; + case ID_IOBB: + z++; + case ID_IOBA: + snprintf(buf, 32, "R%dC%d_IOB%c", row+1, col+1, 'A'+z); + belname = id(buf); + addBel(belname, id_IOB, Loc(col, row, z), false); + portname = pairLookup(bel->ports.get(), bel->num_ports, -1, ID_I).src_id; + snprintf(buf, 32, "R%dC%d_%s", row+1, col+1, portname.c_str(this)); + wirename = id(buf); + addBelInput(belname, id_I, wirename); + portname = pairLookup(bel->ports.get(), bel->num_ports, -1, ID_O).src_id; + snprintf(buf, 32, "R%dC%d_%s", row+1, col+1, portname.c_str(this)); + wirename = id(buf); + addBelInput(belname, id_O, wirename); + portname = pairLookup(bel->ports.get(), bel->num_ports, -1, ID_OE).src_id; + snprintf(buf, 32, "R%dC%d_%s", row+1, col+1, portname.c_str(this)); + wirename = id(buf); + addBelInput(belname, id_OE, wirename); default: break; diff --git a/gowin/constids.inc b/gowin/constids.inc index 0bc04489..adf52ead 100644 --- a/gowin/constids.inc +++ b/gowin/constids.inc @@ -324,6 +324,11 @@ X(A) X(B) X(C) X(D) +// iob items +X(IOB) +X(I) +X(O) +X(OE) // bels X(DFF0) X(DFF1) @@ -339,4 +344,15 @@ X(LUT3) X(LUT4) X(LUT5) X(LUT6) -X(LUT7) \ No newline at end of file +X(LUT7) + +X(IOBA) +X(IOBB) +X(IOBC) +X(IOBD) +X(IOBE) +X(IOBF) +X(IOBG) +X(IOBH) +X(IOBI) +X(IOBJ) \ No newline at end of file