latticeBitParser: fix end header position with MACHOX3D .bit file
This commit is contained in:
parent
a4d5fd8448
commit
c9fb3f4065
|
|
@ -60,6 +60,18 @@ int LatticeBitParser::parseHeader()
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* .bit for MACHXO3D seems to have more 0xff before preamble key */
|
||||||
|
size_t pos = _raw_data.find(0xb3, _endHeader);
|
||||||
|
if (pos == string::npos) {
|
||||||
|
printError("Preamble key not found");
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
if ((uint8_t)_raw_data[pos-1] != 0xbd && (uint8_t)_raw_data[pos-1] != 0xbf) {
|
||||||
|
printError("Wrong preamble key");
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
_endHeader = pos - 4;
|
||||||
|
|
||||||
/* parse header */
|
/* parse header */
|
||||||
istringstream lineStream(_raw_data.substr(currPos, _endHeader-currPos));
|
istringstream lineStream(_raw_data.substr(currPos, _endHeader-currPos));
|
||||||
string buff;
|
string buff;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue