Add architecture specific Python defs
Signed-off-by: David Shah <davey1576@gmail.com>
This commit is contained in:
parent
a7415bfbc3
commit
f353453a7f
@ -84,12 +84,16 @@ struct range_wrapper {
|
|||||||
|
|
||||||
#define WRAP_RANGE(t) range_wrapper<t##Range>().wrap(#t "Range", #t "Iterator")
|
#define WRAP_RANGE(t) range_wrapper<t##Range>().wrap(#t "Range", #t "Iterator")
|
||||||
|
|
||||||
|
// Architecture-specific bindings should be created in the below function, which must be implemented in all
|
||||||
|
// architectures
|
||||||
|
void arch_wrap_python();
|
||||||
|
|
||||||
BOOST_PYTHON_MODULE (MODULE_NAME) {
|
BOOST_PYTHON_MODULE (MODULE_NAME) {
|
||||||
// From Chip.h
|
// From Chip.h
|
||||||
class_<ChipArgs>("ChipArgs");
|
|
||||||
WRAP_RANGE(Bels);
|
WRAP_RANGE(Bels);
|
||||||
WRAP_RANGE(AllWires);
|
WRAP_RANGE(AllWires);
|
||||||
WRAP_RANGE(WireDelay);
|
WRAP_RANGE(WireDelay);
|
||||||
WRAP_RANGE(BelPin);
|
WRAP_RANGE(BelPin);
|
||||||
|
|
||||||
|
arch_wrap_python();
|
||||||
}
|
}
|
||||||
|
14
dummy/pybindings.cc
Normal file
14
dummy/pybindings.cc
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include "design.h"
|
||||||
|
#include "chip.h"
|
||||||
|
#include <utility>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <boost/python.hpp>
|
||||||
|
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
|
||||||
|
#include <boost/python/suite/indexing/map_indexing_suite.hpp>
|
||||||
|
#include <boost/python/suite/indexing/map_indexing_suite.hpp>
|
||||||
|
|
||||||
|
using namespace boost::python;
|
||||||
|
|
||||||
|
void arch_wrap_python() {
|
||||||
|
class_<ChipArgs>("ChipArgs");
|
||||||
|
}
|
27
ice40/pybindings.cc
Normal file
27
ice40/pybindings.cc
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include "design.h"
|
||||||
|
#include "chip.h"
|
||||||
|
#include <utility>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <boost/python.hpp>
|
||||||
|
#include <boost/python/enum.hpp>
|
||||||
|
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
|
||||||
|
#include <boost/python/suite/indexing/map_indexing_suite.hpp>
|
||||||
|
#include <boost/python/suite/indexing/map_indexing_suite.hpp>
|
||||||
|
|
||||||
|
using namespace boost::python;
|
||||||
|
|
||||||
|
void arch_wrap_python() {
|
||||||
|
class_<ChipArgs>("ChipArgs")
|
||||||
|
.def_readwrite("type", &ChipArgs::type);
|
||||||
|
|
||||||
|
enum_<decltype(std::declval<ChipArgs>().type)>("iCE40Type")
|
||||||
|
.value("NONE", ChipArgs::NONE)
|
||||||
|
.value("LP384", ChipArgs::LP384)
|
||||||
|
.value("LP1K", ChipArgs::LP1K)
|
||||||
|
.value("LP8K", ChipArgs::LP8K)
|
||||||
|
.value("HX1K", ChipArgs::HX1K)
|
||||||
|
.value("HX8K", ChipArgs::HX8K)
|
||||||
|
.value("UP5K", ChipArgs::UP5K)
|
||||||
|
.export_values();
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user