Skip to content

Commit 1388f7b

Browse files
committed
pofParser: removed last (blank) car for part_name, fixed usercode offset
1 parent bb0591e commit 1388f7b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/pofParser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ uint32_t POFParser::parseSection(uint16_t flag, uint32_t pos, uint32_t size)
141141
_hdr["tool"] = _raw_data.substr(pos, size);
142142
break;
143143
case 0x02: // full FPGA part name
144-
_hdr["part_name"] = _raw_data.substr(pos, size);
144+
_hdr["part_name"] = _raw_data.substr(pos, size-1); // -1 because '\0'
145145
break;
146146
case 0x03: // bitstream/design/xxx name
147147
_hdr["design_name"] = _raw_data.substr(pos, size);
@@ -160,7 +160,7 @@ uint32_t POFParser::parseSection(uint16_t flag, uint32_t pos, uint32_t size)
160160
printf("size %u %zu\n", size, _bit_data.size());
161161
break;
162162
case 0x13: // contains usercode / checksum
163-
_hdr["usercode"] = std::to_string(ARRAY2INT16((&_raw_data.data()[pos])));
163+
_hdr["usercode"] = std::to_string(ARRAY2INT32((&_raw_data.data()[pos+size-4])));
164164
if (_verbose) {
165165
t = _raw_data.substr(pos, size);
166166
for (size_t i = 0; i < t.size(); i++)

0 commit comments

Comments
 (0)