From b4ca68c8ef221e6ba27fd19230a6027452e69e86 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 11 Dec 2023 11:10:52 +0100 Subject: [PATCH] Add ability to override Cluster methods in Himbaechel --- himbaechel/arch.h | 15 ++++++++++++++- himbaechel/himbaechel_api.cc | 16 ++++++++++++++++ himbaechel/himbaechel_api.h | 7 +++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/himbaechel/arch.h b/himbaechel/arch.h index 5590ef99..548d6764 100644 --- a/himbaechel/arch.h +++ b/himbaechel/arch.h @@ -684,7 +684,20 @@ struct Arch : BaseArch // ------------------------------------------------ - // 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> &placement) const override + { + return uarch->getClusterPlacement(cluster, root_bel, placement); + } // ------------------------------------------------ bool pack() override; diff --git a/himbaechel/himbaechel_api.cc b/himbaechel/himbaechel_api.cc index 2a04a99a..0efe5c6f 100644 --- a/himbaechel/himbaechel_api.cc +++ b/himbaechel/himbaechel_api.cc @@ -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> &placement) const +{ + return ctx->BaseArch::getClusterPlacement(cluster, root_bel, placement); +} + HimbaechelArch *HimbaechelArch::list_head; HimbaechelArch::HimbaechelArch(const std::string &name) : name(name) { diff --git a/himbaechel/himbaechel_api.h b/himbaechel/himbaechel_api.h index eaf1a5ed..d68caea8 100644 --- a/himbaechel/himbaechel_api.h +++ b/himbaechel/himbaechel_api.h @@ -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> &placement) const; // --- Flow hooks --- virtual void pack(){}; // replaces the pack function // Called before and after main placement and routing