aboutsummaryrefslogtreecommitdiffstats
path: root/ice40/chip.cc
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2018-06-03 16:16:59 +0200
committerClifford Wolf <clifford@clifford.at>2018-06-03 16:16:59 +0200
commit6840ffd9c09fd045f26afdb6d8ee329f628074c1 (patch)
treebc6be5ac3c55889eb79ded63302fcb4b23c8d3ad /ice40/chip.cc
parentd41936ecbf983f77e295b36d4ac3fed279243de1 (diff)
downloadnextpnr-6840ffd9c09fd045f26afdb6d8ee329f628074c1.tar.gz
nextpnr-6840ffd9c09fd045f26afdb6d8ee329f628074c1.tar.bz2
nextpnr-6840ffd9c09fd045f26afdb6d8ee329f628074c1.zip
Add iCE40 SB_IO bels
Signed-off-by: Clifford Wolf <clifford@clifford.at>
Diffstat (limited to 'ice40/chip.cc')
-rw-r--r--ice40/chip.cc84
1 files changed, 60 insertions, 24 deletions
diff --git a/ice40/chip.cc b/ice40/chip.cc
index 10c493d1..cd427377 100644
--- a/ice40/chip.cc
+++ b/ice40/chip.cc
@@ -23,13 +23,19 @@
IdString belTypeToId(BelType type)
{
- if (type == TYPE_ICESTORM_LC) return "ICESTORM_LC";
+ if (type == TYPE_ICESTORM_LC)
+ return "ICESTORM_LC";
+ if (type == TYPE_SB_IO)
+ return "SB_IO";
return IdString();
}
BelType belTypeFromId(IdString id)
{
- if (id == "ICESTORM_LC") return TYPE_ICESTORM_LC;
+ if (id == "ICESTORM_LC")
+ return TYPE_ICESTORM_LC;
+ if (id == "SB_IO")
+ return TYPE_SB_IO;
return TYPE_NIL;
}
@@ -37,33 +43,63 @@ BelType belTypeFromId(IdString id)
IdString PortPinToId(PortPin type)
{
- if (type == PIN_IN_0) return "IN_0";
- if (type == PIN_IN_1) return "IN_1";
- if (type == PIN_IN_2) return "IN_2";
- if (type == PIN_IN_3) return "IN_3";
- if (type == PIN_O ) return "O";
- if (type == PIN_LO ) return "LO";
- if (type == PIN_CIN ) return "CIN";
- if (type == PIN_COUT) return "COUT";
- if (type == PIN_CEN ) return "CEN";
- if (type == PIN_CLK ) return "CLK";
- if (type == PIN_SR ) return "SR";
+#define X(t) if (type == PIN_##t) return #t;
+
+ X(IN_0)
+ X(IN_1)
+ X(IN_2)
+ X(IN_3)
+ X(O)
+ X(LO)
+ X(CIN)
+ X(COUT)
+ X(CEN)
+ X(CLK)
+ X(SR)
+
+ X(PACKAGE_PIN)
+ X(LATCH_INPUT_VALUE)
+ X(CLOCK_ENABLE)
+ X(INPUT_CLK)
+ X(OUTPUT_CLK)
+ X(OUTPUT_ENABLE)
+ X(D_OUT_0)
+ X(D_OUT_1)
+ X(D_IN_0)
+ X(D_IN_1)
+
+#undef X
return IdString();
}
PortPin PortPinFromId(IdString id)
{
- if (id == "IN_0") return PIN_IN_0;
- if (id == "IN_1") return PIN_IN_1;
- if (id == "IN_2") return PIN_IN_2;
- if (id == "IN_3") return PIN_IN_3;
- if (id == "O" ) return PIN_O;
- if (id == "LO" ) return PIN_LO;
- if (id == "CIN" ) return PIN_CIN;
- if (id == "COUT") return PIN_COUT;
- if (id == "CEN" ) return PIN_CEN;
- if (id == "CLK" ) return PIN_CLK;
- if (id == "SR" ) return PIN_SR;
+#define X(t) if (id == #t) return PIN_##t;
+
+ X(IN_0)
+ X(IN_1)
+ X(IN_2)
+ X(IN_3)
+ X(O)
+ X(LO)
+ X(CIN)
+ X(COUT)
+ X(CEN)
+ X(CLK)
+ X(SR)
+
+ X(PACKAGE_PIN)
+ X(LATCH_INPUT_VALUE)
+ X(CLOCK_ENABLE)
+ X(INPUT_CLK)
+ X(OUTPUT_CLK)
+ X(OUTPUT_ENABLE)
+ X(D_OUT_0)
+ X(D_OUT_1)
+ X(D_IN_0)
+ X(D_IN_1)
+
+#undef X
return PIN_NIL;
}