latticeBitParser: add ECP3 VERIFY ID support (avoid to fail with bitstream)
This commit is contained in:
parent
fb587e73d8
commit
807d794703
|
|
@ -103,6 +103,7 @@ int LatticeBitParser::parse()
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("%08x\n", preamble);
|
||||||
if (preamble == 0xb3bdffff) {
|
if (preamble == 0xb3bdffff) {
|
||||||
/* extract idcode from configuration data (area starting with 0xE2)
|
/* extract idcode from configuration data (area starting with 0xE2)
|
||||||
* and check compression when machXO2
|
* and check compression when machXO2
|
||||||
|
|
@ -161,6 +162,9 @@ int LatticeBitParser::parse()
|
||||||
#define VERIFY_ID 0xE2
|
#define VERIFY_ID 0xE2
|
||||||
#define BYPASS 0xFF
|
#define BYPASS 0xFF
|
||||||
|
|
||||||
|
/* ECP3 has a bit reversable (ie same values but 7-0 -> 0-7) */
|
||||||
|
#define ECP3_VERIFY_ID 0x47
|
||||||
|
|
||||||
bool LatticeBitParser::parseCfgData()
|
bool LatticeBitParser::parseCfgData()
|
||||||
{
|
{
|
||||||
uint8_t *ptr;
|
uint8_t *ptr;
|
||||||
|
|
@ -174,6 +178,18 @@ bool LatticeBitParser::parseCfgData()
|
||||||
case LSC_RESET_CRC:
|
case LSC_RESET_CRC:
|
||||||
pos += 3;
|
pos += 3;
|
||||||
break;
|
break;
|
||||||
|
case ECP3_VERIFY_ID:
|
||||||
|
ptr = (uint8_t*)&_raw_data[pos];
|
||||||
|
idcode = (((uint32_t)reverseByte(ptr[6])) << 24) |
|
||||||
|
(((uint32_t)reverseByte(ptr[5])) << 16) |
|
||||||
|
(((uint32_t)reverseByte(ptr[4])) << 8) |
|
||||||
|
(((uint32_t)reverseByte(ptr[3])) << 0);
|
||||||
|
_hdr["idcode"] = string(8, ' ');
|
||||||
|
snprintf(&_hdr["idcode"][0], 9, "%08x", idcode);
|
||||||
|
pos += 7;
|
||||||
|
if (!_is_machXO2)
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
case VERIFY_ID:
|
case VERIFY_ID:
|
||||||
ptr = (uint8_t*)&_raw_data[pos];
|
ptr = (uint8_t*)&_raw_data[pos];
|
||||||
idcode = (((uint32_t)ptr[3]) << 24) |
|
idcode = (((uint32_t)ptr[3]) << 24) |
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue