mirror of
https://github.com/trabucayre/openFPGALoader.git
synced 2026-08-29 17:39:36 +02:00
46 lines
1.1 KiB
C++
46 lines
1.1 KiB
C++
// SPDX-License-Identifier: Apache-2.0
|
|||
/*
|
|||
* Copyright (C) 2019-2022 Gwenhael Goavec-Merou <[email protected]>
|
|||
*/
|
|||
#ifndef SRC_LATTICEBITPARSER_HPP_
|
|||
|
|
#define SRC_LATTICEBITPARSER_HPP_
|
||
|
|||
|
|
#include <iostream>
|
||
|
|
#include <fstream>
|
||
|
|
#include <map>
|
||
|
|
#include <string>
|
||
#include <vector>
|
|||
|
|||
|
|
#include "configBitstreamParser.hpp"
|
||
|
|
|
||
|
|
class LatticeBitParser: public ConfigBitstreamParser {
|
||
|
|
public:
|
||
LatticeBitParser(const std::string &filename, bool machxo2, bool ecp3,
|
|||
bool verbose = false);
|
|||
~LatticeBitParser();
|
|||
|
|
int parse() override;
|
||
|
|
|
||
/*!
|
|||
|
|
* \brief return configuration data with structure similar to jedec
|
||
|
|
* \return configuration data
|
||
|
|
*/
|
||
std::vector<std::string> &getDataArray() {return _bit_array;}
|
|||
|
|||
private:
|
|||
|
|
int parseHeader();
|
||
bool parseCfgData();
|
|||
/*!
|
|||
|
|
* \brief format a 32-bit value as 8 zero-padded lowercase hex digits
|
||
|
|
* \param[in] id: value to format
|
||
|
|
* \return 8-character hex string
|
||
|
|
*/
|
||
|
|
static std::string fmtIdcode(uint32_t id);
|
||
size_t _endHeader;
|
|||
bool _is_machXO2;
|
|||
bool _is_ecp3;
|
|||
/* data storage for machXO2 */
|
|||
|
|
std::vector<std::string> _bit_array;
|
||
};
|
|||
|
|
|
||
#endif // SRC_LATTICEBITPARSER_HPP_
|