OpenASIP 2.2
Loading...
Searching...
No Matches
RISCVTDGen.hh
Go to the documentation of this file.
1/*
2 Copyright (C) 2024 Tampere University.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18/**
19 * @file RISCVTDGen.hh
20 *
21 * Declaration of RISCVTDGen class.
22 *
23 * @author Kari Hepola 2024 (kari.hepola@tuni.fi)
24 * @note rating: red
25 */
26
27#ifndef RISCV_TDGEN_HH
28#define RISCV_TDGEN_HH
29
30#include <string>
31#include <vector>
32#include "TDGen.hh"
33
34
35namespace TTAMachine {
36 class Machine;
37}
38
39class BinaryEncoding;
41
42class RISCVTDGen : public TDGen {
43public:
45 virtual ~RISCVTDGen() = default;
46 virtual void generateBackend(const std::string& path) const;
47 virtual std::string generateBackend() const;
48
49protected:
50 virtual void initializeBackendContents();
51 InstructionFormat* findFormat(const std::string name) const;
52 void findCustomOps();
53
54 void writeInstructionDeclarations(std::ostream& o) const;
55 void writePatternDefinition(std::ostream& o, Operation& op);
56 void writePatternDefinitions(std::ostream& o);
57
59 std::ostream& o, const std::string& name, const int encoding) const;
60
61 std::string transformTCEPattern(std::string pattern,
62 const unsigned numIns) const;
63
64 void dumpClassDefinitions(std::ostream&) const;
65 std::string getFormatType(const std::string& opName) const;
66
67 std::string decimalsToHex(const std::string& pattern) const;
68
70 std::map<std::string, int> customOps_;
71 std::string declarationStr_;
72 std::string patternStr_;
73
74};
75
76
77#endif
std::string getFormatType(const std::string &opName) const
virtual std::string generateBackend() const
std::string patternStr_
Definition RISCVTDGen.hh:72
void writeInstructionDeclarations(std::ostream &o) const
std::string transformTCEPattern(std::string pattern, const unsigned numIns) const
void dumpClassDefinitions(std::ostream &) const
std::string decimalsToHex(const std::string &pattern) const
Definition RISCVTDGen.cc:69
InstructionFormat * findFormat(const std::string name) const
void writePatternDefinition(std::ostream &o, Operation &op)
virtual ~RISCVTDGen()=default
void writeInstructionDeclaration(std::ostream &o, const std::string &name, const int encoding) const
void findCustomOps()
std::map< std::string, int > customOps_
Definition RISCVTDGen.hh:70
void writePatternDefinitions(std::ostream &o)
std::string declarationStr_
Definition RISCVTDGen.hh:71
virtual void initializeBackendContents()
BinaryEncoding * bem_
Definition RISCVTDGen.hh:69
Definition TDGen.hh:77