aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/design.cc2
-rw-r--r--common/design.h47
-rw-r--r--common/log.cc1
-rw-r--r--common/log.h2
-rw-r--r--common/nextpnr.h69
-rw-r--r--common/place.cc1
-rw-r--r--common/place.h2
-rw-r--r--common/pybindings.cc7
-rw-r--r--common/rulecheck.cc2
-rw-r--r--dummy/chip.cc2
-rw-r--r--dummy/chip.h6
-rw-r--r--dummy/main.cc2
-rw-r--r--dummy/pybindings.cc5
-rw-r--r--frontend/json/jsonparse.cc3
-rw-r--r--frontend/json/jsonparse.h2
-rw-r--r--gui/fpgaviewwidget.h2
-rw-r--r--gui/mainwindow.h3
-rw-r--r--ice40/bitstream.h2
-rw-r--r--ice40/chip.cc2
-rw-r--r--ice40/chip.h6
-rw-r--r--ice40/chipdb.py2
-rw-r--r--ice40/main.cc2
-rw-r--r--ice40/pybindings.cc5
23 files changed, 99 insertions, 78 deletions
diff --git a/common/design.cc b/common/design.cc
index 6ab122df..8fc3a781 100644
--- a/common/design.cc
+++ b/common/design.cc
@@ -17,4 +17,4 @@
*
*/
-#include "design.h"
+#include "nextpnr.h"
diff --git a/common/design.h b/common/design.h
index d05e6095..ae2657f2 100644
--- a/common/design.h
+++ b/common/design.h
@@ -20,50 +20,9 @@
#ifndef DESIGN_H
#define DESIGN_H
-#include <assert.h>
-#include <stdint.h>
-#include <string>
-#include <unordered_map>
-#include <unordered_set>
-#include <vector>
-
-// replace with proper IdString later
-typedef std::string IdString;
-
-struct GraphicElement
-{
- // This will control colour, and there should be separate
- // visibility controls in some cases also
- enum
- {
- // Wires entirely inside tiles, e.g. between switchbox and bels
- G_LOCAL_WIRES,
- // Standard inter-tile routing
- G_GENERAL_WIRES,
- // Special inter-tile wires, e.g. carry chains
- G_DEDICATED_WIRES,
- G_BEL_OUTLINE,
- G_SWITCHBOX_OUTLINE,
- G_TILE_OUTLINE,
- G_BEL_PINS,
- G_SWITCHBOX_PINS,
- G_BEL_MISC,
- G_TILE_MISC,
- } style;
-
- enum
- {
- G_LINE,
- G_BOX,
- G_CIRCLE,
- G_LABEL
- } type;
-
- float x1, y1, x2, y2, z;
- std::string text;
-};
-
-#include "chip.h"
+#ifndef NEXTPNR_H
+#error Include "design.h" via "nextpnr.h" only.
+#endif
struct CellInfo;
diff --git a/common/log.cc b/common/log.cc
index 7a411fb2..e72633bc 100644
--- a/common/log.cc
+++ b/common/log.cc
@@ -26,7 +26,6 @@
#include <string.h>
#include <vector>
-#include "design.h"
#include "log.h"
std::vector<FILE *> log_files;
diff --git a/common/log.h b/common/log.h
index c3c05c11..085f72ee 100644
--- a/common/log.h
+++ b/common/log.h
@@ -27,7 +27,7 @@
#include <string>
#include <vector>
-#include "design.h"
+#include "nextpnr.h"
// from libs/sha1/sha1.h
diff --git a/common/nextpnr.h b/common/nextpnr.h
new file mode 100644
index 00000000..453af496
--- /dev/null
+++ b/common/nextpnr.h
@@ -0,0 +1,69 @@
+/*
+ * nextpnr -- Next Generation Place and Route
+ *
+ * Copyright (C) 2018 Clifford Wolf <clifford@clifford.at>
+ *
+ * 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 <assert.h>
+#include <stdint.h>
+#include <string>
+#include <unordered_map>
+#include <unordered_set>
+#include <vector>
+
+#ifndef NEXTPNR_H
+#define NEXTPNR_H
+
+// replace with proper IdString later
+typedef std::string IdString;
+
+struct GraphicElement
+{
+ // This will control colour, and there should be separate
+ // visibility controls in some cases also
+ enum
+ {
+ // Wires entirely inside tiles, e.g. between switchbox and bels
+ G_LOCAL_WIRES,
+ // Standard inter-tile routing
+ G_GENERAL_WIRES,
+ // Special inter-tile wires, e.g. carry chains
+ G_DEDICATED_WIRES,
+ G_BEL_OUTLINE,
+ G_SWITCHBOX_OUTLINE,
+ G_TILE_OUTLINE,
+ G_BEL_PINS,
+ G_SWITCHBOX_PINS,
+ G_BEL_MISC,
+ G_TILE_MISC,
+ } style;
+
+ enum
+ {
+ G_LINE,
+ G_BOX,
+ G_CIRCLE,
+ G_LABEL
+ } type;
+
+ float x1, y1, x2, y2, z;
+ std::string text;
+};
+
+#include "chip.h"
+#include "design.h"
+
+#endif
diff --git a/common/place.cc b/common/place.cc
index 17b31c69..0223c78f 100644
--- a/common/place.cc
+++ b/common/place.cc
@@ -28,7 +28,6 @@
#include <string.h>
#include <vector>
-#include "design.h"
#include "log.h"
#include "place.h"
diff --git a/common/place.h b/common/place.h
index 8d3b4c42..a8b86595 100644
--- a/common/place.h
+++ b/common/place.h
@@ -19,7 +19,7 @@
#ifndef PLACE_H
#define PLACE_H
-#include "design.h"
+#include "nextpnr.h"
extern void place_design(Design *design);
diff --git a/common/pybindings.cc b/common/pybindings.cc
index 82f35421..d941436b 100644
--- a/common/pybindings.cc
+++ b/common/pybindings.cc
@@ -18,13 +18,10 @@
*
*/
-#include "chip.h"
-#include "design.h"
+#include "pybindings.h"
#include "emb.h"
#include "jsonparse.h"
-
-// include after design.h/chip.h
-#include "pybindings.h"
+#include "nextpnr.h"
#include <fstream>
diff --git a/common/rulecheck.cc b/common/rulecheck.cc
index ca0fb76c..4fc3f73a 100644
--- a/common/rulecheck.cc
+++ b/common/rulecheck.cc
@@ -1,7 +1,7 @@
#include <assert.h>
#include <string>
-#include "design.h"
#include "log.h"
+#include "nextpnr.h"
bool check_all_nets_driven(Design *design)
{
diff --git a/dummy/chip.cc b/dummy/chip.cc
index 1376c11c..0e23a20a 100644
--- a/dummy/chip.cc
+++ b/dummy/chip.cc
@@ -17,7 +17,7 @@
*
*/
-#include "chip.h"
+#include "nextpnr.h"
Chip::Chip(ChipArgs) {}
diff --git a/dummy/chip.h b/dummy/chip.h
index 3e98071e..274f0e8e 100644
--- a/dummy/chip.h
+++ b/dummy/chip.h
@@ -17,11 +17,13 @@
*
*/
-#include "design.h"
-
#ifndef CHIP_H
#define CHIP_H
+#ifndef NEXTPNR_H
+#error Include "chip.h" via "nextpnr.h" only.
+#endif
+
struct DelayInfo
{
float delay = 0;
diff --git a/dummy/main.cc b/dummy/main.cc
index c84d595c..df5333ca 100644
--- a/dummy/main.cc
+++ b/dummy/main.cc
@@ -20,8 +20,8 @@
#ifndef PYTHON_MODULE
#include <QApplication>
-#include "design.h"
#include "mainwindow.h"
+#include "nextpnr.h"
int main(int argc, char *argv[])
{
diff --git a/dummy/pybindings.cc b/dummy/pybindings.cc
index 12e0ca13..a0b6322e 100644
--- a/dummy/pybindings.cc
+++ b/dummy/pybindings.cc
@@ -18,10 +18,7 @@
*
*/
-#include "chip.h"
-#include "design.h"
-
-// include after design.h/chip.h
#include "pybindings.h"
+#include "nextpnr.h"
void arch_wrap_python() { class_<ChipArgs>("ChipArgs"); }
diff --git a/frontend/json/jsonparse.cc b/frontend/json/jsonparse.cc
index fd44246a..8a46c909 100644
--- a/frontend/json/jsonparse.cc
+++ b/frontend/json/jsonparse.cc
@@ -27,8 +27,7 @@
#include <iostream>
#include <log.h>
#include <string>
-#include "chip.h"
-#include "design.h"
+#include "nextpnr.h"
extern bool check_all_nets_driven(Design *design);
diff --git a/frontend/json/jsonparse.h b/frontend/json/jsonparse.h
index a1c28a42..8d863029 100644
--- a/frontend/json/jsonparse.h
+++ b/frontend/json/jsonparse.h
@@ -22,7 +22,7 @@
#include <istream>
#include <string>
-#include "design.h"
+#include "nextpnr.h"
extern void parse_json_file(std::istream *&, std::string &, Design *);
diff --git a/gui/fpgaviewwidget.h b/gui/fpgaviewwidget.h
index c54a745e..4e6838e1 100644
--- a/gui/fpgaviewwidget.h
+++ b/gui/fpgaviewwidget.h
@@ -5,7 +5,7 @@
#include <QOpenGLFunctions>
#include <QOpenGLWidget>
#include <QPainter>
-#include "design.h"
+#include "nextpnr.h"
class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions
{
diff --git a/gui/mainwindow.h b/gui/mainwindow.h
index 4d8b0dbd..c782a4a6 100644
--- a/gui/mainwindow.h
+++ b/gui/mainwindow.h
@@ -1,7 +1,8 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
-#include "design.h"
+
#include "emb.h"
+#include "nextpnr.h"
#include <QMainWindow>
diff --git a/ice40/bitstream.h b/ice40/bitstream.h
index 9b08f96e..fecc14e1 100644
--- a/ice40/bitstream.h
+++ b/ice40/bitstream.h
@@ -21,7 +21,7 @@
#define ICE40_BITSTREAM_H
#include <iostream>
-#include "chip.h"
+#include "nextpnr.h"
void write_asc(const Design &design, std::ostream &out);
diff --git a/ice40/chip.cc b/ice40/chip.cc
index 5f6560c5..42252fa0 100644
--- a/ice40/chip.cc
+++ b/ice40/chip.cc
@@ -17,8 +17,8 @@
*
*/
-#include "chip.h"
#include "log.h"
+#include "nextpnr.h"
// -----------------------------------------------------------------------
diff --git a/ice40/chip.h b/ice40/chip.h
index 3ab3f3d2..451be9ce 100644
--- a/ice40/chip.h
+++ b/ice40/chip.h
@@ -17,11 +17,13 @@
*
*/
-#include "design.h"
-
#ifndef CHIP_H
#define CHIP_H
+#ifndef NEXTPNR_H
+#error Include "chip.h" via "nextpnr.h" only.
+#endif
+
struct DelayInfo
{
float delay = 0;
diff --git a/ice40/chipdb.py b/ice40/chipdb.py
index f57d307c..34366679 100644
--- a/ice40/chipdb.py
+++ b/ice40/chipdb.py
@@ -311,7 +311,7 @@ elif dev_name == "5k":
add_bel_gb( 6, 0, 6)
add_bel_gb(19, 0, 7)
-print('#include "chip.h"')
+print('#include "nextpnr.h"')
for bel in range(len(bel_name)):
print("static BelWirePOD bel_wires_%d[%d] = {" % (bel, len(bel_wires[bel])))
diff --git a/ice40/main.cc b/ice40/main.cc
index e87862be..cceb2b04 100644
--- a/ice40/main.cc
+++ b/ice40/main.cc
@@ -25,10 +25,10 @@
#include <fstream>
#include <iostream>
#include "bitstream.h"
-#include "design.h"
#include "jsonparse.h"
#include "log.h"
#include "mainwindow.h"
+#include "nextpnr.h"
#include "place.h"
#include "pybindings.h"
#include "route.h"
diff --git a/ice40/pybindings.cc b/ice40/pybindings.cc
index f9385153..c00bf6b9 100644
--- a/ice40/pybindings.cc
+++ b/ice40/pybindings.cc
@@ -18,11 +18,8 @@
*
*/
-#include "chip.h"
-#include "design.h"
-
-// include after design.h/chip.h
#include "pybindings.h"
+#include "nextpnr.h"
void arch_wrap_python()
{