forked from trabucayre/openFPGALoader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfsparser.hpp
47 lines (39 loc) · 1.32 KB
/
fsparser.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright (C) 2019 Gwenhael Goavec-Merou <[email protected]>
*/
#ifndef FSPARSER_HPP_
#define FSPARSER_HPP_
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include "configBitstreamParser.hpp"
class FsParser: public ConfigBitstreamParser {
public:
FsParser(const std::string &filename, bool reverseByte, bool verbose);
~FsParser();
int parse() override;
uint16_t checksum() {return _checksum;}
private:
int parseHeader();
/**
* \brief convert an binary string representation to the corresponding
* value
*
* \param[in] bits: '1' or '0' buffer
* \param[in] len: array length (up to 64)
* \return converted value
*/
uint64_t bitToVal(const char *bits, int len);
bool _reverseByte; /*!< direct or reverse bit */
uint16_t _end_header; /*!< last header line */
uint16_t _checksum; /*!< locally computed data checksum */
uint8_t _8Zero; /*!< in compress mode, used to replace 8 * 0x00 */
uint8_t _4Zero; /*!< in compress mode, used to replace 8 * 0x00 */
uint8_t _2Zero; /*!< in compress mode, used to replace 8 * 0x00 */
uint32_t _idcode; /*!< device idcode */
bool _compressed; /*!< compress mode or not */
std::vector<std::string> _lstRawData; /* cfg + EBR data buffer */
};
#endif // FSPARSER_HPP_