Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gowin. Fix the port check for connectivity. #1376

Merged
merged 2 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions himbaechel/uarch/gowin/gowin_utils.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef GOWIN_UTILS_H
#define GOWIN_UTILS_H

#include "design_utils.h"
#include "idstringlist.h"
#include "nextpnr_namespaces.h"
#include "nextpnr_types.h"
Expand Down Expand Up @@ -37,6 +38,19 @@ struct GowinUtils
BelId get_dcs_bel(IdString spine_name);
BelId get_dhcen_bel(WireId hclkin_wire, IdString &side);

// ports
inline bool port_used(CellInfo *cell, IdString port_name)
{
if (!nextpnr_himbaechel::port_used(cell, port_name)) {
return false;
}
NetInfo *ni = cell->ports.at(port_name).net;
if (ni->driver.cell == nullptr) {
return false;
}
return ni->users.entries() != 0;
}

// BSRAM
bool has_SP32(void);
bool need_SP_fix(void);
Expand Down
4 changes: 2 additions & 2 deletions himbaechel/uarch/gowin/pack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ struct GowinPacker
}

// if Q1 is connected then disconnect it too
if (port_used(&ci, tx_port)) {
if (gwu.port_used(&ci, tx_port)) {
NPNR_ASSERT(out_iob == net_only_drives(ctx, ci.ports.at(tx_port).net, is_iob, id_OEN, true));
nets_to_remove.push_back(ci.getPort(tx_port)->name);
out_iob->disconnectPort(id_OEN);
Expand Down Expand Up @@ -3160,7 +3160,7 @@ struct GowinPacker
// add invertor
int lut_idx = 0;
auto add_inv = [&](IdString port, PortType port_type) {
if (!port_used(&ci, port)) {
if (!gwu.port_used(&ci, port)) {
return;
}

Expand Down