diff options
author | gatecat <gatecat@ds0.me> | 2022-01-19 13:22:40 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-19 13:22:40 +0000 |
commit | fbeef2b8c2734210a70e51a3ac629c2065c06d19 (patch) | |
tree | 9f0aa005ecfbb5a22a14c377a3d663465639a5a7 /mistral/arch.cc | |
parent | 58a1b473b85ae8bc4312eed14af1829b93958341 (diff) | |
parent | 27d38de612ce4109723704f863ac82a6cbddf10c (diff) | |
download | nextpnr-fbeef2b8c2734210a70e51a3ac629c2065c06d19.tar.gz nextpnr-fbeef2b8c2734210a70e51a3ac629c2065c06d19.tar.bz2 nextpnr-fbeef2b8c2734210a70e51a3ac629c2065c06d19.zip |
Merge pull request #895 from galibert/master
Sync with the current state of mistral
Diffstat (limited to 'mistral/arch.cc')
-rw-r--r-- | mistral/arch.cc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/mistral/arch.cc b/mistral/arch.cc index 034ecb98..f61d07ab 100644 --- a/mistral/arch.cc +++ b/mistral/arch.cc @@ -43,6 +43,42 @@ void IdString::initialize_arch(const BaseCtx *ctx) #undef X } +CycloneV::rnode_t Arch::find_rnode(CycloneV::block_type_t bt, int x, int y, CycloneV::port_type_t port, int bi, int pi) const +{ + auto pn1 = CycloneV::pnode(bt, x, y, port, bi, pi); + auto rn1 = cyclonev->pnode_to_rnode(pn1); + if(rn1) + return rn1; + + if(bt == CycloneV::GPIO) { + auto pn2 = cyclonev->p2p_to(pn1); + if(!pn2) { + auto pnv = cyclonev->p2p_from(pn1); + if(!pnv.empty()) + pn2 = pnv[0]; + } + auto pn3 = cyclonev->hmc_get_bypass(pn2); + auto rn2 = cyclonev->pnode_to_rnode(pn3); + return rn2; + } + + return 0; +} + +WireId Arch::get_port(CycloneV::block_type_t bt, int x, int y, int bi, CycloneV::port_type_t port, int pi) const +{ + auto rn = find_rnode(bt, x, y, port, bi, pi); + if(rn) + return WireId(rn); + + log_error("Trying to connect unknown node %s\n", CycloneV::pn2s(CycloneV::pnode(bt, x, y, port, bi, pi)).c_str()); +} + +bool Arch::has_port(CycloneV::block_type_t bt, int x, int y, int bi, CycloneV::port_type_t port, int pi) const +{ + return find_rnode(bt, x, y, port, bi, pi) != 0; +} + Arch::Arch(ArchArgs args) { this->args = args; |