openFPGALoader/src/svf_jtag.hpp

72 lines
1.5 KiB
C++
Raw Normal View History

2021-06-26 15:24:07 +02:00
// SPDX-License-Identifier: Apache-2.0
/*
2022-11-06 18:33:43 +01:00
* Copyright (C) 2019-2022 Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
2021-06-26 15:24:07 +02:00
*/
2022-11-06 18:33:43 +01:00
#ifndef SRC_SVF_JTAG_HPP_
#define SRC_SVF_JTAG_HPP_
2019-09-26 18:29:20 +02:00
#include <iostream>
2022-11-06 18:33:43 +01:00
#include <string>
2019-09-26 18:29:20 +02:00
#include <vector>
#include <map>
#include "jtag.hpp"
2019-09-26 18:29:20 +02:00
class SVF_jtag {
public:
SVF_jtag(Jtag *jtag, bool verbose);
2019-09-26 18:29:20 +02:00
~SVF_jtag();
void parse(std::string filename);
2019-09-26 18:29:20 +02:00
void setVerbose(bool verbose) {_verbose = verbose;}
private:
typedef struct {
uint32_t len;
std::string tdo;
std::string tdi;
std::string mask;
std::string smask;
2019-09-26 18:29:20 +02:00
} svf_XYR;
void split_str(const std::string &str, std::vector<std::string> &vparse);
2019-09-26 18:29:20 +02:00
void clear_XYR(svf_XYR &t);
void parse_XYR(const std::vector<std::string> &vstr/*, svf_stat &svfs*/, svf_XYR &t);
void parse_runtest(const std::vector<std::string> &vstr);
void handle_instruction(const std::vector<std::string> &vstr);
2019-09-26 18:29:20 +02:00
std::map<std::string, uint8_t> fsm_state = {
2019-09-26 18:29:20 +02:00
{"RESET", 0},
{"IDLE", 1},
{"DRSELECT", 2},
{"DRCAPTURE", 3},
{"DRSHIFT", 4},
{"DREXIT1", 5},
{"DRPAUSE", 6},
{"DREXIT2", 7},
{"DRUPDATE", 8},
{"IRSELECT", 9},
{"IRCAPTURE", 10},
{"IRSHIFT", 11},
{"IREXIT1", 12},
{"IRPAUSE", 13},
{"IREXIT2", 14},
{"IRUPDATE", 15}
};
Jtag *_jtag;
2019-09-26 18:29:20 +02:00
bool _verbose;
uint32_t _freq_hz;
2023-08-10 16:36:18 +02:00
Jtag::tapState_t _enddr;
Jtag::tapState_t _endir;
2023-08-10 12:50:26 +02:00
Jtag::tapState_t _run_state;
Jtag::tapState_t _end_state;
2019-09-26 18:29:20 +02:00
svf_XYR hdr;
svf_XYR hir;
svf_XYR sdr;
svf_XYR sir;
svf_XYR tdr;
svf_XYR tir;
};
2022-11-06 18:33:43 +01:00
#endif // SRC_SVF_JTAG_HPP_