mirror of https://github.com/YosysHQ/icestorm.git
Enable writing nosleep config bit into output bitstream.
This commit is contained in:
parent
c093efc015
commit
182e9350de
|
|
@ -117,7 +117,7 @@ struct FpgaConfig
|
||||||
void write_bits(std::ostream &ofs) const;
|
void write_bits(std::ostream &ofs) const;
|
||||||
|
|
||||||
// icebox i/o
|
// icebox i/o
|
||||||
void read_ascii(std::istream &ifs);
|
void read_ascii(std::istream &ifs, bool nosleep);
|
||||||
void write_ascii(std::ostream &ofs) const;
|
void write_ascii(std::ostream &ofs) const;
|
||||||
|
|
||||||
// netpbm i/o
|
// netpbm i/o
|
||||||
|
|
@ -453,15 +453,26 @@ void FpgaConfig::write_bits(std::ostream &ofs) const
|
||||||
write_byte(ofs, crc_value, file_offset, 0x05);
|
write_byte(ofs, crc_value, file_offset, 0x05);
|
||||||
crc_value = 0xffff;
|
crc_value = 0xffff;
|
||||||
|
|
||||||
debug("Setting warmboot to '%s'.\n", this->warmboot.c_str());
|
{
|
||||||
|
uint8_t nosleep_flag;
|
||||||
|
debug("Setting warmboot to '%s', nosleep to '%s'.\n", this->warmboot.c_str(), this->nosleep.c_str());
|
||||||
write_byte(ofs, crc_value, file_offset, 0x92);
|
write_byte(ofs, crc_value, file_offset, 0x92);
|
||||||
write_byte(ofs, crc_value, file_offset, 0x00);
|
write_byte(ofs, crc_value, file_offset, 0x00);
|
||||||
|
|
||||||
|
if (this->nosleep == "disabled")
|
||||||
|
nosleep_flag = 0;
|
||||||
|
else if (this->nosleep == "enabled")
|
||||||
|
nosleep_flag = 1;
|
||||||
|
else
|
||||||
|
error("Unknown nosleep setting '%s'.\n", this->nosleep.c_str());
|
||||||
|
|
||||||
if (this->warmboot == "disabled")
|
if (this->warmboot == "disabled")
|
||||||
write_byte(ofs, crc_value, file_offset, 0x00);
|
write_byte(ofs, crc_value, file_offset, 0x00 | nosleep_flag);
|
||||||
else if (this->warmboot == "enabled")
|
else if (this->warmboot == "enabled")
|
||||||
write_byte(ofs, crc_value, file_offset, 0x20);
|
write_byte(ofs, crc_value, file_offset, 0x20 | nosleep_flag);
|
||||||
else
|
else
|
||||||
error("Unknown warmboot setting '%s'.\n", this->warmboot.c_str());
|
error("Unknown warmboot setting '%s'.\n", this->warmboot.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
debug("CRAM: Setting bank width to %d.\n", this->cram_width);
|
debug("CRAM: Setting bank width to %d.\n", this->cram_width);
|
||||||
write_byte(ofs, crc_value, file_offset, 0x62);
|
write_byte(ofs, crc_value, file_offset, 0x62);
|
||||||
|
|
@ -590,7 +601,7 @@ void FpgaConfig::write_bits(std::ostream &ofs) const
|
||||||
write_byte(ofs, crc_value, file_offset, 0x00);
|
write_byte(ofs, crc_value, file_offset, 0x00);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FpgaConfig::read_ascii(std::istream &ifs)
|
void FpgaConfig::read_ascii(std::istream &ifs, bool nosleep)
|
||||||
{
|
{
|
||||||
debug("## %s\n", __PRETTY_FUNCTION__);
|
debug("## %s\n", __PRETTY_FUNCTION__);
|
||||||
info("Parsing ascii file..\n");
|
info("Parsing ascii file..\n");
|
||||||
|
|
@ -719,6 +730,14 @@ void FpgaConfig::read_ascii(std::istream &ifs)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No ".nosleep" section despite sharing the same byte as .warmboot.
|
||||||
|
// ".nosleep" is specified when icepack is invoked, which is too late.
|
||||||
|
// So we inject the section based on command line argument.
|
||||||
|
if (nosleep)
|
||||||
|
this->nosleep = "enabled";
|
||||||
|
else
|
||||||
|
this->nosleep = "disabled";
|
||||||
|
|
||||||
if (command == ".io_tile" || command == ".logic_tile" || command == ".ramb_tile" || command == ".ramt_tile" || command.substr(0, 4) == ".dsp" || command == ".ipcon_tile")
|
if (command == ".io_tile" || command == ".logic_tile" || command == ".ramb_tile" || command == ".ramt_tile" || command.substr(0, 4) == ".dsp" || command == ".ipcon_tile")
|
||||||
{
|
{
|
||||||
if (!got_device)
|
if (!got_device)
|
||||||
|
|
@ -1378,7 +1397,7 @@ int main(int argc, char **argv)
|
||||||
if (!netpbm_mode)
|
if (!netpbm_mode)
|
||||||
fpga_config.write_ascii(*osp);
|
fpga_config.write_ascii(*osp);
|
||||||
} else {
|
} else {
|
||||||
fpga_config.read_ascii(*isp);
|
fpga_config.read_ascii(*isp, nosleep_mode);
|
||||||
if (!netpbm_mode)
|
if (!netpbm_mode)
|
||||||
fpga_config.write_bits(*osp);
|
fpga_config.write_bits(*osp);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue