aboutsummaryrefslogtreecommitdiffstats
path: root/icepack/icepack.cc
diff options
context:
space:
mode:
Diffstat (limited to 'icepack/icepack.cc')
-rw-r--r--icepack/icepack.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/icepack/icepack.cc b/icepack/icepack.cc
index 9b38ab5..490bbbf 100644
--- a/icepack/icepack.cc
+++ b/icepack/icepack.cc
@@ -968,7 +968,17 @@ void FpgaConfig::write_cram_pbm(std::ostream &ofs, int bank_num) const
ofs << "P3\n";
ofs << stringf("%d %d\n", 2*this->cram_width, 2*this->cram_height);
ofs << "255\n";
- uint32_t tile_type[4][this->cram_width][this->cram_height];
+
+ vector<vector<uint32_t>> tile_type[4];
+
+ // We require random access to tile_type, so ensure that each column of each
+ // bank is initialised so that all possible indices are valid
+ for (int bank = 0; bank < 4; bank++) {
+ tile_type[bank].resize(this->cram_width);
+ for (int x = 0; x < this->cram_width; x++)
+ tile_type[bank][x].resize(this->cram_height);
+ }
+
for (int y = 0; y <= this->chip_height()+1; y++)
for (int x = 0; x <= this->chip_width()+1; x++)
{