diff --git a/himbaechel/uarch/gatemate/ccf.cc b/himbaechel/uarch/gatemate/ccf.cc index b6570608..16620d77 100644 --- a/himbaechel/uarch/gatemate/ccf.cc +++ b/himbaechel/uarch/gatemate/ccf.cc @@ -261,6 +261,9 @@ struct GateMateCCFReader log("size = %d src=%s pB=(%d,%d, %d,%d)\n", size, src_location.c_str(), x1, y1, x2, y2); + IdString scopename(ctx, src_location.c_str()); + ctx->createRectangularRegion(scopename, x1, y1, x2, y2); + uarch->scopenames.emplace(scopename); } else { log_error("Placebox format invalid: %s in line %d\n", pb_position.c_str(), lineno); } diff --git a/himbaechel/uarch/gatemate/gatemate.h b/himbaechel/uarch/gatemate/gatemate.h index 7298325a..31aab310 100644 --- a/himbaechel/uarch/gatemate/gatemate.h +++ b/himbaechel/uarch/gatemate/gatemate.h @@ -109,6 +109,7 @@ struct GateMateImpl : HimbaechelAPI MultiDieStrategy strategy; dict index_to_die; dict die_to_index; + pool scopenames; private: bool getChildPlacement(const BaseClusterInfo *cluster, Loc root_loc, diff --git a/himbaechel/uarch/gatemate/pack.cc b/himbaechel/uarch/gatemate/pack.cc index cac93631..f6223515 100644 --- a/himbaechel/uarch/gatemate/pack.cc +++ b/himbaechel/uarch/gatemate/pack.cc @@ -519,6 +519,17 @@ void GateMatePacker::assign_regions() log_info("Assign cell region based on attributes..\n"); for (auto &cell : ctx->cells) { CellInfo &ci = *cell.second; + std::string scope = "top"; + if (ci.attrs.count(ctx->id("scopename"))) { + scope = str_or_default(ci.attrs, ctx->id("scopename"), ""); + scope = "top " + scope; + } else if (ci.attrs.count(ctx->id("hdlname"))) { + scope = str_or_default(ci.attrs, ctx->id("hdlname"), ""); + scope = "top " + scope; + } + IdString name = IdString(ctx,scope.c_str()); + if (uarch->scopenames.count(name)) + ctx->constrainCellToRegion(ci.name, name); if (ci.attrs.count(id_GATEMATE_DIE) != 0) { std::string die_name = str_or_default(ci.attrs, id_GATEMATE_DIE, ""); IdString die = ctx->id(die_name);