colognechip integration: apply review remarks

* add missing #include <string>
* add comment to part.hpp why highest nibble should be kept
* remove _reverseOrder variable from colognechipCfgParser.{hpp,cpp}
* rename cfgDone() to to a more meaningfull waitCfgDone()
This commit is contained in:
Patrick Urban 2021-12-12 11:55:10 +01:00
parent dd0d668d96
commit e252e713dd
5 changed files with 11 additions and 12 deletions

View File

@ -84,7 +84,7 @@ void CologneChip::reset()
* Obtain CFG_DONE and ~CFG_FAILED signals. Configuration is successfull iff
* CFG_DONE=true and ~CFG_FAILED=false.
*/
bool CologneChip::cfgDone()
bool CologneChip::waitCfgDone()
{
uint16_t status = 0;
if (_spi) {
@ -152,7 +152,7 @@ void CologneChip::program(unsigned int offset)
if (_file_extension == "bit") {
cfg = new RawParser(_filename, false);
} else if (_file_extension == "cfg") {
cfg = new CologneChipCfgParser(_filename, false);
cfg = new CologneChipCfgParser(_filename);
}
cfg->parse();
@ -197,7 +197,7 @@ void CologneChip::programSPI_sram(uint8_t *data, int length)
do {
timeout--;
usleep(SLEEP_US);
} while (!cfgDone() && timeout > 0);
} while (!waitCfgDone() && timeout > 0);
if (timeout == 0) {
printError("FAIL");
} else {
@ -240,7 +240,7 @@ void CologneChip::programSPI_flash(unsigned int offset, uint8_t *data, int lengt
do {
timeout--;
usleep(SLEEP_US);
} while (!cfgDone() && timeout > 0);
} while (!waitCfgDone() && timeout > 0);
if (timeout == 0) {
printError("FAIL");
} else {
@ -288,7 +288,7 @@ void CologneChip::programJTAG_sram(uint8_t *data, int length)
do {
timeout--;
usleep(SLEEP_US);
} while (!cfgDone() && timeout > 0);
} while (!waitCfgDone() && timeout > 0);
if (timeout == 0) {
printError("FAIL");
} else {

View File

@ -9,6 +9,7 @@
#include <unistd.h>
#include <regex>
#include <string>
#include "device.hpp"
#include "jtag.hpp"
@ -31,7 +32,7 @@ class CologneChip: public Device, SPIInterface {
bool verify, int8_t verbose);
~CologneChip() {}
bool cfgDone();
bool waitCfgDone();
bool dumpFlash(const std::string &filename, uint32_t base_addr, uint32_t len);
void program(unsigned int offset = 0) override;

View File

@ -8,9 +8,9 @@
#include "colognechipCfgParser.hpp"
CologneChipCfgParser::CologneChipCfgParser(const std::string &filename, bool reverseOrder):
CologneChipCfgParser::CologneChipCfgParser(const std::string &filename):
ConfigBitstreamParser(filename, ConfigBitstreamParser::ASCII_MODE,
false), _reverseOrder(reverseOrder)
false)
{}
int CologneChipCfgParser::parse()

View File

@ -14,12 +14,9 @@
class CologneChipCfgParser: public ConfigBitstreamParser {
public:
CologneChipCfgParser(const std::string &filename, bool reverseOrder);
CologneChipCfgParser(const std::string &filename);
int parse() override;
private:
bool _reverseOrder;
};
#endif // SRC_COLOGNECHIPCFGPARSER_HPP_

View File

@ -108,6 +108,7 @@ static std::map <int, fpga_model> fpga_list = {
{0x0300181b, {"Gowin", "GW1NS", "GW1NS-2C", 8}},
{0x0100981b, {"Gowin", "GW1NSR", "GW1NSR-4C", 8}},
/* keep highest nibble to prevent confusion with Efinix T4/T8 IDCODE */
{0x20000001, {"colognechip", "GateMate Series", "GM1Ax", 6}},
};