Merge pull request #791 from yrabbit/wip

gowin: Add support for IOBUF and TBUF I/O modes. Change the constraint parser.
This commit is contained in:
gatecat 2021-08-06 10:14:59 +01:00 committed by GitHub
commit dd63764331
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 7 deletions

View File

@ -485,8 +485,9 @@ DelayQuad Arch::getWireTypeDelay(IdString wire)
void Arch::read_cst(std::istream &in)
{
std::regex iobre = std::regex("IO_LOC +\"([^\"]+)\" +([^ ;]+) *;.*");
std::regex portre = std::regex("IO_PORT +\"([^\"]+)\" +([^ =;]+=[^ =;]+) *;.*");
std::smatch match;
std::regex portre = std::regex("IO_PORT +\"([^\"]+)\" +([^;]+;).*");
std::regex port_attrre = std::regex("([^ =;]+=[^ =;]+) *([^;]*;)");
std::smatch match, match_attr;
std::string line;
bool io_loc;
while (!in.eof()) {
@ -517,10 +518,14 @@ void Arch::read_cst(std::istream &in)
std::string bel = IdString(belname->src_id).str(this);
it->second->attrs[IdString(ID_BEL)] = bel;
} else { // IO_PORT attr=value
std::string attr = "&";
attr += match[2];
boost::algorithm::to_upper(attr);
it->second->attrs[id(attr)] = 1;
std::string attr_val = match[2];
while (std::regex_match(attr_val, match_attr, port_attrre)) {
std::string attr = "&";
attr += match_attr[1];
boost::algorithm::to_upper(attr);
it->second->attrs[id(attr)] = 1;
attr_val = match_attr[2];
}
}
}
}

View File

@ -229,8 +229,10 @@ static void pack_io(Context *ctx)
iob = net_only_drives(ctx, ci->ports.at(id_O).net, is_nextpnr_iob, id_I);
break;
case ID_IOBUF:
iob = net_driven_by(ctx, ci->ports.at(id_IO).net, is_nextpnr_iob, id_O);
break;
case ID_TBUF:
log_error("untested tristate stuff");
iob = net_only_drives(ctx, ci->ports.at(id_O).net, is_nextpnr_iob, id_I);
break;
default:
break;