From 9953012154f18ea51ff9216529089715ba79fb41 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 12 Jun 2018 19:56:03 +0200 Subject: reveresed logic for enabling main file, and made tests link arch files --- common/pybindings.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'common') diff --git a/common/pybindings.cc b/common/pybindings.cc index 7c43c84f..761d6571 100644 --- a/common/pybindings.cc +++ b/common/pybindings.cc @@ -140,7 +140,7 @@ static wchar_t *program; void init_python(const char *executable) { -#ifndef PYTHON_MODULE +#ifdef MAIN_EXECUTABLE program = Py_DecodeLocale(executable, NULL); if (program == NULL) { fprintf(stderr, "Fatal error: cannot decode executable filename\n"); @@ -162,7 +162,7 @@ void init_python(const char *executable) void deinit_python() { -#ifndef PYTHON_MODULE +#ifdef MAIN_EXECUTABLE Py_Finalize(); PyMem_RawFree(program); #endif -- cgit v1.2.3 From a76f5c5678980c8b2e958252a68ba03676d63229 Mon Sep 17 00:00:00 2001 From: David Shah Date: Wed, 13 Jun 2018 10:50:05 +0200 Subject: Remove IO buffers when fed by SB_IO Signed-off-by: David Shah --- common/design_utils.h | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) (limited to 'common') diff --git a/common/design_utils.h b/common/design_utils.h index 2acc7d20..daf6e050 100644 --- a/common/design_utils.h +++ b/common/design_utils.h @@ -22,6 +22,8 @@ #ifndef DESIGN_UTILS_H #define DESIGN_UTILS_H +#include + NEXTPNR_NAMESPACE_BEGIN /* @@ -35,23 +37,36 @@ void replace_port(CellInfo *old_cell, IdString old_name, CellInfo *rep_cell, // If a net drives a given port of a cell matching a predicate (in many // cases more than one cell type, e.g. SB_DFFxx so a predicate is used), return // the first instance of that cell (otherwise nullptr). If exclusive is set to -// true, then this cell must be the only load +// true, then this cell must be the only load. If ignore_cell is set, that cell +// is not considered template CellInfo *net_only_drives(NetInfo *net, F1 cell_pred, IdString port, - bool exclusive = false) + bool exclusive = false, CellInfo *exclude = nullptr) { if (net == nullptr) return nullptr; - if (exclusive && (net->users.size() != 1)) { - return nullptr; - } else { - for (const auto &load : net->users) { - if (cell_pred(load.cell) && load.port == port) { - return load.cell; + if (exclusive) { + if (exclude == nullptr) { + if (net->users.size() != 1) + return nullptr; + } else { + if (net->users.size() > 2) { + return nullptr; + } else if (net->users.size() == 2) { + if (std::find_if(net->users.begin(), net->users.end(), + [exclude](const PortRef &ref) { + return ref.cell == exclude; + }) == net->users.end()) + return nullptr; } } - return nullptr; } + for (const auto &load : net->users) { + if (load.cell != exclude && cell_pred(load.cell) && load.port == port) { + return load.cell; + } + } + return nullptr; } // If a net is driven by a given port of a cell matching a predicate, return -- cgit v1.2.3