Add nosleep field to FpgaConfig- read_bits recognizes the option.

This commit is contained in:
William D. Jones 2017-12-31 01:34:36 -05:00
parent 4f9c036a72
commit c093efc015
1 changed files with 35 additions and 9 deletions

View File

@ -98,6 +98,7 @@ struct FpgaConfig
{ {
string device; string device;
string freqrange; string freqrange;
string nosleep;
string warmboot; string warmboot;
// cram[BANK][X][Y] // cram[BANK][X][Y]
@ -376,13 +377,28 @@ void FpgaConfig::read_bits(std::istream &ifs)
break; break;
case 0x90: case 0x90:
if (payload == 0) switch(payload)
this->warmboot = "disabled"; {
else if (payload == 32) case 0:
this->warmboot = "enabled"; this->warmboot = "disabled";
else this->nosleep = "disabled";
error("Unknown warmboot payload 0x%02x\n", payload); break;
info("Setting warmboot to '%s'.\n", this->warmboot.c_str()); case 1:
this->warmboot = "disabled";
this->nosleep = "enabled";
break;
case 32:
this->warmboot = "enabled";
this->nosleep = "disabled";
break;
case 33:
this->warmboot = "enabled";
this->nosleep = "enabled";
break;
default:
error("Unknown warmboot/nosleep payload 0x%02x\n", payload);
}
info("Setting warmboot to '%s', nosleep to '%s'.\n", this->warmboot.c_str(), this->nosleep.c_str());
break; break;
default: default:
@ -472,14 +488,14 @@ void FpgaConfig::write_bits(std::ostream &ofs) const
for (int cram_y = 0; cram_y < height; cram_y++) for (int cram_y = 0; cram_y < height; cram_y++)
for (int cram_x = 0; cram_x < this->cram_width; cram_x++) for (int cram_x = 0; cram_x < this->cram_width; cram_x++)
cram_bits.push_back(this->cram[cram_bank][cram_x][cram_y]); cram_bits.push_back(this->cram[cram_bank][cram_x][cram_y]);
if(this->device == "5k") { if(this->device == "5k") {
debug("CRAM: Setting bank height to %d.\n", height); debug("CRAM: Setting bank height to %d.\n", height);
write_byte(ofs, crc_value, file_offset, 0x72); write_byte(ofs, crc_value, file_offset, 0x72);
write_byte(ofs, crc_value, file_offset, height >> 8); write_byte(ofs, crc_value, file_offset, height >> 8);
write_byte(ofs, crc_value, file_offset, height); write_byte(ofs, crc_value, file_offset, height);
} }
debug("CRAM: Setting bank %d.\n", cram_bank); debug("CRAM: Setting bank %d.\n", cram_bank);
write_byte(ofs, crc_value, file_offset, 0x11); write_byte(ofs, crc_value, file_offset, 0x11);
write_byte(ofs, crc_value, file_offset, cram_bank); write_byte(ofs, crc_value, file_offset, cram_bank);
@ -821,6 +837,10 @@ void FpgaConfig::write_ascii(std::ostream &ofs) const
if (this->warmboot != "enabled") if (this->warmboot != "enabled")
ofs << stringf(".warmboot %s\n", this->warmboot.c_str()); ofs << stringf(".warmboot %s\n", this->warmboot.c_str());
// As "nosleep" is an icepack command, we do not write out a ".nosleep"
// section. However, we parse it in read_bits() and notify the user in
// info.
typedef std::tuple<int, int, int> tile_bit_t; typedef std::tuple<int, int, int> tile_bit_t;
std::set<tile_bit_t> tile_bits; std::set<tile_bit_t> tile_bits;
@ -1251,6 +1271,9 @@ void usage()
log(" -v\n"); log(" -v\n");
log(" verbose (repeat to increase verbosity)\n"); log(" verbose (repeat to increase verbosity)\n");
log("\n"); log("\n");
log(" -s\n");
log(" disable final deep-sleep SPI flash command after bitstream is loaded\n");
log("\n");
log(" -b\n"); log(" -b\n");
log(" write cram bitmap as netpbm file\n"); log(" write cram bitmap as netpbm file\n");
log("\n"); log("\n");
@ -1274,6 +1297,7 @@ int main(int argc, char **argv)
{ {
vector<string> parameters; vector<string> parameters;
bool unpack_mode = false; bool unpack_mode = false;
bool nosleep_mode = false;
bool netpbm_mode = false; bool netpbm_mode = false;
bool netpbm_bram = false; bool netpbm_bram = false;
bool netpbm_fill_tiles = false; bool netpbm_fill_tiles = false;
@ -1308,6 +1332,8 @@ int main(int argc, char **argv)
} else if (arg[i] == 'B') { } else if (arg[i] == 'B') {
netpbm_mode = true; netpbm_mode = true;
netpbm_banknum = arg[++i] - '0'; netpbm_banknum = arg[++i] - '0';
} else if (arg[i] == 's') {
nosleep_mode = true;
} else if (arg[i] == 'v') { } else if (arg[i] == 'v') {
log_level++; log_level++;
} else } else