diff options
author | Clifford Wolf <clifford@clifford.at> | 2018-08-08 19:35:13 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2018-08-08 19:35:13 +0200 |
commit | f6189e4677c7bdaeaa5b9b796a67d750e6c7d49d (patch) | |
tree | a13673a636ddbea3b5fd5585e3bb109b56b69435 /generic | |
parent | a3ae3f97913c291dbe36a49b1a20388156943abc (diff) | |
parent | cd4e761bb799ca99f02d3aa177961af28a93f2d8 (diff) | |
download | nextpnr-f6189e4677c7bdaeaa5b9b796a67d750e6c7d49d.tar.gz nextpnr-f6189e4677c7bdaeaa5b9b796a67d750e6c7d49d.tar.bz2 nextpnr-f6189e4677c7bdaeaa5b9b796a67d750e6c7d49d.zip |
Merge branch 'master' of github.com:YosysHQ/nextpnr into constids
Diffstat (limited to 'generic')
-rw-r--r-- | generic/arch.cc | 10 | ||||
-rw-r--r-- | generic/arch.h | 6 | ||||
-rw-r--r-- | generic/main.cc | 136 | ||||
-rw-r--r-- | generic/project.cc | 37 |
4 files changed, 77 insertions, 112 deletions
diff --git a/generic/arch.cc b/generic/arch.cc index a6d41e1e..4e25b2c8 100644 --- a/generic/arch.cc +++ b/generic/arch.cc @@ -175,7 +175,7 @@ void Arch::setGroupDecal(GroupId group, DecalXY decalxy) // --------------------------------------------------------------- -Arch::Arch(ArchArgs) : chipName("generic") {} +Arch::Arch(ArchArgs args) : chipName("generic"), args(args) {} void IdString::initialize_arch(const BaseCtx *ctx) {} @@ -435,9 +435,11 @@ bool Arch::getCellDelay(const CellInfo *cell, IdString fromPort, IdString toPort return false; } -IdString Arch::getPortClock(const CellInfo *cell, IdString port) const { return IdString(); } - -bool Arch::isClockPort(const CellInfo *cell, IdString port) const { return false; } +// Get the port class, also setting clockPort if applicable +TimingPortClass Arch::getPortTimingClass(const CellInfo *cell, IdString port, IdString &clockPort) const +{ + return TMG_IGNORE; +} bool Arch::isValidBelForCell(CellInfo *cell, BelId bel) const { return true; } bool Arch::isBelLocationValid(BelId bel) const { return true; } diff --git a/generic/arch.h b/generic/arch.h index b38d5916..ee7d0403 100644 --- a/generic/arch.h +++ b/generic/arch.h @@ -121,11 +121,13 @@ struct Arch : BaseCtx // --------------------------------------------------------------- // Common Arch API. Every arch must provide the following methods. + ArchArgs args; Arch(ArchArgs args); std::string getChipName() const { return chipName; } IdString archId() const { return id("generic"); } + ArchArgs archArgs() const { return args; } IdString archArgsToId(ArchArgs args) const { return id("none"); } int getGridDimX() const { return gridDimX; } @@ -207,8 +209,8 @@ struct Arch : BaseCtx DecalXY getGroupDecal(GroupId group) const; bool getCellDelay(const CellInfo *cell, IdString fromPort, IdString toPort, DelayInfo &delay) const; - IdString getPortClock(const CellInfo *cell, IdString port) const; - bool isClockPort(const CellInfo *cell, IdString port) const; + // Get the port class, also setting clockPort if applicable + TimingPortClass getPortTimingClass(const CellInfo *cell, IdString port, IdString &clockPort) const; bool isValidBelForCell(CellInfo *cell, BelId bel) const; bool isBelLocationValid(BelId bel) const; diff --git a/generic/main.cc b/generic/main.cc index 8653da01..412a28ac 100644 --- a/generic/main.cc +++ b/generic/main.cc @@ -19,123 +19,47 @@ #ifdef MAIN_EXECUTABLE -#ifndef NO_GUI -#include <QApplication> -#include "application.h" -#include "mainwindow.h" -#endif -#ifndef NO_PYTHON -#include "pybindings.h" -#endif -#include <boost/filesystem/convenience.hpp> -#include <boost/program_options.hpp> -#include <iostream> +#include <fstream> +#include "command.h" +#include "design_utils.h" #include "log.h" -#include "nextpnr.h" -#include "version.h" +#include "timing.h" USING_NEXTPNR_NAMESPACE -int main(int argc, char *argv[]) +class GenericCommandHandler : public CommandHandler { - try { - - namespace po = boost::program_options; - int rc = 0; - - log_files.push_back(stdout); - - po::options_description options("Allowed options"); - options.add_options()("help,h", "show help"); - options.add_options()("verbose,v", "verbose output"); - options.add_options()("force,f", "keep running after errors"); -#ifndef NO_GUI - options.add_options()("gui", "start gui"); -#endif - - po::positional_options_description pos; -#ifndef NO_PYTHON - options.add_options()("run", po::value<std::vector<std::string>>(), "python file to execute"); - pos.add("run", -1); -#endif - options.add_options()("version,V", "show version"); - - po::variables_map vm; - try { - po::parsed_options parsed = po::command_line_parser(argc, argv).options(options).positional(pos).run(); - - po::store(parsed, vm); - - po::notify(vm); - } - - catch (std::exception &e) { - std::cout << e.what() << "\n"; - return 1; - } - - if (vm.count("help") || argc == 1) { - std::cout << boost::filesystem::basename(argv[0]) - << " -- Next Generation Place and Route (git " - "sha1 " GIT_COMMIT_HASH_STR ")\n"; - std::cout << "\n"; - std::cout << options << "\n"; - return argc != 1; - } + public: + GenericCommandHandler(int argc, char **argv); + virtual ~GenericCommandHandler(){}; + std::unique_ptr<Context> createContext() override; + void setupArchContext(Context *ctx) override{}; + void customBitstream(Context *ctx) override; - if (vm.count("version")) { - std::cout << boost::filesystem::basename(argv[0]) - << " -- Next Generation Place and Route (git " - "sha1 " GIT_COMMIT_HASH_STR ")\n"; - return 1; - } + protected: + po::options_description getArchOptions(); +}; - ArchArgs chipArgs{}; - std::unique_ptr<Context> ctx = std::unique_ptr<Context>(new Context(chipArgs)); +GenericCommandHandler::GenericCommandHandler(int argc, char **argv) : CommandHandler(argc, argv) {} - if (vm.count("verbose")) { - ctx->verbose = true; - } - - if (vm.count("force")) { - ctx->force = true; - } - - if (vm.count("seed")) { - ctx->rngseed(vm["seed"].as<int>()); - } - -#ifndef NO_GUI - if (vm.count("gui")) { - Application a(argc, argv); - MainWindow w(std::move(ctx), chipArgs); - w.show(); - - return a.exec(); - } -#endif - -#ifndef NO_PYTHON - if (vm.count("run")) { - init_python(argv[0], true); - python_export_global("ctx", *ctx.get()); +po::options_description GenericCommandHandler::getArchOptions() +{ + po::options_description specific("Architecture specific options"); + specific.add_options()("generic", "set device type to generic"); + return specific; +} - std::vector<std::string> files = vm["run"].as<std::vector<std::string>>(); - for (auto filename : files) - execute_python_file(filename.c_str()); +void GenericCommandHandler::customBitstream(Context *ctx) { log_error("Here is when bitstream gets created"); } - deinit_python(); - } -#endif +std::unique_ptr<Context> GenericCommandHandler::createContext() +{ + return std::unique_ptr<Context>(new Context(chipArgs)); +} - return rc; - } catch (log_execution_error_exception) { -#if defined(_MSC_VER) - _exit(EXIT_FAILURE); -#else - _Exit(EXIT_FAILURE); -#endif - } +int main(int argc, char *argv[]) +{ + GenericCommandHandler handler(argc, argv); + return handler.exec(); } #endif diff --git a/generic/project.cc b/generic/project.cc new file mode 100644 index 00000000..8103e91f --- /dev/null +++ b/generic/project.cc @@ -0,0 +1,37 @@ +/* + * nextpnr -- Next Generation Place and Route + * + * Copyright (C) 2018 Miodrag Milanovic <miodrag@symbioticeda.com> + * + * 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 "project.h" +#include <boost/filesystem/convenience.hpp> +#include <fstream> +#include "log.h" + +NEXTPNR_NAMESPACE_BEGIN + +void ProjectHandler::saveArch(Context *ctx, pt::ptree &root) {} + +std::unique_ptr<Context> ProjectHandler::createContext(pt::ptree &root) +{ + ArchArgs chipArgs; + return std::unique_ptr<Context>(new Context(chipArgs)); +} + +void ProjectHandler::loadArch(Context *ctx, pt::ptree &root, std::string path) {} + +NEXTPNR_NAMESPACE_END |