fabulous: Improve names for BRAM bels
Signed-off-by: gatecat <gatecat@ds0.me>
This commit is contained in:
parent
1226fad4f6
commit
eb70e95079
@ -68,6 +68,14 @@ struct parser_view
|
|||||||
return npos;
|
return npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t rfind(char tok) const
|
||||||
|
{
|
||||||
|
for (size_t i = m_length; i > 0; i--)
|
||||||
|
if (m_ptr[i - 1] == tok)
|
||||||
|
return i - 1;
|
||||||
|
return npos;
|
||||||
|
}
|
||||||
|
|
||||||
IdString to_id(const BaseCtx *ctx)
|
IdString to_id(const BaseCtx *ctx)
|
||||||
{
|
{
|
||||||
// This isn't really ideal, let's hope one day we can move to C++20 and have proper string_views instead :3
|
// This isn't really ideal, let's hope one day we can move to C++20 and have proper string_views instead :3
|
||||||
@ -133,6 +141,12 @@ struct parser_view
|
|||||||
NPNR_ASSERT(pos != npos);
|
NPNR_ASSERT(pos != npos);
|
||||||
return std::make_pair(parser_view(m_ptr, pos), parser_view(m_ptr + pos + 1, m_length - (pos + 1)));
|
return std::make_pair(parser_view(m_ptr, pos), parser_view(m_ptr + pos + 1, m_length - (pos + 1)));
|
||||||
}
|
}
|
||||||
|
std::pair<parser_view, parser_view> rsplit(char delim) const
|
||||||
|
{
|
||||||
|
size_t pos = rfind(delim);
|
||||||
|
NPNR_ASSERT(pos != npos);
|
||||||
|
return std::make_pair(parser_view(m_ptr, pos), parser_view(m_ptr + pos + 1, m_length - (pos + 1)));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CsvParser
|
struct CsvParser
|
||||||
|
@ -237,6 +237,16 @@ struct FabulousImpl : ViaductAPI
|
|||||||
NPNR_ASSERT(bel_idx.size() == 1);
|
NPNR_ASSERT(bel_idx.size() == 1);
|
||||||
int bel_z = bel_idx[0] - 'A';
|
int bel_z = bel_idx[0] - 'A';
|
||||||
NPNR_ASSERT(bel_z >= 0 && bel_z < 26);
|
NPNR_ASSERT(bel_z >= 0 && bel_z < 26);
|
||||||
|
std::vector<parser_view> ports;
|
||||||
|
parser_view port;
|
||||||
|
while (!(port = csv.next_field()).empty()) {
|
||||||
|
ports.push_back(port);
|
||||||
|
}
|
||||||
|
IdString bel_name = bel_idx.to_id(ctx);
|
||||||
|
if (bel_type.in(id_InPass4_frame_config, id_OutPass4_frame_config)) {
|
||||||
|
// Assign BRAM IO a nicer name than just a letter
|
||||||
|
bel_name = ports.front().rsplit('_').first.to_id(ctx);
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
In the future we will need to handle optionally splitting SLICEs into separate LUT/COMB and FF bels
|
In the future we will need to handle optionally splitting SLICEs into separate LUT/COMB and FF bels
|
||||||
This is the preferred approach in nextpnr for arches where the LUT and FF can be used separately of
|
This is the preferred approach in nextpnr for arches where the LUT and FF can be used separately of
|
||||||
@ -245,12 +255,7 @@ struct FabulousImpl : ViaductAPI
|
|||||||
While this isn't yet the standard fabulous SLICE, it should be considered as a future option in fabulous.
|
While this isn't yet the standard fabulous SLICE, it should be considered as a future option in fabulous.
|
||||||
*/
|
*/
|
||||||
Loc loc(bel_x, bel_y, bel_z);
|
Loc loc(bel_x, bel_y, bel_z);
|
||||||
BelId bel = ctx->addBel(IdStringList::concat(tile, bel_idx.to_id(ctx)), bel_type, loc, false, false);
|
BelId bel = ctx->addBel(IdStringList::concat(tile, bel_name), bel_type, loc, false, false);
|
||||||
std::vector<parser_view> ports;
|
|
||||||
parser_view port;
|
|
||||||
while (!(port = csv.next_field()).empty()) {
|
|
||||||
ports.push_back(port);
|
|
||||||
}
|
|
||||||
handle_bel_ports(bel, tile, bel_type, ports);
|
handle_bel_ports(bel, tile, bel_type, ports);
|
||||||
}
|
}
|
||||||
postprocess_bels();
|
postprocess_bels();
|
||||||
|
Loading…
Reference in New Issue
Block a user