2018-06-01 21:53:46 +08:00
|
|
|
/*
|
|
|
|
* nextpnr -- Next Generation Place and Route
|
|
|
|
*
|
2018-06-22 22:19:17 +08:00
|
|
|
* Copyright (C) 2018 Clifford Wolf <clifford@symbioticeda.com>
|
2018-06-17 17:49:57 +08:00
|
|
|
* Copyright (C) 2018 David Shah <david@symbioticeda.com>
|
2018-06-01 21:53:46 +08:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2018-06-23 20:32:18 +08:00
|
|
|
#ifndef NO_PYTHON
|
|
|
|
|
2018-06-02 19:33:45 +08:00
|
|
|
#include "pybindings.h"
|
2018-06-12 02:12:57 +08:00
|
|
|
#include "nextpnr.h"
|
2018-06-01 21:18:18 +08:00
|
|
|
|
2018-06-12 20:24:59 +08:00
|
|
|
NEXTPNR_NAMESPACE_BEGIN
|
|
|
|
|
2018-06-07 19:10:53 +08:00
|
|
|
void arch_wrap_python()
|
|
|
|
{
|
2018-06-18 19:35:25 +08:00
|
|
|
class_<ArchArgs>("ArchArgs").def_readwrite("type", &ArchArgs::type);
|
2018-06-01 21:18:18 +08:00
|
|
|
|
2018-06-18 19:35:25 +08:00
|
|
|
enum_<decltype(std::declval<ArchArgs>().type)>("iCE40Type")
|
|
|
|
.value("NONE", ArchArgs::NONE)
|
|
|
|
.value("LP384", ArchArgs::LP384)
|
|
|
|
.value("LP1K", ArchArgs::LP1K)
|
|
|
|
.value("LP8K", ArchArgs::LP8K)
|
|
|
|
.value("HX1K", ArchArgs::HX1K)
|
|
|
|
.value("HX8K", ArchArgs::HX8K)
|
|
|
|
.value("UP5K", ArchArgs::UP5K)
|
2018-06-01 21:18:18 +08:00
|
|
|
.export_values();
|
|
|
|
|
2018-06-10 00:41:38 +08:00
|
|
|
class_<BelId>("BelId").def_readwrite("index", &BelId::index);
|
2018-06-01 21:53:46 +08:00
|
|
|
|
2018-06-10 00:41:38 +08:00
|
|
|
class_<WireId>("WireId").def_readwrite("index", &WireId::index);
|
2018-06-01 21:53:46 +08:00
|
|
|
|
2018-06-10 00:41:38 +08:00
|
|
|
class_<PipId>("PipId").def_readwrite("index", &PipId::index);
|
2018-06-07 20:36:35 +08:00
|
|
|
|
2018-06-23 22:12:52 +08:00
|
|
|
class_<BelPin>("BelPin").def_readwrite("bel", &BelPin::bel).def_readwrite("pin", &BelPin::pin);
|
2018-06-07 20:36:35 +08:00
|
|
|
|
|
|
|
enum_<PortPin>("PortPin")
|
|
|
|
#define X(t) .value("PIN_" #t, PIN_##t)
|
|
|
|
#include "portpins.inc"
|
|
|
|
;
|
|
|
|
#undef X
|
|
|
|
|
2018-06-26 20:13:52 +08:00
|
|
|
class_<Arch, Arch *, bases<BaseCtx>, boost::noncopyable>("Arch", init<ArchArgs>())
|
2018-06-18 19:35:25 +08:00
|
|
|
.def("getBelByName", &Arch::getBelByName)
|
|
|
|
.def("getWireByName", &Arch::getWireByName)
|
|
|
|
.def("getBelName", &Arch::getBelName)
|
|
|
|
.def("getWireName", &Arch::getWireName)
|
|
|
|
.def("getBels", &Arch::getBels)
|
|
|
|
.def("getBelType", &Arch::getBelType)
|
|
|
|
.def("getWireBelPin", &Arch::getWireBelPin)
|
|
|
|
.def("getBelPinUphill", &Arch::getBelPinUphill)
|
|
|
|
.def("getBelPinsDownhill", &Arch::getBelPinsDownhill)
|
|
|
|
.def("getWires", &Arch::getWires)
|
|
|
|
.def("getPipByName", &Arch::getPipByName)
|
|
|
|
.def("getPipName", &Arch::getPipName)
|
|
|
|
.def("getPips", &Arch::getPips)
|
|
|
|
.def("getPipSrcWire", &Arch::getPipSrcWire)
|
|
|
|
.def("getPipDstWire", &Arch::getPipDstWire)
|
|
|
|
.def("getPipDelay", &Arch::getPipDelay)
|
|
|
|
.def("getPipsDownhill", &Arch::getPipsDownhill)
|
|
|
|
.def("getPipsUphill", &Arch::getPipsUphill)
|
|
|
|
.def("getWireAliases", &Arch::getWireAliases)
|
|
|
|
.def("estimatePosition", &Arch::estimatePosition)
|
|
|
|
.def("estimateDelay", &Arch::estimateDelay);
|
2018-06-01 21:53:46 +08:00
|
|
|
|
2018-06-06 21:13:41 +08:00
|
|
|
WRAP_RANGE(Bel);
|
|
|
|
WRAP_RANGE(BelPin);
|
|
|
|
WRAP_RANGE(Wire);
|
|
|
|
WRAP_RANGE(AllPip);
|
|
|
|
WRAP_RANGE(Pip);
|
2018-06-01 21:18:18 +08:00
|
|
|
}
|
2018-06-12 20:24:59 +08:00
|
|
|
|
|
|
|
NEXTPNR_NAMESPACE_END
|
2018-06-23 20:32:18 +08:00
|
|
|
|
2018-06-24 01:51:22 +08:00
|
|
|
#endif // NO_PYTHON
|