aboutsummaryrefslogtreecommitdiffstats
path: root/machxo2/arch.h
diff options
context:
space:
mode:
authorWilliam D. Jones <thor0505@comcast.net>2021-01-30 23:14:48 -0500
committergatecat <gatecat@ds0.me>2021-02-12 10:36:59 +0000
commit5415194b39c0e7ade963f5c52f2977f00ed5feeb (patch)
tree305c2872b0da585a025705d13d3207028aa21f5d /machxo2/arch.h
parentcf2db7a4c474569d372c176e9790dd4f6ae24a03 (diff)
downloadnextpnr-5415194b39c0e7ade963f5c52f2977f00ed5feeb.tar.gz
nextpnr-5415194b39c0e7ade963f5c52f2977f00ed5feeb.tar.bz2
nextpnr-5415194b39c0e7ade963f5c52f2977f00ed5feeb.zip
machxo2: Checkpoint commit for slice bitstream generation.
Diffstat (limited to 'machxo2/arch.h')
-rw-r--r--machxo2/arch.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/machxo2/arch.h b/machxo2/arch.h
index 6cca9798..5da12a24 100644
--- a/machxo2/arch.h
+++ b/machxo2/arch.h
@@ -957,6 +957,39 @@ struct Arch : BaseCtx
// Internal usage
void assignArchInfo();
bool cellsCompatible(const CellInfo **cells, int count) const;
+
+ std::vector<std::pair<std::string, std::string>> getTilesAtLocation(int row, int col);
+ std::string getTileByTypeAndLocation(int row, int col, std::string type) const
+ {
+ auto &tileloc = chip_info->tile_info[row * chip_info->width + col];
+ for (int i = 0; i < tileloc.num_tiles; i++) {
+ if (chip_info->tiletype_names[tileloc.tile_names[i].type_idx].get() == type)
+ return tileloc.tile_names[i].name.get();
+ }
+ NPNR_ASSERT_FALSE_STR("no tile at (" + std::to_string(col) + ", " + std::to_string(row) + ") with type " +
+ type);
+ }
+
+ std::string getTileByTypeAndLocation(int row, int col, const std::set<std::string> &type) const
+ {
+ auto &tileloc = chip_info->tile_info[row * chip_info->width + col];
+ for (int i = 0; i < tileloc.num_tiles; i++) {
+ if (type.count(chip_info->tiletype_names[tileloc.tile_names[i].type_idx].get()))
+ return tileloc.tile_names[i].name.get();
+ }
+ NPNR_ASSERT_FALSE_STR("no tile at (" + std::to_string(col) + ", " + std::to_string(row) + ") with type in set");
+ }
+
+ std::string getTileByType(std::string type) const
+ {
+ for (int i = 0; i < chip_info->height * chip_info->width; i++) {
+ auto &tileloc = chip_info->tile_info[i];
+ for (int j = 0; j < tileloc.num_tiles; j++)
+ if (chip_info->tiletype_names[tileloc.tile_names[j].type_idx].get() == type)
+ return tileloc.tile_names[j].name.get();
+ }
+ NPNR_ASSERT_FALSE_STR("no tile with type " + type);
+ }
};
NEXTPNR_NAMESPACE_END