mirror of https://github.com/YosysHQ/icestorm.git
option for icepack to skip initializing BRAM (tested for ice40hx8k)
This commit is contained in:
parent
dd8c003e79
commit
992d8c97ea
|
|
@ -112,6 +112,7 @@ struct FpgaConfig
|
||||||
// bram[BANK][X][Y]
|
// bram[BANK][X][Y]
|
||||||
int bram_width, bram_height;
|
int bram_width, bram_height;
|
||||||
vector<vector<vector<bool>>> bram;
|
vector<vector<vector<bool>>> bram;
|
||||||
|
bool skip_bram_initialization;
|
||||||
|
|
||||||
// data before preamble
|
// data before preamble
|
||||||
vector<uint8_t> initblop;
|
vector<uint8_t> initblop;
|
||||||
|
|
@ -579,18 +580,20 @@ void FpgaConfig::write_bits(std::ostream &ofs) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
debug("BRAM: Writing bank %d data.\n", bram_bank);
|
if (!this->skip_bram_initialization) {
|
||||||
write_byte(ofs, crc_value, file_offset, 0x01);
|
debug("BRAM: Writing bank %d data.\n", bram_bank);
|
||||||
write_byte(ofs, crc_value, file_offset, 0x03);
|
write_byte(ofs, crc_value, file_offset, 0x01);
|
||||||
for (int i = 0; i < int(bram_bits.size()); i += 8) {
|
write_byte(ofs, crc_value, file_offset, 0x03);
|
||||||
uint8_t byte = 0;
|
for (int i = 0; i < int(bram_bits.size()); i += 8) {
|
||||||
for (int j = 0; j < 8; j++)
|
uint8_t byte = 0;
|
||||||
byte = (byte << 1) | (bram_bits[i+j] ? 1 : 0);
|
for (int j = 0; j < 8; j++)
|
||||||
write_byte(ofs, crc_value, file_offset, byte);
|
byte = (byte << 1) | (bram_bits[i+j] ? 1 : 0);
|
||||||
}
|
write_byte(ofs, crc_value, file_offset, byte);
|
||||||
|
}
|
||||||
|
|
||||||
write_byte(ofs, crc_value, file_offset, 0x00);
|
write_byte(ofs, crc_value, file_offset, 0x00);
|
||||||
write_byte(ofs, crc_value, file_offset, 0x00);
|
write_byte(ofs, crc_value, file_offset, 0x00);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1348,6 +1351,9 @@ void usage()
|
||||||
log(" -B0, -B1, -B2, -B3\n");
|
log(" -B0, -B1, -B2, -B3\n");
|
||||||
log(" only include the specified bank in the netpbm file\n");
|
log(" only include the specified bank in the netpbm file\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
|
log(" -n\n");
|
||||||
|
log(" skip initializing BRAM\n");
|
||||||
|
log("\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1372,6 +1378,7 @@ int main(int argc, char **argv)
|
||||||
bool netpbm_bram = false;
|
bool netpbm_bram = false;
|
||||||
bool netpbm_fill_tiles = false;
|
bool netpbm_fill_tiles = false;
|
||||||
bool netpbm_checkerboard = false;
|
bool netpbm_checkerboard = false;
|
||||||
|
bool skip_bram_initialization = false;
|
||||||
int netpbm_banknum = -1;
|
int netpbm_banknum = -1;
|
||||||
int checkerboard_m = 1;
|
int checkerboard_m = 1;
|
||||||
|
|
||||||
|
|
@ -1406,6 +1413,8 @@ int main(int argc, char **argv)
|
||||||
nosleep_mode = true;
|
nosleep_mode = true;
|
||||||
} else if (arg[i] == 'v') {
|
} else if (arg[i] == 'v') {
|
||||||
log_level++;
|
log_level++;
|
||||||
|
} else if (arg[i] == 'n') {
|
||||||
|
skip_bram_initialization = true;
|
||||||
} else
|
} else
|
||||||
usage();
|
usage();
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1442,6 +1451,8 @@ int main(int argc, char **argv)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
FpgaConfig fpga_config;
|
FpgaConfig fpga_config;
|
||||||
|
|
||||||
|
fpga_config.skip_bram_initialization = skip_bram_initialization;
|
||||||
|
|
||||||
if (unpack_mode) {
|
if (unpack_mode) {
|
||||||
fpga_config.read_bits(*isp);
|
fpga_config.read_bits(*isp);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue