Skip to content

Commit

Permalink
Add ability to override Cluster methods in Himbaechel
Browse files Browse the repository at this point in the history
  • Loading branch information
mmicko authored and gatecat committed Dec 11, 2023
1 parent 6d93224 commit b4ca68c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
15 changes: 14 additions & 1 deletion himbaechel/arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 16 additions & 0 deletions himbaechel/himbaechel_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
7 changes: 7 additions & 0 deletions himbaechel/himbaechel_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b4ca68c

Please sign in to comment.