diff options
author | William D. Jones <thor0505@comcast.net> | 2017-12-31 01:34:36 -0500 |
---|---|---|
committer | William D. Jones <thor0505@comcast.net> | 2017-12-31 01:34:36 -0500 |
commit | c093efc01558a56a0ab2ee35d0c896ce3f692bbe (patch) | |
tree | 4f48d85bd9612f687abd88e89cbb30e7f40fa200 | |
parent | 4f9c036a729b3ee05098efe901d13af592e63c98 (diff) | |
download | icestorm-c093efc01558a56a0ab2ee35d0c896ce3f692bbe.tar.gz icestorm-c093efc01558a56a0ab2ee35d0c896ce3f692bbe.tar.bz2 icestorm-c093efc01558a56a0ab2ee35d0c896ce3f692bbe.zip |
Add nosleep field to FpgaConfig- read_bits recognizes the option.
-rw-r--r-- | icepack/icepack.cc | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/icepack/icepack.cc b/icepack/icepack.cc index b67241f..b1d0bc6 100644 --- a/icepack/icepack.cc +++ b/icepack/icepack.cc @@ -98,6 +98,7 @@ struct FpgaConfig { string device; string freqrange; + string nosleep; string warmboot; // cram[BANK][X][Y] @@ -376,13 +377,28 @@ void FpgaConfig::read_bits(std::istream &ifs) break; case 0x90: - if (payload == 0) - this->warmboot = "disabled"; - else if (payload == 32) - this->warmboot = "enabled"; - else - error("Unknown warmboot payload 0x%02x\n", payload); - info("Setting warmboot to '%s'.\n", this->warmboot.c_str()); + switch(payload) + { + case 0: + this->warmboot = "disabled"; + this->nosleep = "disabled"; + break; + 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; 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_x = 0; cram_x < this->cram_width; cram_x++) cram_bits.push_back(this->cram[cram_bank][cram_x][cram_y]); - + if(this->device == "5k") { debug("CRAM: Setting bank height to %d.\n", height); 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); } - + debug("CRAM: Setting bank %d.\n", cram_bank); write_byte(ofs, crc_value, file_offset, 0x11); 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") 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; std::set<tile_bit_t> tile_bits; @@ -1251,6 +1271,9 @@ void usage() log(" -v\n"); log(" verbose (repeat to increase verbosity)\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(" write cram bitmap as netpbm file\n"); log("\n"); @@ -1274,6 +1297,7 @@ int main(int argc, char **argv) { vector<string> parameters; bool unpack_mode = false; + bool nosleep_mode = false; bool netpbm_mode = false; bool netpbm_bram = false; bool netpbm_fill_tiles = false; @@ -1308,6 +1332,8 @@ int main(int argc, char **argv) } else if (arg[i] == 'B') { netpbm_mode = true; netpbm_banknum = arg[++i] - '0'; + } else if (arg[i] == 's') { + nosleep_mode = true; } else if (arg[i] == 'v') { log_level++; } else |