Pass design to gui, display chip name
This commit is contained in:
parent
d3f1112580
commit
67227847e5
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
Chip::Chip(ChipArgs) {}
|
Chip::Chip(ChipArgs) {}
|
||||||
|
|
||||||
|
std::string Chip::getChipName() { return "Dummy"; }
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
|
|
||||||
BelId Chip::getBelByName(IdString name) const { return BelId(); }
|
BelId Chip::getBelByName(IdString name) const { return BelId(); }
|
||||||
|
@ -61,10 +61,14 @@ struct ChipArgs
|
|||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::string getChipName(ChipArgs id);
|
||||||
|
|
||||||
struct Chip
|
struct Chip
|
||||||
{
|
{
|
||||||
Chip(ChipArgs args);
|
Chip(ChipArgs args);
|
||||||
|
|
||||||
|
std::string getChipName();
|
||||||
|
|
||||||
BelId getBelByName(IdString name) const;
|
BelId getBelByName(IdString name) const;
|
||||||
IdString getBelName(BelId bel) const;
|
IdString getBelName(BelId bel) const;
|
||||||
void bindBel(BelId bel, IdString cell);
|
void bindBel(BelId bel, IdString cell);
|
||||||
|
@ -28,7 +28,7 @@ int main(int argc, char *argv[])
|
|||||||
Design design(ChipArgs{});
|
Design design(ChipArgs{});
|
||||||
|
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
MainWindow w;
|
MainWindow w(&design);
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
#include "pybindings.h"
|
#include "pybindings.h"
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(Design *_design, QWidget *parent)
|
||||||
: QMainWindow(parent), ui(new Ui::MainWindow)
|
: QMainWindow(parent), ui(new Ui::MainWindow), design(_design)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
PyImport_ImportModule("emb");
|
PyImport_ImportModule("emb");
|
||||||
@ -19,6 +19,8 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
ui->plainTextEdit->appendPlainText(s.c_str());
|
ui->plainTextEdit->appendPlainText(s.c_str());
|
||||||
};
|
};
|
||||||
emb::set_stdout(write);
|
emb::set_stdout(write);
|
||||||
|
std::string title = "nextpnr-ice40 - " + design->chip.getChipName();
|
||||||
|
setWindowTitle(title.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow() { delete ui; }
|
MainWindow::~MainWindow() { delete ui; }
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#ifndef MAINWINDOW_H
|
#ifndef MAINWINDOW_H
|
||||||
#define MAINWINDOW_H
|
#define MAINWINDOW_H
|
||||||
|
#include "design.h"
|
||||||
#include "emb.h"
|
#include "emb.h"
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
@ -13,7 +14,7 @@ class MainWindow : public QMainWindow
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MainWindow(QWidget *parent = 0);
|
explicit MainWindow(Design *design, QWidget *parent = 0);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -25,6 +26,7 @@ class MainWindow : public QMainWindow
|
|||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
emb::stdout_write_type write;
|
emb::stdout_write_type write;
|
||||||
|
Design *design;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
@ -106,6 +106,35 @@ Chip::Chip(ChipArgs args) : args(args)
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
|
std::string Chip::getChipName()
|
||||||
|
{
|
||||||
|
#ifdef ICE40_HX1K_ONLY
|
||||||
|
if (args.type == ChipArgs::HX1K) {
|
||||||
|
return "Lattice LP1K";
|
||||||
|
} else {
|
||||||
|
log_error("Unsupported iCE40 chip type.\n");
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (args.type == ChipArgs::LP384) {
|
||||||
|
return "Lattice LP384";
|
||||||
|
} else if (args.type == ChipArgs::LP1K) {
|
||||||
|
return "Lattice LP1K";
|
||||||
|
} else if (args.type == ChipArgs::HX1K) {
|
||||||
|
return "Lattice HX1K";
|
||||||
|
} else if (args.type == ChipArgs::UP5K) {
|
||||||
|
return "Lattice UP5K";
|
||||||
|
} else if (args.type == ChipArgs::LP8K) {
|
||||||
|
return "Lattice LP8K";
|
||||||
|
} else if (args.type == ChipArgs::HX8K) {
|
||||||
|
return "Lattice HX8K";
|
||||||
|
} else {
|
||||||
|
log_error("Unknown chip\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
BelId Chip::getBelByName(IdString name) const
|
BelId Chip::getBelByName(IdString name) const
|
||||||
{
|
{
|
||||||
BelId ret;
|
BelId ret;
|
||||||
|
@ -419,6 +419,8 @@ struct Chip
|
|||||||
ChipArgs args;
|
ChipArgs args;
|
||||||
// -------------------------------------------------
|
// -------------------------------------------------
|
||||||
|
|
||||||
|
std::string getChipName();
|
||||||
|
|
||||||
BelId getBelByName(IdString name) const;
|
BelId getBelByName(IdString name) const;
|
||||||
|
|
||||||
IdString getBelName(BelId bel) const
|
IdString getBelName(BelId bel) const
|
||||||
|
@ -269,7 +269,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (vm.count("gui")) {
|
if (vm.count("gui")) {
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
MainWindow w;
|
MainWindow w(&design);
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
rc = a.exec();
|
rc = a.exec();
|
||||||
|
Loading…
Reference in New Issue
Block a user