Add ability to override Cluster methods in Himbaechel

This commit is contained in:
Miodrag Milanovic 2023-12-11 11:10:52 +01:00 committed by myrtle
parent 6d9322457e
commit b4ca68c8ef
3 changed files with 37 additions and 1 deletions

View File

@ -684,7 +684,20 @@ struct Arch : BaseArch<ArchRanges>
// ------------------------------------------------
// clusters: BaseArch; for now
// Cluster methods
CellInfo *getClusterRootCell(ClusterId cluster) const override { return uarch->getClusterRootCell(cluster); }
BoundingBox getClusterBounds(ClusterId cluster) const override { return uarch->getClusterBounds(cluster); }
Loc getClusterOffset(const CellInfo *cell) const override { return uarch->getClusterOffset(cell); }
bool isClusterStrict(const CellInfo *cell) const override { return uarch->isClusterStrict(cell); }
bool getClusterPlacement(ClusterId cluster, BelId root_bel,
std::vector<std::pair<CellInfo *, BelId>> &placement) const override
{
return uarch->getClusterPlacement(cluster, root_bel, placement);
}
// ------------------------------------------------
bool pack() override;

View File

@ -69,6 +69,22 @@ BoundingBox HimbaechelAPI::getRouteBoundingBox(WireId src, WireId dst) const
return bb;
}
CellInfo *HimbaechelAPI::getClusterRootCell(ClusterId cluster) const
{
return ctx->BaseArch::getClusterRootCell(cluster);
}
BoundingBox HimbaechelAPI::getClusterBounds(ClusterId cluster) const
{
return ctx->BaseArch::getClusterBounds(cluster);
}
Loc HimbaechelAPI::getClusterOffset(const CellInfo *cell) const { return ctx->BaseArch::getClusterOffset(cell); }
bool HimbaechelAPI::isClusterStrict(const CellInfo *cell) const { return ctx->BaseArch::isClusterStrict(cell); }
bool HimbaechelAPI::getClusterPlacement(ClusterId cluster, BelId root_bel,
std::vector<std::pair<CellInfo *, BelId>> &placement) const
{
return ctx->BaseArch::getClusterPlacement(cluster, root_bel, placement);
}
HimbaechelArch *HimbaechelArch::list_head;
HimbaechelArch::HimbaechelArch(const std::string &name) : name(name)
{

View File

@ -95,6 +95,13 @@ struct HimbaechelAPI
// Cell->bel pin mapping
virtual bool map_cell_bel_pins(CellInfo *cell) const { return false; }
// Cluster
virtual CellInfo *getClusterRootCell(ClusterId cluster) const;
virtual BoundingBox getClusterBounds(ClusterId cluster) const;
virtual Loc getClusterOffset(const CellInfo *cell) const;
virtual bool isClusterStrict(const CellInfo *cell) const;
virtual bool getClusterPlacement(ClusterId cluster, BelId root_bel,
std::vector<std::pair<CellInfo *, BelId>> &placement) const;
// --- Flow hooks ---
virtual void pack(){}; // replaces the pack function
// Called before and after main placement and routing