gowin: Himbaechel, fix style
Run clang-format Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
This commit is contained in:
parent
e4d2e1bd85
commit
f7fbe0db04
@ -7,7 +7,8 @@
|
|||||||
|
|
||||||
NEXTPNR_NAMESPACE_BEGIN
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
void GowinImpl::init(Context *ctx) {
|
void GowinImpl::init(Context *ctx)
|
||||||
|
{
|
||||||
h.init(ctx);
|
h.init(ctx);
|
||||||
HimbaechelAPI::init(ctx);
|
HimbaechelAPI::init(ctx);
|
||||||
// These fields go in the header of the output JSON file and can help
|
// These fields go in the header of the output JSON file and can help
|
||||||
@ -18,7 +19,8 @@ void GowinImpl::init(Context *ctx) {
|
|||||||
// Arch::archArgsToId
|
// Arch::archArgsToId
|
||||||
}
|
}
|
||||||
|
|
||||||
void GowinImpl::prePlace() {
|
void GowinImpl::prePlace()
|
||||||
|
{
|
||||||
ctx->cells.at(ctx->id("leds_OBUF_O"))->setAttr(ctx->id("BEL"), std::string("X0Y14/IOBA"));
|
ctx->cells.at(ctx->id("leds_OBUF_O"))->setAttr(ctx->id("BEL"), std::string("X0Y14/IOBA"));
|
||||||
ctx->cells.at(ctx->id("leds_OBUF_O_1"))->setAttr(ctx->id("BEL"), std::string("X0Y15/IOBB"));
|
ctx->cells.at(ctx->id("leds_OBUF_O_1"))->setAttr(ctx->id("BEL"), std::string("X0Y15/IOBB"));
|
||||||
ctx->cells.at(ctx->id("leds_OBUF_O_2"))->setAttr(ctx->id("BEL"), std::string("X0Y20/IOBB"));
|
ctx->cells.at(ctx->id("leds_OBUF_O_2"))->setAttr(ctx->id("BEL"), std::string("X0Y20/IOBB"));
|
||||||
@ -29,7 +31,8 @@ void GowinImpl::prePlace() {
|
|||||||
assign_cell_info();
|
assign_cell_info();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GowinImpl::pack() {
|
void GowinImpl::pack()
|
||||||
|
{
|
||||||
// Trim nextpnr IOBs - assume IO buffer insertion has been done in synthesis
|
// Trim nextpnr IOBs - assume IO buffer insertion has been done in synthesis
|
||||||
const pool<CellTypePort> top_ports{
|
const pool<CellTypePort> top_ports{
|
||||||
CellTypePort(id_IBUF, id_I),
|
CellTypePort(id_IBUF, id_I),
|
||||||
@ -51,11 +54,13 @@ void GowinImpl::pack() {
|
|||||||
{id_DFFS, id_D}, {id_DFFSE, id_D}, {id_DFFNS, id_D}, {id_DFFNSE, id_D},
|
{id_DFFS, id_D}, {id_DFFSE, id_D}, {id_DFFNS, id_D}, {id_DFFNSE, id_D},
|
||||||
{id_DFFR, id_D}, {id_DFFRE, id_D}, {id_DFFNR, id_D}, {id_DFFNRE, id_D},
|
{id_DFFR, id_D}, {id_DFFRE, id_D}, {id_DFFNR, id_D}, {id_DFFNRE, id_D},
|
||||||
{id_DFFP, id_D}, {id_DFFPE, id_D}, {id_DFFNP, id_D}, {id_DFFNPE, id_D},
|
{id_DFFP, id_D}, {id_DFFPE, id_D}, {id_DFFNP, id_D}, {id_DFFNPE, id_D},
|
||||||
{id_DFFC, id_D}, {id_DFFCE, id_D}, {id_DFFNC, id_D}, {id_DFFNCE, id_D}},1);
|
{id_DFFC, id_D}, {id_DFFCE, id_D}, {id_DFFNC, id_D}, {id_DFFNCE, id_D}},
|
||||||
|
1);
|
||||||
log_info("Constrained %d LUTFF pairs.\n", lutffs);
|
log_info("Constrained %d LUTFF pairs.\n", lutffs);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GowinImpl::isBelLocationValid(BelId bel, bool explain_invalid) const {
|
bool GowinImpl::isBelLocationValid(BelId bel, bool explain_invalid) const
|
||||||
|
{
|
||||||
Loc l = ctx->getBelLocation(bel);
|
Loc l = ctx->getBelLocation(bel);
|
||||||
if (ctx->getBelType(bel).in(id_LUT4, id_DFF)) {
|
if (ctx->getBelType(bel).in(id_LUT4, id_DFF)) {
|
||||||
return slice_valid(l.x, l.y, l.z / 2);
|
return slice_valid(l.x, l.y, l.z / 2);
|
||||||
@ -65,7 +70,8 @@ bool GowinImpl::isBelLocationValid(BelId bel, bool explain_invalid) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Bel bucket functions
|
// Bel bucket functions
|
||||||
IdString GowinImpl::getBelBucketForCellType(IdString cell_type) const {
|
IdString GowinImpl::getBelBucketForCellType(IdString cell_type) const
|
||||||
|
{
|
||||||
if (cell_type.in(id_IBUF, id_OBUF)) {
|
if (cell_type.in(id_IBUF, id_OBUF)) {
|
||||||
return id_IOB;
|
return id_IOB;
|
||||||
}
|
}
|
||||||
@ -84,7 +90,8 @@ IdString GowinImpl::getBelBucketForCellType(IdString cell_type) const {
|
|||||||
return cell_type;
|
return cell_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GowinImpl::isValidBelForCellType(IdString cell_type, BelId bel) const {
|
bool GowinImpl::isValidBelForCellType(IdString cell_type, BelId bel) const
|
||||||
|
{
|
||||||
IdString bel_type = ctx->getBelType(bel);
|
IdString bel_type = ctx->getBelType(bel);
|
||||||
if (bel_type == id_IOB) {
|
if (bel_type == id_IOB) {
|
||||||
return cell_type.in(id_IBUF, id_OBUF);
|
return cell_type.in(id_IBUF, id_OBUF);
|
||||||
@ -104,7 +111,8 @@ bool GowinImpl::isValidBelForCellType(IdString cell_type, BelId bel) const {
|
|||||||
return (bel_type == cell_type);
|
return (bel_type == cell_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GowinImpl::assign_cell_info() {
|
void GowinImpl::assign_cell_info()
|
||||||
|
{
|
||||||
fast_cell_info.resize(ctx->cells.size());
|
fast_cell_info.resize(ctx->cells.size());
|
||||||
for (auto &cell : ctx->cells) {
|
for (auto &cell : ctx->cells) {
|
||||||
CellInfo *ci = cell.second.get();
|
CellInfo *ci = cell.second.get();
|
||||||
@ -125,7 +133,8 @@ void GowinImpl::assign_cell_info() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GowinImpl::slice_valid(int x, int y, int z) const {
|
bool GowinImpl::slice_valid(int x, int y, int z) const
|
||||||
|
{
|
||||||
const CellInfo *lut = ctx->getBoundBelCell(ctx->getBelByLocation(Loc(x, y, z * 2)));
|
const CellInfo *lut = ctx->getBoundBelCell(ctx->getBelByLocation(Loc(x, y, z * 2)));
|
||||||
const CellInfo *ff = ctx->getBoundBelCell(ctx->getBelByLocation(Loc(x, y, z * 2 + 1)));
|
const CellInfo *ff = ctx->getBoundBelCell(ctx->getBelByLocation(Loc(x, y, z * 2 + 1)));
|
||||||
if (!ff) {
|
if (!ff) {
|
||||||
@ -144,23 +153,19 @@ bool GowinImpl::slice_valid(int x, int y, int z) const {
|
|||||||
}
|
}
|
||||||
// DFFs must be same type or compatible
|
// DFFs must be same type or compatible
|
||||||
if (ff->type != adj_ff->type &&
|
if (ff->type != adj_ff->type &&
|
||||||
( (ff->type.in(id_DFFS) && !adj_ff->type.in(id_DFFR))
|
((ff->type.in(id_DFFS) && !adj_ff->type.in(id_DFFR)) || (ff->type.in(id_DFFR) && !adj_ff->type.in(id_DFFS)) ||
|
||||||
|| (ff->type.in(id_DFFR) && !adj_ff->type.in(id_DFFS))
|
(ff->type.in(id_DFFSE) && !adj_ff->type.in(id_DFFRE)) ||
|
||||||
|| (ff->type.in(id_DFFSE) && !adj_ff->type.in(id_DFFRE))
|
(ff->type.in(id_DFFRE) && !adj_ff->type.in(id_DFFSE)) || (ff->type.in(id_DFFP) && !adj_ff->type.in(id_DFFC)) ||
|
||||||
|| (ff->type.in(id_DFFRE) && !adj_ff->type.in(id_DFFSE))
|
(ff->type.in(id_DFFC) && !adj_ff->type.in(id_DFFP)) || (ff->type.in(id_DFFPE) && !adj_ff->type.in(id_DFFCE)) ||
|
||||||
|| (ff->type.in(id_DFFP) && !adj_ff->type.in(id_DFFC))
|
(ff->type.in(id_DFFCE) && !adj_ff->type.in(id_DFFPE)) ||
|
||||||
|| (ff->type.in(id_DFFC) && !adj_ff->type.in(id_DFFP))
|
(ff->type.in(id_DFFNS) && !adj_ff->type.in(id_DFFNR)) ||
|
||||||
|| (ff->type.in(id_DFFPE) && !adj_ff->type.in(id_DFFCE))
|
(ff->type.in(id_DFFNR) && !adj_ff->type.in(id_DFFNS)) ||
|
||||||
|| (ff->type.in(id_DFFCE) && !adj_ff->type.in(id_DFFPE))
|
(ff->type.in(id_DFFNSE) && !adj_ff->type.in(id_DFFNRE)) ||
|
||||||
|| (ff->type.in(id_DFFNS) && !adj_ff->type.in(id_DFFNR))
|
(ff->type.in(id_DFFNRE) && !adj_ff->type.in(id_DFFNSE)) ||
|
||||||
|| (ff->type.in(id_DFFNR) && !adj_ff->type.in(id_DFFNS))
|
(ff->type.in(id_DFFNP) && !adj_ff->type.in(id_DFFNC)) ||
|
||||||
|| (ff->type.in(id_DFFNSE) && !adj_ff->type.in(id_DFFNRE))
|
(ff->type.in(id_DFFNC) && !adj_ff->type.in(id_DFFNP)) ||
|
||||||
|| (ff->type.in(id_DFFNRE) && !adj_ff->type.in(id_DFFNSE))
|
(ff->type.in(id_DFFNPE) && !adj_ff->type.in(id_DFFNCE)) ||
|
||||||
|| (ff->type.in(id_DFFNP) && !adj_ff->type.in(id_DFFNC))
|
(ff->type.in(id_DFFNCE) && !adj_ff->type.in(id_DFFNPE)))) {
|
||||||
|| (ff->type.in(id_DFFNC) && !adj_ff->type.in(id_DFFNP))
|
|
||||||
|| (ff->type.in(id_DFFNPE) && !adj_ff->type.in(id_DFFNCE))
|
|
||||||
|| (ff->type.in(id_DFFNCE) && !adj_ff->type.in(id_DFFNPE))
|
|
||||||
)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +179,8 @@ bool GowinImpl::slice_valid(int x, int y, int z) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// modify LUTs with constant inputs
|
// modify LUTs with constant inputs
|
||||||
void GowinImpl::mod_lut_inputs(void) {
|
void GowinImpl::mod_lut_inputs(void)
|
||||||
|
{
|
||||||
for (IdString netname : {ctx->id("$PACKER_GND"), ctx->id("$PACKER_VCC")}) {
|
for (IdString netname : {ctx->id("$PACKER_GND"), ctx->id("$PACKER_VCC")}) {
|
||||||
auto net = ctx->nets.find(netname);
|
auto net = ctx->nets.find(netname);
|
||||||
if (net == ctx->nets.end()) {
|
if (net == ctx->nets.end()) {
|
||||||
@ -231,6 +237,4 @@ void GowinImpl::mod_lut_inputs(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
@ -46,23 +46,16 @@ struct GowinImpl : HimbaechelAPI
|
|||||||
void mod_lut_inputs(void);
|
void mod_lut_inputs(void);
|
||||||
|
|
||||||
// Return true if a cell is a LUT
|
// Return true if a cell is a LUT
|
||||||
inline bool type_is_lut(IdString cell_type) const {
|
inline bool type_is_lut(IdString cell_type) const { return cell_type.in(id_LUT1, id_LUT2, id_LUT3, id_LUT4); }
|
||||||
return cell_type.in(id_LUT1, id_LUT2, id_LUT3, id_LUT4);
|
inline bool is_lut(const CellInfo *cell) const { return type_is_lut(cell->type); }
|
||||||
}
|
|
||||||
inline bool is_lut(const CellInfo *cell) const {
|
|
||||||
return type_is_lut(cell->type);
|
|
||||||
}
|
|
||||||
// Return true if a cell is a DFF
|
// Return true if a cell is a DFF
|
||||||
inline bool type_is_dff(IdString cell_type) const {
|
inline bool type_is_dff(IdString cell_type) const
|
||||||
return cell_type.in(id_DFF, id_DFFE, id_DFFN, id_DFFNE,
|
{
|
||||||
id_DFFS, id_DFFSE, id_DFFNS, id_DFFNSE,
|
return cell_type.in(id_DFF, id_DFFE, id_DFFN, id_DFFNE, id_DFFS, id_DFFSE, id_DFFNS, id_DFFNSE, id_DFFR,
|
||||||
id_DFFR, id_DFFRE, id_DFFNR, id_DFFNRE,
|
id_DFFRE, id_DFFNR, id_DFFNRE, id_DFFP, id_DFFPE, id_DFFNP, id_DFFNPE, id_DFFC, id_DFFCE,
|
||||||
id_DFFP, id_DFFPE, id_DFFNP, id_DFFNPE,
|
id_DFFNC, id_DFFNCE);
|
||||||
id_DFFC, id_DFFCE, id_DFFNC, id_DFFNCE);
|
|
||||||
}
|
|
||||||
inline bool is_dff(const CellInfo *cell) const {
|
|
||||||
return type_is_dff(cell->type);
|
|
||||||
}
|
}
|
||||||
|
inline bool is_dff(const CellInfo *cell) const { return type_is_dff(cell->type); }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GowinArch : HimbaechelArch
|
struct GowinArch : HimbaechelArch
|
||||||
@ -77,4 +70,3 @@ struct GowinArch : HimbaechelArch
|
|||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user