Add "nextpnr.h"

Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
Clifford Wolf 2018-06-11 20:12:57 +02:00
parent ac67482380
commit be73894bea
23 changed files with 99 additions and 78 deletions

View File

@ -17,4 +17,4 @@
* *
*/ */
#include "design.h" #include "nextpnr.h"

View File

@ -20,50 +20,9 @@
#ifndef DESIGN_H #ifndef DESIGN_H
#define DESIGN_H #define DESIGN_H
#include <assert.h> #ifndef NEXTPNR_H
#include <stdint.h> #error Include "design.h" via "nextpnr.h" only.
#include <string> #endif
#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"
struct CellInfo; struct CellInfo;

View File

@ -26,7 +26,6 @@
#include <string.h> #include <string.h>
#include <vector> #include <vector>
#include "design.h"
#include "log.h" #include "log.h"
std::vector<FILE *> log_files; std::vector<FILE *> log_files;

View File

@ -27,7 +27,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "design.h" #include "nextpnr.h"
// from libs/sha1/sha1.h // from libs/sha1/sha1.h

69
common/nextpnr.h Normal file
View File

@ -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

View File

@ -28,7 +28,6 @@
#include <string.h> #include <string.h>
#include <vector> #include <vector>
#include "design.h"
#include "log.h" #include "log.h"
#include "place.h" #include "place.h"

View File

@ -19,7 +19,7 @@
#ifndef PLACE_H #ifndef PLACE_H
#define PLACE_H #define PLACE_H
#include "design.h" #include "nextpnr.h"
extern void place_design(Design *design); extern void place_design(Design *design);

View File

@ -18,13 +18,10 @@
* *
*/ */
#include "chip.h" #include "pybindings.h"
#include "design.h"
#include "emb.h" #include "emb.h"
#include "jsonparse.h" #include "jsonparse.h"
#include "nextpnr.h"
// include after design.h/chip.h
#include "pybindings.h"
#include <fstream> #include <fstream>

View File

@ -1,7 +1,7 @@
#include <assert.h> #include <assert.h>
#include <string> #include <string>
#include "design.h"
#include "log.h" #include "log.h"
#include "nextpnr.h"
bool check_all_nets_driven(Design *design) bool check_all_nets_driven(Design *design)
{ {

View File

@ -17,7 +17,7 @@
* *
*/ */
#include "chip.h" #include "nextpnr.h"
Chip::Chip(ChipArgs) {} Chip::Chip(ChipArgs) {}

View File

@ -17,11 +17,13 @@
* *
*/ */
#include "design.h"
#ifndef CHIP_H #ifndef CHIP_H
#define CHIP_H #define CHIP_H
#ifndef NEXTPNR_H
#error Include "chip.h" via "nextpnr.h" only.
#endif
struct DelayInfo struct DelayInfo
{ {
float delay = 0; float delay = 0;

View File

@ -20,8 +20,8 @@
#ifndef PYTHON_MODULE #ifndef PYTHON_MODULE
#include <QApplication> #include <QApplication>
#include "design.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "nextpnr.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {

View File

@ -18,10 +18,7 @@
* *
*/ */
#include "chip.h"
#include "design.h"
// include after design.h/chip.h
#include "pybindings.h" #include "pybindings.h"
#include "nextpnr.h"
void arch_wrap_python() { class_<ChipArgs>("ChipArgs"); } void arch_wrap_python() { class_<ChipArgs>("ChipArgs"); }

View File

@ -27,8 +27,7 @@
#include <iostream> #include <iostream>
#include <log.h> #include <log.h>
#include <string> #include <string>
#include "chip.h" #include "nextpnr.h"
#include "design.h"
extern bool check_all_nets_driven(Design *design); extern bool check_all_nets_driven(Design *design);

View File

@ -22,7 +22,7 @@
#include <istream> #include <istream>
#include <string> #include <string>
#include "design.h" #include "nextpnr.h"
extern void parse_json_file(std::istream *&, std::string &, Design *); extern void parse_json_file(std::istream *&, std::string &, Design *);

View File

@ -5,7 +5,7 @@
#include <QOpenGLFunctions> #include <QOpenGLFunctions>
#include <QOpenGLWidget> #include <QOpenGLWidget>
#include <QPainter> #include <QPainter>
#include "design.h" #include "nextpnr.h"
class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions
{ {

View File

@ -1,7 +1,8 @@
#ifndef MAINWINDOW_H #ifndef MAINWINDOW_H
#define MAINWINDOW_H #define MAINWINDOW_H
#include "design.h"
#include "emb.h" #include "emb.h"
#include "nextpnr.h"
#include <QMainWindow> #include <QMainWindow>

View File

@ -21,7 +21,7 @@
#define ICE40_BITSTREAM_H #define ICE40_BITSTREAM_H
#include <iostream> #include <iostream>
#include "chip.h" #include "nextpnr.h"
void write_asc(const Design &design, std::ostream &out); void write_asc(const Design &design, std::ostream &out);

View File

@ -17,8 +17,8 @@
* *
*/ */
#include "chip.h"
#include "log.h" #include "log.h"
#include "nextpnr.h"
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------

View File

@ -17,11 +17,13 @@
* *
*/ */
#include "design.h"
#ifndef CHIP_H #ifndef CHIP_H
#define CHIP_H #define CHIP_H
#ifndef NEXTPNR_H
#error Include "chip.h" via "nextpnr.h" only.
#endif
struct DelayInfo struct DelayInfo
{ {
float delay = 0; float delay = 0;

View File

@ -311,7 +311,7 @@ elif dev_name == "5k":
add_bel_gb( 6, 0, 6) add_bel_gb( 6, 0, 6)
add_bel_gb(19, 0, 7) add_bel_gb(19, 0, 7)
print('#include "chip.h"') print('#include "nextpnr.h"')
for bel in range(len(bel_name)): for bel in range(len(bel_name)):
print("static BelWirePOD bel_wires_%d[%d] = {" % (bel, len(bel_wires[bel]))) print("static BelWirePOD bel_wires_%d[%d] = {" % (bel, len(bel_wires[bel])))

View File

@ -25,10 +25,10 @@
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include "bitstream.h" #include "bitstream.h"
#include "design.h"
#include "jsonparse.h" #include "jsonparse.h"
#include "log.h" #include "log.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "nextpnr.h"
#include "place.h" #include "place.h"
#include "pybindings.h" #include "pybindings.h"
#include "route.h" #include "route.h"

View File

@ -18,11 +18,8 @@
* *
*/ */
#include "chip.h"
#include "design.h"
// include after design.h/chip.h
#include "pybindings.h" #include "pybindings.h"
#include "nextpnr.h"
void arch_wrap_python() void arch_wrap_python()
{ {