27 #ifndef TTA_RV32_TRANSLATOR_HH
28 #define TTA_RV32_TRANSLATOR_HH
33 #include <unordered_map>
74 const std::string& fileDst);
76 void setBypassInstructionRegister(
const bool& value);
80 std::unordered_map<std::string, BaseFUPort*>
rs1Ports_;
81 std::unordered_map<std::string, BaseFUPort*>
rs2Ports_;
82 std::unordered_map<std::string, BaseFUPort*>
rdPorts_;
85 void initializeOperations();
89 std::unordered_map<Port*, std::vector<std::string>>
92 void findOperationSources();
94 void generateFUTargetProcess(std::ofstream& stream);
96 void addRs1ForwardingConditions(std::map<std::string, std::string>
97 ops, std::unordered_map<std::string, InstructionBitVector*>
99 std::ofstream& stream)
const;
101 void addRs2ForwardingConditions(std::map<std::string, std::string>
102 ops, std::unordered_map<std::string, InstructionBitVector*>
104 std::ofstream& stream)
const;
116 std::set<Port*> operationPorts(
117 const std::unordered_map<std::string, BaseFUPort*>& ports)
const;
119 void validateOperations()
const;
121 FunctionUnit* mapFunctionUnit(
const std::string& operation)
const;
123 void addRPorts(
const std::string& opName);
124 void addIPorts(
const std::string& opName);
125 void addSPorts(
const std::string& opName);
126 void addBPorts(
const std::string& opName);
127 void addUJPorts(
const std::string& opName);
129 void findOperationPorts();
134 void findBusWidths();
140 std::unordered_map<std::string, InstructionBitVector*>
141 constructRInstructions(
Port* src1,
Port* src2)
const;
142 std::unordered_map<std::string, InstructionBitVector*>
143 constructIInstructions(
Port* src1,
Port* src2)
const;
144 std::unordered_map<std::string, InstructionBitVector*>
145 constructSInstructions(
Port* src1,
Port* src2)
const;
146 std::unordered_map<std::string, InstructionBitVector*>
147 constructBInstructions(
Port* src1,
Port* src2)
const;
148 std::unordered_map<std::string, InstructionBitVector*>
149 constructUJInstructions()
const;
152 std::unordered_map<std::string, InstructionBitVector*> instructions,
153 const std::map<std::string, std::string> encodings,
154 std::ofstream& stream)
const;
156 void generateMap(
const std::string& dstDirectory);
159 const std::string& fileDst);
163 void throwOperationNotFoundError(
const std::string& op)
const;
165 void throwTriggeringPortError(
const BaseFUPort* port,
166 const std::string& type)
const;
168 void throwInputPortError(
const BaseFUPort* port,
169 const std::string& type)
const;
171 void throwOutputPortError(
const BaseFUPort* port,
172 const std::string& type)
const;
174 void throwOperandCountError(
175 const std::string& op,
int required,
int found)
const;