python: Convert empty BelId to None
Signed-off-by: David Shah <davey1576@gmail.com>
This commit is contained in:
parent
11fb625195
commit
726f2020f1
@ -20,8 +20,8 @@
|
|||||||
|
|
||||||
#ifndef NO_PYTHON
|
#ifndef NO_PYTHON
|
||||||
|
|
||||||
#include "pybindings.h"
|
|
||||||
#include "nextpnr.h"
|
#include "nextpnr.h"
|
||||||
|
#include "pybindings.h"
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_BEGIN
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
#define ARCH_PYBINDINGS_H
|
#define ARCH_PYBINDINGS_H
|
||||||
#ifndef NO_PYTHON
|
#ifndef NO_PYTHON
|
||||||
|
|
||||||
#include "pybindings.h"
|
|
||||||
#include "nextpnr.h"
|
#include "nextpnr.h"
|
||||||
|
#include "pybindings.h"
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_BEGIN
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
@ -20,9 +20,9 @@
|
|||||||
|
|
||||||
#ifndef NO_PYTHON
|
#ifndef NO_PYTHON
|
||||||
|
|
||||||
#include "pybindings.h"
|
|
||||||
#include "arch_pybindings.h"
|
#include "arch_pybindings.h"
|
||||||
#include "nextpnr.h"
|
#include "nextpnr.h"
|
||||||
|
#include "pybindings.h"
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_BEGIN
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
@ -21,8 +21,9 @@
|
|||||||
#define ARCH_PYBINDINGS_H
|
#define ARCH_PYBINDINGS_H
|
||||||
#ifndef NO_PYTHON
|
#ifndef NO_PYTHON
|
||||||
|
|
||||||
#include "pybindings.h"
|
|
||||||
#include "nextpnr.h"
|
#include "nextpnr.h"
|
||||||
|
#include "pybindings.h"
|
||||||
|
#include "pywrappers.h"
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_BEGIN
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
@ -32,7 +33,12 @@ template <> struct string_converter<BelId>
|
|||||||
{
|
{
|
||||||
BelId from_str(Context *ctx, std::string name) { return ctx->getBelByName(ctx->id(name)); }
|
BelId from_str(Context *ctx, std::string name) { return ctx->getBelByName(ctx->id(name)); }
|
||||||
|
|
||||||
std::string to_str(Context *ctx, BelId id) { return ctx->getBelName(id).str(ctx); }
|
std::string to_str(Context *ctx, BelId id)
|
||||||
|
{
|
||||||
|
if (id == BelId())
|
||||||
|
throw bad_wrap();
|
||||||
|
return ctx->getBelName(id).str(ctx);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <> struct string_converter<BelType>
|
template <> struct string_converter<BelType>
|
||||||
|
@ -20,6 +20,6 @@ for cell, cinfo in sorted(ctx.cells, key=lambda x: x.first):
|
|||||||
val = "{}'b{}".format(len(val), val)
|
val = "{}'b{}".format(len(val), val)
|
||||||
print("\t\t{}: {}".format(param, val))
|
print("\t\t{}: {}".format(param, val))
|
||||||
|
|
||||||
if cinfo.bel.index != -1:
|
if cinfo.bel is not None:
|
||||||
print("\tBel: {}".format(cinfo.bel))
|
print("\tBel: {}".format(cinfo.bel))
|
||||||
print()
|
print()
|
||||||
|
Loading…
Reference in New Issue
Block a user