OpenASIP  2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ProGe::RV32MicroCodeGenerator Class Reference

#include <RV32MicroCodeGenerator.hh>

Inheritance diagram for ProGe::RV32MicroCodeGenerator:
Inheritance graph
Collaboration diagram for ProGe::RV32MicroCodeGenerator:
Collaboration graph

Public Member Functions

 RV32MicroCodeGenerator (const Machine &machine, const BinaryEncoding &bem)
 
 ~RV32MicroCodeGenerator ()
 
void generateRTL (HDLTemplateInstantiator &instantiator, const std::string &fileDst)
 
void setBypassInstructionRegister (const bool &value)
 
- Public Member Functions inherited from ProGe::MicroCodeGenerator
 MicroCodeGenerator ()=default
 
 ~MicroCodeGenerator ()=default
 

Private Member Functions

void initializeOperations ()
 
void findOperationSources ()
 
void generateFUTargetProcess (std::ofstream &stream)
 
void addRs1ForwardingConditions (std::map< std::string, std::string > ops, std::unordered_map< std::string, InstructionBitVector * >(ProGe::RV32MicroCodeGenerator::*instructionFunc)(Port *p1, Port *p2) const, std::ofstream &stream) const
 
void addRs2ForwardingConditions (std::map< std::string, std::string > ops, std::unordered_map< std::string, InstructionBitVector * >(ProGe::RV32MicroCodeGenerator::*instructionFunc)(Port *p1, Port *p2) const, std::ofstream &stream) const
 
std::string generateOperationLatencyLogic (HDLTemplateInstantiator &instantiator)
 
std::set< Port * > operationPorts (const std::unordered_map< std::string, BaseFUPort * > &ports) const
 
void validateOperations () const
 
FunctionUnitmapFunctionUnit (const std::string &operation) const
 
void addRPorts (const std::string &opName)
 
void addIPorts (const std::string &opName)
 
void addSPorts (const std::string &opName)
 
void addBPorts (const std::string &opName)
 
void addUJPorts (const std::string &opName)
 
void findOperationPorts ()
 
void connectRF ()
 
void findRF ()
 
void findBusWidths ()
 
bool findConnectedBusses (Connection &rs1, Connection &rs2, Connection &rd, Connection &simm, const bool &forwarding) const
 
std::unordered_map< std::string, InstructionBitVector * > constructRInstructions (Port *src1, Port *src2) const
 
std::unordered_map< std::string, InstructionBitVector * > constructIInstructions (Port *src1, Port *src2) const
 
std::unordered_map< std::string, InstructionBitVector * > constructSInstructions (Port *src1, Port *src2) const
 
std::unordered_map< std::string, InstructionBitVector * > constructBInstructions (Port *src1, Port *src2) const
 
std::unordered_map< std::string, InstructionBitVector * > constructUJInstructions () const
 
void addBitsToMap (std::unordered_map< std::string, InstructionBitVector * > instructions, const std::map< std::string, std::string > encodings, std::ofstream &stream) const
 
void generateMap (const std::string &dstDirectory)
 
void generateWrapper (HDLTemplateInstantiator &instantiator, const std::string &fileDst)
 
void generateNOP ()
 
void throwOperationNotFoundError (const std::string &op) const
 
void throwTriggeringPortError (const BaseFUPort *port, const std::string &type) const
 
void throwInputPortError (const BaseFUPort *port, const std::string &type) const
 
void throwOutputPortError (const BaseFUPort *port, const std::string &type) const
 
void throwOperandCountError (const std::string &op, int required, int found) const
 

Private Attributes

std::unordered_map< std::string, BaseFUPort * > rs1Ports_
 
std::unordered_map< std::string, BaseFUPort * > rs2Ports_
 
std::unordered_map< std::string, BaseFUPort * > rdPorts_
 
std::unordered_map< std::string, BaseFUPort * > simmPorts_
 
std::unordered_map< Port *, int > sourcePortID_
 
std::unordered_map< Port *, std::vector< std::string > > sourceOperationMap_
 
std::map< std::string, std::string > rOperations_
 
std::map< std::string, std::string > iOperations_
 
std::map< std::string, std::string > sOperations_
 
std::map< std::string, std::string > bOperations_
 
std::map< std::string, std::string > ujOperations_
 
const Machinemachine_
 
const BinaryEncodingbem_
 
std::vector< Bus * > busses_
 
RegisterFileRF_
 
int rs1BusWidth_
 
int rs2BusWidth_
 
int rdBusWidth_
 
int simmBusWidth_
 
int rs1BusStart_
 
int rs2BusStart_
 
int rdBusStart_
 
int simmBusStart_
 
int rs1RFStart_
 
int rs2RFStart_
 
int rdRFStart_
 
int simmRFStart_
 
Busrs1Bus_
 
Busrs2Bus_
 
BusrdBus_
 
BussimmBus_
 
RFPortrs1RFPort_
 
RFPortrs2RFPort_
 
RFPortrdRFPort_
 
ProgramImageGeneratorpig_
 
std::string NOP_
 
bool bypassInstructionRegister_
 
bool hasForwarding_
 
bool variableLengthOpLatency_
 
bool eVariant_
 

Detailed Description

Definition at line 67 of file RV32MicroCodeGenerator.hh.

Constructor & Destructor Documentation

◆ RV32MicroCodeGenerator()

ProGe::RV32MicroCodeGenerator::RV32MicroCodeGenerator ( const Machine machine,
const BinaryEncoding bem 
)

Definition at line 80 of file RV32MicroCodeGenerator.cc.

82  : machine_(&machine),
83  bem_(&bem),
84  RF_(NULL),
85  rs1Bus_(NULL),
86  rs2Bus_(NULL),
87  rdBus_(NULL),
88  rs1RFPort_(NULL),
89  rs2RFPort_(NULL),
90  rdRFPort_(NULL),
92  NOP_(""),
94  hasForwarding_(false),
96  eVariant_(false) {
98  for (int i = 0; i < busNav.count(); i++) {
99  busses_.push_back(busNav.item(i));
100  }
101 
103 
106 
107  pig_->loadBEM(bem);
109 
110  generateNOP();
111 
112  findRF();
113  connectRF();
114  findBusWidths();
115  if (RV32_RTL_GEN_VERBOSE) {
116  if (hasForwarding_) {
117  std::cout << "Generated bypass logic" << std::endl;
118  } else {
119  std::cout << "Not required connectivity for bypass logic"
120  << std::endl;
121  }
122  }
123 }

References TTAMachine::Machine::busNavigator(), busses_, connectRF(), TTAMachine::Machine::Navigator< ComponentType >::count(), findBusWidths(), findOperationPorts(), findOperationSources(), findRF(), generateNOP(), hasForwarding_, initializeOperations(), TTAMachine::Machine::Navigator< ComponentType >::item(), ProgramImageGenerator::loadBEM(), ProgramImageGenerator::loadMachine(), machine, pig_, and RV32_RTL_GEN_VERBOSE.

Here is the call graph for this function:

◆ ~RV32MicroCodeGenerator()

ProGe::RV32MicroCodeGenerator::~RV32MicroCodeGenerator ( )

Definition at line 125 of file RV32MicroCodeGenerator.cc.

125 { delete pig_; }

References pig_.

Member Function Documentation

◆ addBitsToMap()

void ProGe::RV32MicroCodeGenerator::addBitsToMap ( std::unordered_map< std::string, InstructionBitVector * >  instructions,
const std::map< std::string, std::string >  encodings,
std::ofstream &  stream 
) const
private

Definition at line 940 of file RV32MicroCodeGenerator.cc.

943  {
944  assert(instructions.size() == encodings.size());
945  for (const auto& op : instructions) {
946  stream << " elsif(fu_opcode(" << encodings.at(op.first).size()
947  << " - 1 downto 0) = "
948  << "\"" << encodings.at(op.first) << "\""
949  << ") then" << std::endl
950  << " moves <= \"" << op.second->toString() << "\";"
951  << std::endl;
952  delete op.second;
953  }
954 }

References assert.

Referenced by generateMap().

◆ addBPorts()

void ProGe::RV32MicroCodeGenerator::addBPorts ( const std::string &  opName)
private

Definition at line 369 of file RV32MicroCodeGenerator.cc.

369  {
370  FunctionUnit* fu = mapFunctionUnit(opName);
371  HWOperation* op = fu->operation(opName);
372  if (op->operandCount() != 3) {
373  throwOperandCountError(opName, 3, op->operandCount());
374  }
375  FUPort* simmPort = op->port(1);
376  FUPort* rs1Port = op->port(2);
377  FUPort* rs2Port = op->port(3);
378  if (!simmPort->isTriggering()) {
379  throwTriggeringPortError(simmPort, "imm");
380  } else if (!rs1Port->isInput()) {
381  throwInputPortError(rs1Port, "rs1");
382  } else if (!rs2Port->isInput()) {
383  throwInputPortError(rs1Port, "rs2");
384  }
385  rs1Ports_.insert({opName, rs1Port});
386  simmPorts_.insert({opName, simmPort});
387  rs2Ports_.insert({opName, rs2Port});
388 }

References TTAMachine::Port::isInput(), TTAMachine::FUPort::isTriggering(), mapFunctionUnit(), TTAMachine::HWOperation::operandCount(), TTAMachine::FunctionUnit::operation(), TTAMachine::HWOperation::port(), rs1Ports_, rs2Ports_, simmPorts_, throwInputPortError(), throwOperandCountError(), and throwTriggeringPortError().

Referenced by findOperationPorts().

Here is the call graph for this function:

◆ addIPorts()

void ProGe::RV32MicroCodeGenerator::addIPorts ( const std::string &  opName)
private

Definition at line 340 of file RV32MicroCodeGenerator.cc.

340  {
341  if (rOperations_.count(opName)) {
342  return;
343  }
344  FunctionUnit* fu = mapFunctionUnit(opName);
345  HWOperation* op = fu->operation(opName);
346  const int operandCount = (opName == "calla") ? 2 : 3;
347  if (op->operandCount() != operandCount) {
348  throwOperandCountError(opName, operandCount, op->operandCount());
349  }
350  FUPort* rs1Port = op->port(1);
351  FUPort* simmPort = op->port(2);
352  BaseFUPort* rdPort;
353  if (opName != "calla") {
354  rdPort = op->port(3);
355  if (!rdPort->isOutput()) {
356  throwOutputPortError(rdPort, "rd");
357  }
358  } else {
359  rs1Port = op->port(2);
360  simmPort = op->port(1);
361  rdPort = machine_->controlUnit()->returnAddressPort();
362  }
363  rs1Ports_.insert({opName, rs1Port});
364  simmPorts_.insert({opName, simmPort});
365  rdPorts_.insert({opName, rdPort});
366 }

References TTAMachine::Machine::controlUnit(), TTAMachine::Port::isOutput(), machine_, mapFunctionUnit(), TTAMachine::HWOperation::operandCount(), TTAMachine::FunctionUnit::operation(), TTAMachine::HWOperation::port(), rdPorts_, TTAMachine::ControlUnit::returnAddressPort(), rOperations_, rs1Ports_, simmPorts_, throwOperandCountError(), and throwOutputPortError().

Referenced by findOperationPorts().

Here is the call graph for this function:

◆ addRPorts()

void ProGe::RV32MicroCodeGenerator::addRPorts ( const std::string &  opName)
private

Definition at line 306 of file RV32MicroCodeGenerator.cc.

306  {
307  FunctionUnit* fu = mapFunctionUnit(opName);
308  HWOperation* op = fu->operation(opName);
309  if (op->operandCount() != 3) {
310  throwOperandCountError(opName, 3, op->operandCount());
311  }
312  FUPort* rs1Port = op->port(1);
313  ;
314  FUPort* rs2Port = op->port(2);
315  FUPort* rdPort = op->port(3);
316  if (!rs1Port->isTriggering()) {
317  throwTriggeringPortError(rs1Port, "rs1");
318  }
319  if (!rs2Port->isInput()) {
320  throwInputPortError(rs2Port, "rs2");
321  }
322  if (!rdPort->isOutput()) {
323  throwOutputPortError(rdPort, "rd");
324  }
325  rs1Ports_.insert({opName, rs1Port});
326  rs2Ports_.insert({opName, rs2Port});
327  // Do not add custom ops to simm ports
329  const std::string riscvOpName =MapTools::keyForValue
330  <string, map<string, string>, string>(operationNameTable, opName);
331  // Do not add M-extension ops
332  if (!VectorTools::containsValue(mExtensionOps, riscvOpName)) {
333  simmPorts_.insert({opName, rs2Port});
334  }
335  }
336  rdPorts_.insert({opName, rdPort});
337 }

References VectorTools::containsValue(), MapTools::containsValue(), TTAMachine::Port::isInput(), TTAMachine::Port::isOutput(), TTAMachine::FUPort::isTriggering(), MapTools::keyForValue(), mapFunctionUnit(), mExtensionOps, TTAMachine::HWOperation::operandCount(), TTAMachine::FunctionUnit::operation(), operationNameTable, TTAMachine::HWOperation::port(), rdPorts_, rs1Ports_, rs2Ports_, simmPorts_, throwInputPortError(), throwOperandCountError(), throwOutputPortError(), and throwTriggeringPortError().

Referenced by findOperationPorts().

Here is the call graph for this function:

◆ addRs1ForwardingConditions()

void ProGe::RV32MicroCodeGenerator::addRs1ForwardingConditions ( std::map< std::string, std::string >  ops,
std::unordered_map< std::string, InstructionBitVector * >(ProGe::RV32MicroCodeGenerator::*)(Port *p1, Port *p2) const  instructionFunc,
std::ofstream &  stream 
) const
private

Definition at line 1028 of file RV32MicroCodeGenerator.cc.

1033  {
1034  bool firstOpcodeCond = true;
1035  for (const auto& op : ops) {
1036  std::string opcodeCond = " elsif ";
1037  if (firstOpcodeCond) {
1038  opcodeCond = " if ";
1039  firstOpcodeCond = false;
1040  }
1041  stream << opcodeCond << "fu_opcode(" << op.second.size()
1042  << "-1 downto 0) = \"" << op.second << "\"";
1043  if (rOperations_.count(op.first) && iOperations_.count(op.first)) {
1044  stream << " or fu_opcode(" << iOperations_.at(op.first).size()
1045  << "-1 downto 0) = \"" << iOperations_.at(op.first)
1046  << "\"";
1047  }
1048  stream << "then\n";
1049  bool firstTargetCond = true;
1050  for (const auto& p : sourceOperationMap_) {
1051  std::string targetCond = " elsif ";
1052  if (firstTargetCond) {
1053  targetCond = " if ";
1054  firstTargetCond = false;
1055  }
1056  stream << targetCond + "target_fu_r = "
1057  << sourcePortID_.at(p.first) << " then \n";
1058  std::unordered_map<std::string, InstructionBitVector*>
1059  instructions = (this->*instructionFunc)(p.first, rs2RFPort_);
1060  std::string bits = instructions.at(op.first)->toString();
1061  reverse(bits.begin(), bits.end());
1062  bits = bits.substr(rs1BusStart_, rs1BusWidth_);
1063  reverse(bits.begin(), bits.end());
1064  stream << " moves(rs1_start_c + rs1_width_c -1 downto"
1065  << " rs1_start_c)"
1066  << " <= \"" << bits << "\";\n";
1067  for (const auto& val : instructions) {
1068  delete val.second;
1069  }
1070  }
1071  stream << " end if;" << std::endl;
1072  }
1073  stream << " end if;" << std::endl;
1074 }

References iOperations_, rOperations_, rs1BusStart_, rs1BusWidth_, rs2RFPort_, sourceOperationMap_, and sourcePortID_.

Referenced by generateMap().

◆ addRs2ForwardingConditions()

void ProGe::RV32MicroCodeGenerator::addRs2ForwardingConditions ( std::map< std::string, std::string >  ops,
std::unordered_map< std::string, InstructionBitVector * >(ProGe::RV32MicroCodeGenerator::*)(Port *p1, Port *p2) const  instructionFunc,
std::ofstream &  stream 
) const
private

Definition at line 1077 of file RV32MicroCodeGenerator.cc.

1082  {
1083  bool firstOpcodeCond = true;
1084  for (const auto& op : ops) {
1085  std::string opcodeCond = " elsif ";
1086  if (firstOpcodeCond) {
1087  opcodeCond = " if ";
1088  firstOpcodeCond = false;
1089  }
1090  stream << opcodeCond << "fu_opcode(" << op.second.size()
1091  << "-1 downto 0) = \"" << op.second << "\" then\n";
1092  bool firstTargetCond = true;
1093  for (const auto& p : sourceOperationMap_) {
1094  std::string targetCond = " elsif ";
1095  if (firstTargetCond) {
1096  targetCond = " if ";
1097  firstTargetCond = false;
1098  }
1099  stream << targetCond + "target_fu_r = "
1100  << sourcePortID_.at(p.first) << " then \n";
1101  std::unordered_map<std::string, InstructionBitVector*>
1102  instructions = (this->*instructionFunc)(rs1RFPort_, p.first);
1103  std::string bits = instructions.at(op.first)->toString();
1104  reverse(bits.begin(), bits.end());
1105  bits = bits.substr(rs2BusStart_, rs2BusWidth_);
1106  reverse(bits.begin(), bits.end());
1107  stream << " moves(rs2_start_c + rs2_width_c -1 downto"
1108  << " rs2_start_c)"
1109  << " <= \"" << bits << "\";\n";
1110  for (const auto& val : instructions) {
1111  delete val.second;
1112  }
1113  }
1114  stream << " end if;" << std::endl;
1115  }
1116  stream << " end if;" << std::endl;
1117 }

References rs1RFPort_, rs2BusStart_, rs2BusWidth_, sourceOperationMap_, and sourcePortID_.

Referenced by generateMap().

◆ addSPorts()

void ProGe::RV32MicroCodeGenerator::addSPorts ( const std::string &  opName)
private

Definition at line 415 of file RV32MicroCodeGenerator.cc.

415  {
416  FunctionUnit* fu = mapFunctionUnit(opName);
417  HWOperation* op = fu->operation(opName);
418  if (op->operandCount() != 3) {
419  throwOperandCountError(opName, 3, op->operandCount());
420  }
421  FUPort* rs1Port = op->port(1);
422  FUPort* simmPort = op->port(2);
423  FUPort* rs2Port = op->port(3);
424  if (!rs1Port->isTriggering()) {
425  throwTriggeringPortError(rs1Port, "rs1");
426  }
427  if (!rs2Port->isInput()) {
428  throwInputPortError(rs2Port, "rs2");
429  }
430  if (!simmPort->isInput()) {
431  throwInputPortError(simmPort, "imm");
432  }
433  rs1Ports_.insert({opName, rs1Port});
434  simmPorts_.insert({opName, simmPort});
435  rs2Ports_.insert({opName, rs2Port});
436 }

References TTAMachine::Port::isInput(), TTAMachine::FUPort::isTriggering(), mapFunctionUnit(), TTAMachine::HWOperation::operandCount(), TTAMachine::FunctionUnit::operation(), TTAMachine::HWOperation::port(), rs1Ports_, rs2Ports_, simmPorts_, throwInputPortError(), throwOperandCountError(), and throwTriggeringPortError().

Referenced by findOperationPorts().

Here is the call graph for this function:

◆ addUJPorts()

void ProGe::RV32MicroCodeGenerator::addUJPorts ( const std::string &  opName)
private

Definition at line 391 of file RV32MicroCodeGenerator.cc.

391  {
392  if (opName == "move") {
393  return;
394  }
395  ControlUnit* fu = dynamic_cast<ControlUnit*>(mapFunctionUnit(opName));
396  HWOperation* op = fu->operation(opName);
397  FUPort* simmPort = op->port(1);
398  BaseFUPort* rdPort;
399  if (opName == "apc") {
400  rdPort = op->port(2);
401  if (!rdPort->isOutput()) {
402  throwOutputPortError(rdPort, "rd");
403  }
404  } else {
405  rdPort = fu->returnAddressPort();
406  }
407  if (!simmPort->isTriggering()) {
408  throwTriggeringPortError(simmPort, "imm");
409  }
410  rdPorts_.insert({opName, rdPort});
411  simmPorts_.insert({opName, simmPort});
412 }

References TTAMachine::Port::isOutput(), TTAMachine::FUPort::isTriggering(), mapFunctionUnit(), TTAMachine::FunctionUnit::operation(), TTAMachine::HWOperation::port(), rdPorts_, TTAMachine::ControlUnit::returnAddressPort(), simmPorts_, throwOutputPortError(), and throwTriggeringPortError().

Referenced by findOperationPorts().

Here is the call graph for this function:

◆ connectRF()

void ProGe::RV32MicroCodeGenerator::connectRF ( )
private

Definition at line 520 of file RV32MicroCodeGenerator.cc.

520  {
521  RFPort* rs1RFPort = NULL;
522  RFPort* rs2RFPort = NULL;
523  RFPort* rdRFPort = NULL;
524 
525  std::vector<RFPort*> RFOutputPorts;
526  std::vector<RFPort*> RFInputPorts;
527  for (int i = 0; i < RF_->portCount(); i++) {
528  RFPort* tmpPort = RF_->port(i);
529  if (tmpPort->outputSocket() != NULL) {
530  RFOutputPorts.push_back(tmpPort);
531  } else if (tmpPort->inputSocket() != NULL) {
532  RFInputPorts.push_back(tmpPort);
533  }
534  }
535 
536  assert(RFInputPorts.size() > 0);
537  assert(RFOutputPorts.size() > 1);
538 
539  Connection rs1;
540  Connection rs2;
541  Connection rd;
542  Connection simm;
543 
544  // Find candidates for rs1, rs2 and rd busses.
545  bool success = false;
546  bool forwarding = false;
547  for (int l = 0; l < 2 && !success; l++) {
548  // First try with forwarding enabled
549  forwarding = !forwarding;
550  for (unsigned int i = 0; i < RFOutputPorts.size() && !success; i++) {
551  std::vector<RFPort*> tmpRFOutputPorts = RFOutputPorts;
552  rs1RFPort = RFOutputPorts.at(i);
553  tmpRFOutputPorts.erase(tmpRFOutputPorts.begin() + i);
554  for (unsigned int j = 0; j < tmpRFOutputPorts.size() && !success;
555  j++) {
556  rs2RFPort = tmpRFOutputPorts.at(j);
557  for (unsigned int k = 0; k < RFInputPorts.size() && !success;
558  k++) {
559  std::vector<RFPort*> tmpRFInputPorts;
560  tmpRFInputPorts = RFInputPorts;
561  rdRFPort = RFInputPorts.at(k);
562 
563  rs1.port = rs1RFPort;
564  rs2.port = rs2RFPort;
565  rd.port = rdRFPort;
566 
567  rs1.bus = NULL;
568  rs2.bus = NULL;
569  rd.bus = NULL;
570  simm.bus = NULL;
571 
572  success =
573  findConnectedBusses(rs1, rs2, rd, simm, forwarding);
574  if (success) {
575  break;
576  }
577  }
578  }
579  }
580  }
581 
582  if (!success) {
583  std::string msg =
584  "Could not find enough connectivity in the "
585  "interconnect to construct RISC-V control and decode logic. Make "
586  "sure "
587  "the minimum connections are in place and that the operand-port "
588  "bindings are valid in FUs";
589  throw InvalidData(__FILE__, __LINE__, __func__, msg);
590  }
591  hasForwarding_ = forwarding;
592 
593  rs1Bus_ = rs1.bus;
594  rs2Bus_ = rs2.bus;
595  rdBus_ = rd.bus;
596  simmBus_ = simm.bus;
597  rs1RFPort_ = rs1RFPort;
598  rs2RFPort_ = rs2RFPort;
599  rdRFPort_ = rdRFPort;
600 }

References __func__, assert, ProGe::MicroCodeGenerator::Connection::bus, findConnectedBusses(), hasForwarding_, TTAMachine::Port::inputSocket(), TTAMachine::Port::outputSocket(), ProGe::MicroCodeGenerator::Connection::port, TTAMachine::BaseRegisterFile::port(), TTAMachine::Unit::portCount(), rdBus_, rdRFPort_, RF_, rs1Bus_, rs1RFPort_, rs2Bus_, rs2RFPort_, and simmBus_.

Referenced by RV32MicroCodeGenerator().

Here is the call graph for this function:

◆ constructBInstructions()

std::unordered_map< std::string, InstructionBitVector * > ProGe::RV32MicroCodeGenerator::constructBInstructions ( Port src1,
Port src2 
) const
private

Definition at line 831 of file RV32MicroCodeGenerator.cc.

831  {
832  std::unordered_map<std::string, InstructionBitVector*> retval;
833  CodeCompressorPlugin* compressor = &pig_->compressor();
834  for (const auto& op : bOperations_) {
835  Instruction* instruction = new Instruction();
836  HWOperation* operation =
837  mapFunctionUnit(op.first)->operation(op.first);
838 
839  FUPort* rs1Port = static_cast<FUPort*>(rs1Ports_.at(op.first));
840  FUPort* simmPort = static_cast<FUPort*>(simmPorts_.at(op.first));
841  FUPort* rs2Port = static_cast<FUPort*>(rs2Ports_.at(op.first));
842 
843  instruction->addMove(std::make_shared<Move>(
845  new TerminalFUPort(*simmPort, *operation), *simmBus_));
846 
847  if (dynamic_cast<RFPort*>(src1)) {
848  instruction->addMove(std::make_shared<Move>(
849  new TerminalRegister(*src1, 0), new TerminalFUPort(*rs1Port),
850  *rs1Bus_));
851  } else {
852  instruction->addMove(std::make_shared<Move>(
853  new TerminalFUPort(*static_cast<BaseFUPort*>(src1)),
854  new TerminalFUPort(*rs1Port), *rs1Bus_));
855  }
856 
857  if (dynamic_cast<RFPort*>(src2)) {
858  instruction->addMove(std::make_shared<Move>(
859  new TerminalRegister(*src2, 0), new TerminalFUPort(*rs2Port),
860  *rs2Bus_));
861  } else {
862  instruction->addMove(std::make_shared<Move>(
863  new TerminalFUPort(*static_cast<BaseFUPort*>(src2)),
864  new TerminalFUPort(*rs2Port), *rs2Bus_));
865  }
866 
867  InstructionBitVector* bits =
868  compressor->bemInstructionBits(*instruction);
869  delete instruction;
870  retval.insert({op.first, bits});
871  }
872  return retval;
873 }

References TTAProgram::Instruction::addMove(), CodeCompressorPlugin::bemInstructionBits(), bOperations_, ProgramImageGenerator::compressor(), mapFunctionUnit(), TTAMachine::FunctionUnit::operation(), pig_, rs1Bus_, rs1Ports_, rs2Bus_, rs2Ports_, simmBus_, simmPorts_, and TTAMachine::Bus::width().

Referenced by generateMap().

Here is the call graph for this function:

◆ constructIInstructions()

std::unordered_map< std::string, InstructionBitVector * > ProGe::RV32MicroCodeGenerator::constructIInstructions ( Port src1,
Port src2 
) const
private

Definition at line 723 of file RV32MicroCodeGenerator.cc.

724  {
725  std::unordered_map<std::string, InstructionBitVector*> retval;
726  CodeCompressorPlugin* compressor = &pig_->compressor();
727  for (const auto& op : iOperations_) {
728  Instruction* instruction = new Instruction();
729 
730  HWOperation* operation =
731  mapFunctionUnit(op.first)->operation(op.first);
732 
733  FUPort* rdPort = static_cast<FUPort*>(rdPorts_.at(op.first));
734 
735  // ALU operations are a special case as they are shared with R type
736  if (op.first != "calla") {
737  FUPort* simmPort = static_cast<FUPort*>(simmPorts_.at(op.first));
738  FUPort* rs1Port = static_cast<FUPort*>(rs1Ports_.at(op.first));
739 
740  if (dynamic_cast<RFPort*>(src1)) {
741  instruction->addMove(std::make_shared<Move>(
742  new TerminalRegister(*src1, 0),
743  new TerminalFUPort(*rs1Port, *operation), *rs1Bus_));
744  } else {
745  instruction->addMove(std::make_shared<Move>(
746  new TerminalFUPort(*static_cast<BaseFUPort*>(src1)),
747  new TerminalFUPort(*rs1Port, *operation), *rs1Bus_));
748  }
749 
750  instruction->addMove(std::make_shared<Move>(
752  new TerminalFUPort(*simmPort), *simmBus_));
753 
754  } else {
755  FUPort* rs1Port = static_cast<FUPort*>(rs1Ports_.at(op.first));
756  FUPort* simmPort = static_cast<FUPort*>(simmPorts_.at(op.first));
757 
758  if (dynamic_cast<RFPort*>(src1)) {
759  instruction->addMove(std::make_shared<Move>(
760  new TerminalRegister(*src1, 0),
761  new TerminalFUPort(*rs1Port), *rs1Bus_));
762  } else {
763  instruction->addMove(std::make_shared<Move>(
764  new TerminalFUPort(*static_cast<BaseFUPort*>(src1)),
765  new TerminalFUPort(*rs1Port), *rs1Bus_));
766  }
767 
768  instruction->addMove(std::make_shared<Move>(
770  new TerminalFUPort(*simmPort, *operation), *simmBus_));
771  }
772 
773  instruction->addMove(std::make_shared<Move>(
774  new TerminalFUPort(*rdPort), new TerminalRegister(*rdRFPort_, 0),
775  *rdBus_));
776 
777  InstructionBitVector* bits =
778  compressor->bemInstructionBits(*instruction);
779  delete instruction;
780  retval.insert({op.first, bits});
781  }
782  return retval;
783 }

References TTAProgram::Instruction::addMove(), CodeCompressorPlugin::bemInstructionBits(), ProgramImageGenerator::compressor(), iOperations_, mapFunctionUnit(), TTAMachine::FunctionUnit::operation(), pig_, rdBus_, rdPorts_, rdRFPort_, rs1Bus_, rs1Ports_, simmBus_, simmPorts_, and TTAMachine::Bus::width().

Referenced by generateMap().

Here is the call graph for this function:

◆ constructRInstructions()

std::unordered_map< std::string, InstructionBitVector * > ProGe::RV32MicroCodeGenerator::constructRInstructions ( Port src1,
Port src2 
) const
private

Definition at line 678 of file RV32MicroCodeGenerator.cc.

678  {
679  std::unordered_map<std::string, InstructionBitVector*> retval;
680  CodeCompressorPlugin* compressor = &pig_->compressor();
681  for (const auto& op : rOperations_) {
682  Instruction* instruction = new Instruction();
683  HWOperation* operation =
684  mapFunctionUnit(op.first)->operation(op.first);
685 
686  FUPort* rs1Port = static_cast<FUPort*>(rs1Ports_.at(op.first));
687  FUPort* rs2Port = static_cast<FUPort*>(rs2Ports_.at(op.first));
688  FUPort* rdPort = static_cast<FUPort*>(rdPorts_.at(op.first));
689 
690  if (dynamic_cast<RFPort*>(src1)) {
691  instruction->addMove(std::make_shared<Move>(
692  new TerminalRegister(*src1, 0),
693  new TerminalFUPort(*rs1Port, *operation), *rs1Bus_));
694  } else {
695  instruction->addMove(std::make_shared<Move>(
696  new TerminalFUPort(*static_cast<BaseFUPort*>(src1)),
697  new TerminalFUPort(*rs1Port, *operation), *rs1Bus_));
698  }
699 
700  if (dynamic_cast<RFPort*>(src2)) {
701  instruction->addMove(std::make_shared<Move>(
702  new TerminalRegister(*src2, 0), new TerminalFUPort(*rs2Port),
703  *rs2Bus_));
704  } else {
705  instruction->addMove(std::make_shared<Move>(
706  new TerminalFUPort(*static_cast<BaseFUPort*>(src2)),
707  new TerminalFUPort(*rs2Port), *rs2Bus_));
708  }
709 
710  instruction->addMove(std::make_shared<Move>(
711  new TerminalFUPort(*rdPort), new TerminalRegister(*rdRFPort_, 0),
712  *rdBus_));
713 
714  InstructionBitVector* bits =
715  compressor->bemInstructionBits(*instruction);
716  delete instruction;
717  retval.insert({op.first, bits});
718  }
719  return retval;
720 }

References TTAProgram::Instruction::addMove(), CodeCompressorPlugin::bemInstructionBits(), ProgramImageGenerator::compressor(), mapFunctionUnit(), TTAMachine::FunctionUnit::operation(), pig_, rdBus_, rdPorts_, rdRFPort_, rOperations_, rs1Bus_, rs1Ports_, rs2Bus_, and rs2Ports_.

Referenced by generateMap().

Here is the call graph for this function:

◆ constructSInstructions()

std::unordered_map< std::string, InstructionBitVector * > ProGe::RV32MicroCodeGenerator::constructSInstructions ( Port src1,
Port src2 
) const
private

Definition at line 786 of file RV32MicroCodeGenerator.cc.

786  {
787  std::unordered_map<std::string, InstructionBitVector*> retval;
788  CodeCompressorPlugin* compressor = &pig_->compressor();
789  for (const auto& op : sOperations_) {
790  Instruction* instruction = new Instruction();
791  HWOperation* operation =
792  mapFunctionUnit(op.first)->operation(op.first);
793 
794  FUPort* simmPort = static_cast<FUPort*>(simmPorts_.at(op.first));
795  FUPort* rs1Port = static_cast<FUPort*>(rs1Ports_.at(op.first));
796  FUPort* rs2Port = static_cast<FUPort*>(rs2Ports_.at(op.first));
797 
798  if (dynamic_cast<RFPort*>(src1)) {
799  instruction->addMove(std::make_shared<Move>(
800  new TerminalRegister(*src1, 0),
801  new TerminalFUPort(*rs1Port, *operation), *rs1Bus_));
802  } else {
803  instruction->addMove(std::make_shared<Move>(
804  new TerminalFUPort(*static_cast<BaseFUPort*>(src1)),
805  new TerminalFUPort(*rs1Port, *operation), *rs1Bus_));
806  }
807 
808  instruction->addMove(std::make_shared<Move>(
810  new TerminalFUPort(*simmPort), *simmBus_));
811 
812  if (dynamic_cast<RFPort*>(src2)) {
813  instruction->addMove(std::make_shared<Move>(
814  new TerminalRegister(*src2, 0), new TerminalFUPort(*rs2Port),
815  *rs2Bus_));
816  } else {
817  instruction->addMove(std::make_shared<Move>(
818  new TerminalFUPort(*static_cast<BaseFUPort*>(src2)),
819  new TerminalFUPort(*rs2Port), *rs2Bus_));
820  }
821 
822  InstructionBitVector* bits =
823  compressor->bemInstructionBits(*instruction);
824  delete instruction;
825  retval.insert({op.first, bits});
826  }
827  return retval;
828 }

References TTAProgram::Instruction::addMove(), CodeCompressorPlugin::bemInstructionBits(), ProgramImageGenerator::compressor(), mapFunctionUnit(), TTAMachine::FunctionUnit::operation(), pig_, rs1Bus_, rs1Ports_, rs2Bus_, rs2Ports_, simmBus_, simmPorts_, sOperations_, and TTAMachine::Bus::width().

Referenced by generateMap().

Here is the call graph for this function:

◆ constructUJInstructions()

std::unordered_map< std::string, InstructionBitVector * > ProGe::RV32MicroCodeGenerator::constructUJInstructions ( ) const
private

Definition at line 876 of file RV32MicroCodeGenerator.cc.

876  {
877  std::unordered_map<std::string, InstructionBitVector*> retval;
878  CodeCompressorPlugin* compressor = &pig_->compressor();
879  InstructionBitVector* bits;
880 
881  for (const auto& op : ujOperations_) {
882  Instruction* instruction = new Instruction();
883  if (op.first == "move") {
884  HWOperation* operation = mapFunctionUnit("add")->operation("add");
885  FUPort* rs1Port = static_cast<FUPort*>(rs1Ports_.at("add"));
886  FUPort* simmPort = static_cast<FUPort*>(simmPorts_.at("add"));
887  FUPort* rdPort = static_cast<FUPort*>(rdPorts_.at("add"));
888  instruction->addMove(std::make_shared<Move>(
889  new TerminalRegister(*rs1RFPort_, 0),
890  new TerminalFUPort(*rs1Port, *operation), *rs1Bus_));
891 
892  instruction->addMove(std::make_shared<Move>(
894  new TerminalFUPort(*simmPort), *simmBus_));
895 
896  instruction->addMove(std::make_shared<Move>(
897  new TerminalFUPort(*rdPort),
898  new TerminalRegister(*rdRFPort_, 0), *rdBus_));
899 
900  bits = compressor->bemInstructionBits(*instruction);
901  retval.insert({"move", bits});
902  delete instruction;
903  } else if (op.first == "callr" or op.first == "apc") {
904  FUPort* rdPort = static_cast<FUPort*>(rdPorts_.at(op.first));
905 
906  instruction->addMove(std::make_shared<Move>(
907  new TerminalFUPort(*rdPort),
908  new TerminalRegister(*rdRFPort_, 0), *rdBus_));
909 
910  bits = compressor->bemInstructionBits(*instruction);
911  delete instruction;
912  retval.insert({op.first, bits});
913 
914  } else {
915  FUPort* simmPort = static_cast<FUPort*>(simmPorts_.at(op.first));
916  FUPort* rdPort = static_cast<FUPort*>(rdPorts_.at(op.first));
917 
918  HWOperation* operation =
919  mapFunctionUnit(op.first)->operation(op.first);
920 
921  instruction->addMove(std::make_shared<Move>(
923  new TerminalFUPort(*simmPort, *operation), *simmBus_));
924 
925  instruction->addMove(std::make_shared<Move>(
926  new TerminalFUPort(*rdPort),
927  new TerminalRegister(*rdRFPort_, 0), *rdBus_));
928 
929  bits = compressor->bemInstructionBits(*instruction);
930  delete instruction;
931 
932  retval.insert({op.first, bits});
933  }
934  }
935 
936  return retval;
937 }

References TTAProgram::Instruction::addMove(), CodeCompressorPlugin::bemInstructionBits(), ProgramImageGenerator::compressor(), mapFunctionUnit(), TTAMachine::FunctionUnit::operation(), pig_, rdBus_, rdPorts_, rdRFPort_, rs1Bus_, rs1Ports_, rs1RFPort_, simmBus_, simmPorts_, ujOperations_, and TTAMachine::Bus::width().

Referenced by generateMap().

Here is the call graph for this function:

◆ findBusWidths()

void ProGe::RV32MicroCodeGenerator::findBusWidths ( )
private

Definition at line 490 of file RV32MicroCodeGenerator.cc.

490  {
491  for (int i = 0; i < bem_->moveSlotCount(); i++) {
492  MoveSlot& slot = bem_->moveSlot(i);
493  if (slot.name() == rs1Bus_->name()) {
494  rs1BusWidth_ = slot.width();
495  assert(slot.hasDestinationField());
497  rs1BusStart_ = slot.bitPosition();
498  } else if (slot.name() == rs2Bus_->name()) {
499  rs2BusWidth_ = slot.width();
500  assert(slot.hasDestinationField());
502  rs2BusStart_ = slot.bitPosition();
503  } else if (slot.name() == rdBus_->name()) {
504  rdBusWidth_ = slot.width();
505  rdRFStart_ = 0;
506  rdBusStart_ = slot.bitPosition();
507  } else if (slot.name() == simmBus_->name()) {
508  simmBusWidth_ = slot.width();
509  simmRFStart_ = 0;
510  simmBusStart_ = slot.bitPosition();
511  }
512  }
513  assert(rs1BusWidth_ > 0);
514  assert(rs2BusWidth_ > 0);
515  assert(rdBusWidth_ > 0);
516  assert(simmBusWidth_ > 0);
517 }

References assert, bem_, InstructionField::bitPosition(), MoveSlot::destinationField(), MoveSlot::hasDestinationField(), BinaryEncoding::moveSlot(), BinaryEncoding::moveSlotCount(), MoveSlot::name(), TTAMachine::Component::name(), rdBus_, rdBusStart_, rdBusWidth_, rdRFStart_, rs1Bus_, rs1BusStart_, rs1BusWidth_, rs1RFStart_, rs2Bus_, rs2BusStart_, rs2BusWidth_, rs2RFStart_, simmBus_, simmBusStart_, simmBusWidth_, simmRFStart_, SlotField::width(), and MoveSlot::width().

Referenced by RV32MicroCodeGenerator().

Here is the call graph for this function:

◆ findConnectedBusses()

bool ProGe::RV32MicroCodeGenerator::findConnectedBusses ( Connection rs1,
Connection rs2,
Connection rd,
Connection simm,
const bool &  forwarding 
) const
private

Definition at line 613 of file RV32MicroCodeGenerator.cc.

615  {
616  std::set<Port*> rs1Ports = operationPorts(rs1Ports_);
617  rs1Ports.insert(rs1.port);
618 
619  std::set<Port*> rs2Ports = operationPorts(rs2Ports_);
620  rs2Ports.insert(rs2.port);
621 
622  std::set<Port*> simmPorts = operationPorts(simmPorts_);
623 
624  std::set<Port*> rdPorts = operationPorts(rdPorts_);
625 
626  if (forwarding) {
627  rs1Ports.insert(rdPorts.begin(), rdPorts.end());
628  rs2Ports.insert(rdPorts.begin(), rdPorts.end());
629  }
630 
631  rdPorts.insert(rd.port);
632 
633  // Brute forces all combinations until all ports can be mapped to a bus
634  for (unsigned int i = 0; i < busses_.size(); i++) {
635  std::vector<Bus*> tmpBusses = busses_;
636  rs1.bus = NULL;
637  rs2.bus = NULL;
638  rd.bus = NULL;
639  simm.bus = NULL;
640  Bus* tmpBus = busses_.at(i);
641  if (!MachineConnectivityCheck::isConnected(rs1Ports, *tmpBus)) {
642  continue;
643  }
644  rs1.bus = tmpBus;
645  tmpBusses.erase(tmpBusses.begin() + i);
646  rs2.bus = NULL;
647  for (unsigned int j = 0; j < tmpBusses.size(); j++) {
648  tmpBus = tmpBusses.at(j);
649  if (!MachineConnectivityCheck::isConnected(rs2Ports, *tmpBus)) {
650  continue;
651  }
652  rs2.bus = tmpBus;
653  tmpBusses.erase(tmpBusses.begin() + j);
654  for (unsigned int k = 0; k < tmpBusses.size(); k++) {
655  tmpBus = tmpBusses.at(k);
657  rdPorts, *tmpBus)) {
658  continue;
659  }
660  rd.bus = tmpBus;
661  tmpBusses.erase(tmpBusses.begin() + k);
662  for (unsigned int h = 0; h < tmpBusses.size(); h++) {
663  tmpBus = tmpBusses.at(h);
665  simmPorts, *tmpBus) &&
666  tmpBus->immediateWidth() > 0) {
667  simm.bus = tmpBus;
668  return true;
669  }
670  }
671  }
672  }
673  }
674  return false;
675 }

References ProGe::MicroCodeGenerator::Connection::bus, busses_, TTAMachine::Bus::immediateWidth(), MachineConnectivityCheck::isConnected(), operationPorts(), ProGe::MicroCodeGenerator::Connection::port, rdPorts_, rs1Ports_, rs2Ports_, and simmPorts_.

Referenced by connectRF().

Here is the call graph for this function:

◆ findOperationPorts()

void ProGe::RV32MicroCodeGenerator::findOperationPorts ( )
private

Definition at line 439 of file RV32MicroCodeGenerator.cc.

439  {
440  for (const auto& op : rOperations_) {
441  addRPorts(op.first);
442  }
443  for (const auto& op : iOperations_) {
444  addIPorts(op.first);
445  }
446  for (const auto& op : sOperations_) {
447  addSPorts(op.first);
448  }
449  for (const auto& op : bOperations_) {
450  addBPorts(op.first);
451  }
452  for (const auto& op : ujOperations_) {
453  addUJPorts(op.first);
454  }
455 }

References addBPorts(), addIPorts(), addRPorts(), addSPorts(), addUJPorts(), bOperations_, iOperations_, rOperations_, sOperations_, and ujOperations_.

Referenced by RV32MicroCodeGenerator().

Here is the call graph for this function:

◆ findOperationSources()

void ProGe::RV32MicroCodeGenerator::findOperationSources ( )
private

Definition at line 128 of file RV32MicroCodeGenerator.cc.

128  {
129  for (const auto& op : rdPorts_) {
130  if (sourceOperationMap_.count(op.second)) {
131  sourceOperationMap_.at(op.second).push_back(op.first);
132  } else {
133  sourceOperationMap_.insert({op.second, {op.first}});
134  }
135  }
136 }

References rdPorts_, and sourceOperationMap_.

Referenced by RV32MicroCodeGenerator().

◆ findRF()

void ProGe::RV32MicroCodeGenerator::findRF ( )
private

Definition at line 467 of file RV32MicroCodeGenerator.cc.

467  {
469  // TODO: Design can have multiple register files. Iterate over all of
470  // them and find one that fits based on connectivity.
471  for (int i = 0; i < rfNav.count(); i++) {
472  RegisterFile* rf = rfNav.item(0);
473  if (rf->inputPortCount() > 0 && rf->outputPortCount() > 1 &&
474  rf->zeroRegister()) {
475  if (rf->size() > 31 && rf->width() == 32) {
476  RF_ = rf;
477  } else if (rf->size() == 16 && rf->width() == 32) {
478  RF_ = rf;
479  eVariant_ = true;
480  }
481  }
482  }
483  if (RF_ == NULL) {
484  std::string msg = "Could not find a valid register file for RISC-V";
485  throw InvalidData(__FILE__, __LINE__, __func__, msg);
486  }
487 }

References __func__, TTAMachine::Machine::Navigator< ComponentType >::count(), eVariant_, TTAMachine::Unit::inputPortCount(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine_, TTAMachine::Unit::outputPortCount(), TTAMachine::Machine::registerFileNavigator(), RF_, TTAMachine::BaseRegisterFile::size(), TTAMachine::BaseRegisterFile::width(), and TTAMachine::RegisterFile::zeroRegister().

Referenced by RV32MicroCodeGenerator().

Here is the call graph for this function:

◆ generateFUTargetProcess()

void ProGe::RV32MicroCodeGenerator::generateFUTargetProcess ( std::ofstream &  stream)
private

Definition at line 957 of file RV32MicroCodeGenerator.cc.

957  {
958  std::unordered_map<std::string, std::string> operations;
959  operations.insert(rOperations_.begin(), rOperations_.end());
960  operations.insert(iOperations_.begin(), iOperations_.end());
961  operations.insert(sOperations_.begin(), sOperations_.end());
962  operations.insert(bOperations_.begin(), bOperations_.end());
963  operations.insert(ujOperations_.begin(), ujOperations_.end());
964  int len = std::ceil(std::log2(sourceOperationMap_.size()));
965 
966  stream << " process(fu_opcode)" << std::endl
967  << " begin" << std::endl
968  << " target_fu <= to_unsigned(0, " << len << ");" << std::endl;
969 
970  int id = 0;
971  bool firstCond = true;
972  std::string cond;
973  for (const auto& p : sourceOperationMap_) {
974  sourcePortID_.insert({p.first, id});
975  for (const auto& op : p.second) {
976  if (firstCond) {
977  cond = " if ";
978  firstCond = false;
979  } else {
980  cond = " elsif ";
981  }
982  // Add is a special case as it is used in LUI
983  if (op == "add") {
984  int iLen = iOperations_.at(op).size();
985  int uLen = ujOperations_.at("move").size();
986  stream << cond << "fu_opcode(" << iLen << "-1 downto 0)"
987  << " = \"" << iOperations_.at(op) << "\""
988  << " or "
989  << "fu_opcode = \"" << rOperations_.at(op)
990  << "\" or fu_opcode(" << uLen << "-1 downto 0) = \""
991  << ujOperations_.at("move") << "\""
992  << " then\n";
993 
994  } else if (iOperations_.count(op) && rOperations_.count(op)) {
995  int iLen = iOperations_.at(op).size();
996  stream << cond << "fu_opcode(" << iLen << "-1 downto 0)"
997  << " = \"" << iOperations_.at(op) << "\" or "
998  << "fu_opcode = \"" << rOperations_.at(op)
999  << "\" then\n";
1000  } else {
1001  int opLen = operations.at(op).size();
1002  stream << cond << "fu_opcode(" << opLen << "-1 downto 0)"
1003  << "= \"" << operations.at(op) << "\" then\n";
1004  }
1005  stream << " target_fu <= to_unsigned(" << id << ", " << len
1006  << ");\n";
1007  }
1008  id++;
1009  }
1010  stream << " end if;" << std::endl << " end process;" << std::endl;
1011 
1012  stream << std::endl << std::endl;
1013  stream << " process(clk, rstx)" << std::endl
1014  << " begin" << std::endl
1015  << " if(rstx = '0') then" << std::endl
1016  << " target_fu_r <= (others => '0');" << std::endl
1017  << " elsif clk'event and clk = '1' then" << std::endl
1018  << " if glock_in = '0' and halt = '0' then" << std::endl
1019  << " target_fu_r <= target_fu;" << std::endl
1020  << " end if;" << std::endl
1021  << " end if;" << std::endl
1022  << " end process;" << std::endl
1023  << std::endl
1024  << std::endl;
1025 }

References bOperations_, iOperations_, rOperations_, sOperations_, sourceOperationMap_, sourcePortID_, and ujOperations_.

Referenced by generateMap().

◆ generateMap()

void ProGe::RV32MicroCodeGenerator::generateMap ( const std::string &  dstDirectory)
private

Definition at line 1120 of file RV32MicroCodeGenerator.cc.

1120  {
1121  /*TODO: The if structure should be replaced with a case statement
1122  The problem is that the fu_opcode's width is different between
1123  formats. Don't care states in a case statement
1124  is a VHDL-2OO8 feature
1125  */
1126  const std::string DS = FileSystem::DIRECTORY_SEPARATOR;
1127  std::string mapFile = dstDirectory + DS + "rv32_microcode.vhdl";
1128 
1129  std::ofstream stream;
1130  stream.open(mapFile);
1131 
1132  stream << "library IEEE;" << std::endl
1133  << "use IEEE.std_logic_1164.all;" << std::endl
1134  << "use IEEE.numeric_std.all;" << std::endl
1135  << "use work.tta0_globals.all;" << std::endl
1136  << std::endl
1137  << std::endl;
1138 
1139  stream << "entity rv32_microcode is" << std::endl << "port(" << std::endl;
1140  if (hasForwarding_) {
1141  stream << " clk : in std_logic;" << std::endl
1142  << " rstx : in std_logic;" << std::endl
1143  << " glock_in : in std_logic;" << std::endl
1144  << " data_hazard_in : in std_logic;" << std::endl
1145  << " rs1_hazard_in : in std_logic;" << std::endl
1146  << " rs2_hazard_in : in std_logic;" << std::endl
1147  << " halt : in std_logic;" << std::endl;
1148  }
1149  stream << " fu_opcode_in : in std_logic_vector(16 downto 0);"
1150  << std::endl
1151  << " moves_out : out std_logic_vector(INSTRUCTIONWIDTH-1 "
1152  "downto 0));"
1153  << std::endl
1154  << std::endl
1155  << "end rv32_microcode;" << std::endl
1156  << std::endl
1157  << "architecture rtl of rv32_microcode is" << std::endl
1158  << " signal fu_opcode : std_logic_vector(16 downto 0);"
1159  << std::endl
1160  << " signal moves : std_logic_vector(INSTRUCTIONWIDTH-1 "
1161  "downto 0);"
1162  << std::endl
1163  << " constant rs1_start_c : integer := " << rs1BusStart_ << ";"
1164  << std::endl
1165  << " constant rs2_start_c : integer := " << rs2BusStart_ << ";"
1166  << std::endl
1167  << " constant rs1_width_c : integer := " << rs1BusWidth_ << ";"
1168  << std::endl
1169  << " constant rs2_width_c : integer := " << rs2BusWidth_ << ";"
1170  << std::endl;
1171  if (hasForwarding_) {
1172  int len = std::ceil(std::log2(sourceOperationMap_.size()));
1173  stream << " signal target_fu : unsigned(" << len << "-1 downto 0);"
1174  << std::endl;
1175  stream << " signal target_fu_r : unsigned (" << len
1176  << "-1 downto 0);" << std::endl
1177  << " signal data_hazard : std_logic;\n"
1178  << " signal rs1_hazard : std_logic;\n"
1179  << " signal rs2_hazard : std_logic;\n";
1180  }
1181 
1182  stream << std::endl
1183  << " begin" << std::endl
1184  << std::endl
1185  << " fu_opcode <= fu_opcode_in;" << std::endl
1186  << " moves_out <= moves;" << std::endl
1187  << std::endl;
1188  if (hasForwarding_) {
1189  stream << " data_hazard <= data_hazard_in;" << std::endl
1190  << " rs1_hazard <= rs1_hazard_in;" << std::endl
1191  << " rs2_hazard <= rs2_hazard_in;" << std::endl;
1192  stream << std::endl;
1193  generateFUTargetProcess(stream);
1194  }
1195  stream << " process(fu_opcode";
1196  if (hasForwarding_) {
1197  stream << ", data_hazard, rs1_hazard, rs2_hazard, target_fu_r";
1198  }
1199  stream << ")" << std::endl;
1200  stream << " begin" << std::endl;
1201 
1202  std::unordered_map<std::string, InstructionBitVector*> instructions =
1204  bool firstCond = true;
1205  for (const auto& op : instructions) {
1206  if (firstCond) {
1207  stream << " if(fu_opcode = \"" << rOperations_.at(op.first)
1208  << "\") then" << std::endl
1209  << " moves <= \"" << op.second->toString() << "\";"
1210  << std::endl;
1211  delete op.second;
1212  firstCond = false;
1213  continue;
1214  }
1215  stream << " elsif(fu_opcode(" << rOperations_.at(op.first).size()
1216  << " - 1 downto 0) = \"" << rOperations_.at(op.first) << "\""
1217  << ") then" << std::endl
1218  << " moves <= \"" << op.second->toString() << "\";"
1219  << std::endl;
1220  delete op.second;
1221  }
1222 
1223  instructions = constructIInstructions(rs1RFPort_, rs1RFPort_);
1224  addBitsToMap(instructions, iOperations_, stream);
1225 
1226  instructions = constructSInstructions(rs1RFPort_, rs2RFPort_);
1227  addBitsToMap(instructions, sOperations_, stream);
1228 
1229  instructions = constructBInstructions(rs1RFPort_, rs2RFPort_);
1230  addBitsToMap(instructions, bOperations_, stream);
1231 
1232  instructions = constructUJInstructions();
1233  addBitsToMap(instructions, ujOperations_, stream);
1234 
1235  stream << " else" << std::endl;
1236  stream << " moves <= \"" + NOP_ + "\";" << std::endl;
1237 
1238  stream << " end if;" << std::endl;
1239 
1240  if (hasForwarding_) {
1241  stream << " if(data_hazard = '1') then\n"
1242  << " if(rs1_hazard = '1') then\n";
1244  rOperations_,
1247  bOperations_,
1250  sOperations_,
1253  iOperations_,
1255  stream << " end if;\n"
1256  << " if(rs2_hazard = '1') then\n";
1258  rOperations_,
1261  bOperations_,
1264  sOperations_,
1266  stream << " end if;\n"
1267  << " end if;\n";
1268  }
1269 
1270  stream << " end process;" << std::endl;
1271 
1272  stream << "end architecture rtl;" << std::endl;
1273 
1274  stream.close();
1275 }

References addBitsToMap(), addRs1ForwardingConditions(), addRs2ForwardingConditions(), bOperations_, constructBInstructions(), constructIInstructions(), constructRInstructions(), constructSInstructions(), constructUJInstructions(), FileSystem::DIRECTORY_SEPARATOR, DS, generateFUTargetProcess(), hasForwarding_, iOperations_, NOP_, rOperations_, rs1BusStart_, rs1BusWidth_, rs1RFPort_, rs2BusStart_, rs2BusWidth_, rs2RFPort_, sOperations_, sourceOperationMap_, and ujOperations_.

Referenced by generateRTL().

Here is the call graph for this function:

◆ generateNOP()

void ProGe::RV32MicroCodeGenerator::generateNOP ( )
private

Definition at line 458 of file RV32MicroCodeGenerator.cc.

458  {
459  CodeCompressorPlugin* compressor = &pig_->compressor();
460  Instruction* instruction = new Instruction();
461  InstructionBitVector* bits = compressor->bemInstructionBits(*instruction);
462  NOP_ = bits->toString();
463  delete instruction;
464 }

References CodeCompressorPlugin::bemInstructionBits(), ProgramImageGenerator::compressor(), NOP_, pig_, and BitVector::toString().

Referenced by RV32MicroCodeGenerator().

Here is the call graph for this function:

◆ generateOperationLatencyLogic()

std::string ProGe::RV32MicroCodeGenerator::generateOperationLatencyLogic ( HDLTemplateInstantiator instantiator)
private

Definition at line 1278 of file RV32MicroCodeGenerator.cc.

1279  {
1280  std::map<std::string, std::string> operations;
1281  operations.insert(rOperations_.begin(), rOperations_.end());
1282  int maxVal = 1;
1283  for (const auto& op : iOperations_) {
1284  if (!rOperations_.count(op.first)) {
1285  operations.insert(op);
1286  }
1287  }
1288  std::map<std::string, int> opLatency;
1289  for (const auto& op : operations) {
1290  FunctionUnit* fu = mapFunctionUnit(op.first);
1291  HWOperation* operation = fu->operation(op.first);
1292  if (operation->latency() > 1) {
1293  opLatency.insert({op.first, operation->latency() - 1});
1294  if (operation->latency() > maxVal) {
1295  maxVal = operation->latency();
1296  }
1297  }
1298  }
1299  int len = std::ceil(std::log2((maxVal)) + 1);
1300  instantiator.replacePlaceholder("op-lat-width", std::to_string(len));
1301  if (opLatency.size() == 0) {
1302  return "op_latency <= to_unsigned(0,op_lat_width_c);";
1303  }
1304  variableLengthOpLatency_ = true;
1305  std::string logic =
1306  "process(fu_opcode)\n"
1307  "begin\n";
1308  bool firstCond = true;
1309  for (const auto& op : opLatency) {
1310  std::string cond = " elsif ";
1311  if (firstCond) {
1312  cond = " if ";
1313  firstCond = false;
1314  }
1315  if (rOperations_.count(op.first) && iOperations_.count(op.first)) {
1316  cond += "fu_opcode = \"" + rOperations_.at(op.first) + "\" or " +
1317  "fu_opcode(" +
1318  std::to_string(iOperations_.at(op.first).size()) +
1319  "-1 downto 0) = \"" + iOperations_.at(op.first) +
1320  "\" then\n";
1321  } else {
1322  cond += "fu_opcode(" +
1323  std::to_string(operations.at(op.first).size()) +
1324  "-1 downto 0) = \"" + operations.at(op.first) +
1325  "\" then\n";
1326  }
1327  logic += cond + " op_latency <= to_unsigned(" +
1328  std::to_string(op.second) + ",op_lat_width_c);\n";
1329  }
1330  logic +=
1331  " else\n"
1332  " op_latency <= to_unsigned(0,op_lat_width_c);\n"
1333  " end if;\n"
1334  "end process;\n";
1335  return logic;
1336 }

References iOperations_, TTAMachine::HWOperation::latency(), mapFunctionUnit(), TTAMachine::FunctionUnit::operation(), HDLTemplateInstantiator::replacePlaceholder(), rOperations_, and variableLengthOpLatency_.

Referenced by generateWrapper().

Here is the call graph for this function:

◆ generateRTL()

void ProGe::RV32MicroCodeGenerator::generateRTL ( HDLTemplateInstantiator instantiator,
const std::string &  fileDst 
)
virtual

Implements ProGe::MicroCodeGenerator.

Definition at line 1556 of file RV32MicroCodeGenerator.cc.

1557  {
1558  generateMap(fileDst);
1559  generateWrapper(instantiator, fileDst);
1560 }

References generateMap(), and generateWrapper().

Referenced by DefaultICDecoderGenerator::generate().

Here is the call graph for this function:

◆ generateWrapper()

void ProGe::RV32MicroCodeGenerator::generateWrapper ( HDLTemplateInstantiator instantiator,
const std::string &  fileDst 
)
private

Definition at line 1339 of file RV32MicroCodeGenerator.cc.

1340  {
1341  instantiator.replacePlaceholder(
1342  "rs1-bus-width", std::to_string(rs1BusWidth_));
1343  instantiator.replacePlaceholder(
1344  "rs2-bus-width", std::to_string(rs2BusWidth_));
1345  instantiator.replacePlaceholder(
1346  "rd-bus-width", std::to_string(rdBusWidth_));
1347  instantiator.replacePlaceholder(
1348  "simm-bus-width", std::to_string(simmBusWidth_));
1349 
1350  instantiator.replacePlaceholder(
1351  "rs1-bus-start", std::to_string(rs1BusStart_));
1352  instantiator.replacePlaceholder(
1353  "rs2-bus-start", std::to_string(rs2BusStart_));
1354  instantiator.replacePlaceholder(
1355  "rd-bus-start", std::to_string(rdBusStart_));
1356  instantiator.replacePlaceholder(
1357  "simm-bus-start", std::to_string(simmBusStart_));
1358 
1359  instantiator.replacePlaceholder(
1360  "rs1-rf-start", std::to_string(rs1RFStart_));
1361  instantiator.replacePlaceholder(
1362  "rs2-rf-start", std::to_string(rs2RFStart_));
1363  instantiator.replacePlaceholder(
1364  "rd-rf-start", std::to_string(rdRFStart_));
1365  instantiator.replacePlaceholder(
1366  "simm-rf-start", std::to_string(simmRFStart_));
1367 
1368  if (eVariant_) {
1369  instantiator.replacePlaceholder("rf-width", std::to_string(4));
1370  } else {
1371  instantiator.replacePlaceholder("rf-width", std::to_string(5));
1372  }
1373 
1374  std::string nop = NOP_;
1375  reverse(nop.begin(), nop.end());
1376  nop = nop.substr(rdBusStart_, rdBusWidth_);
1377  reverse(nop.begin(), nop.end());
1378  const std::string rdNOP = nop;
1379 
1380  instantiator.replacePlaceholder("rd-nop", rdNOP);
1381  instantiator.replacePlaceholder("nop-instruction", NOP_);
1382  instantiator.replacePlaceholder(
1383  "rv32-microcode-simm-assign", "simm_out <= simm_r;");
1384 
1385  const std::string DS = FileSystem::DIRECTORY_SEPARATOR;
1386  const std::string templateDir = Environment::dataDirPath("ProGe");
1387 
1388  instantiator.replacePlaceholder(
1389  "rv32-microcode-instruction-assign",
1390  "instruction <= instruction_in;");
1391 
1392  if (hasForwarding_) {
1393  std::string forwardingPorts =
1394  " clk : in std_logic;\n"
1395  " rstx : in std_logic;\n"
1396  " glock_in : in std_logic;\n"
1397  " data_hazard_in : in std_logic;\n"
1398  " rs1_hazard_in : in std_logic;\n"
1399  " rs2_hazard_in : in std_logic;\n"
1400  " halt : in std_logic;\n";
1401 
1402  std::string forwardingPortMapping =
1403  "clk => clk,\n"
1404  "rstx => rstx,\n"
1405  "glock_in => glock_in,\n"
1406  "data_hazard_in => data_hazard,\n"
1407  "rs1_hazard_in => rs1_hazard,\n"
1408  "rs2_hazard_in => rs2_hazard,\n"
1409  "halt => filling_instruction_pipeline,";
1410 
1411  instantiator.replacePlaceholder("forwarding-ports", forwardingPorts);
1412  instantiator.replacePlaceholder(
1413  "forwarding-port-mapping", forwardingPortMapping);
1414  } else {
1415  instantiator.replacePlaceholder(
1416  "data-hazard-stall", "and data_hazard = '0'");
1417  instantiator.replacePlaceholder(
1418  "data-hazard-assign-conds",
1419  "elsif(data_hazard_r = '1') then\n"
1420  " data_hazard <= '0';");
1421  instantiator.replacePlaceholder(
1422  "data-hazard-detection-sensitivity-list-signals",
1423  ", data_hazard_r");
1424  }
1425  instantiator.replacePlaceholder(
1426  "rv32-microcode-op-latency-process",
1427  generateOperationLatencyLogic(instantiator));
1428  std::string otherStates;
1429 
1431  otherStates += ",HANDLE_OP_LATENCY";
1432  }
1434  otherStates += ",FILL_INSTRUCTION_PIPELINE_2";
1435  }
1436  instantiator.replacePlaceholder(
1437  "rv32-microcode-other-states", otherStates);
1438  std::string executeLogic;
1439  std::string fsm_sensitivity_list_signals;
1440  executeLogic =
1441  " if(glock_in = '1') then\n"
1442  " bubble <= '1';\n"
1443  " stall_ifetch <= '0';\n"
1444  " NS <= EXECUTE;\n"
1445  " elsif (rv_jump_wire = '1' or rv_auipc_wire = '1') then\n"
1446  " rd_bus_move <= rd_move;\n"
1447  " stall_ifetch <= '0';\n"
1448  " bubble <= '1';\n"
1449  " if rv_auipc_wire = '0' then\n"
1450  " NS <= FILL_INSTRUCTION_PIPELINE;\n"
1451  " end if;\n";
1452  if (!hasForwarding_) {
1453  fsm_sensitivity_list_signals = ", data_hazard";
1455  executeLogic +=
1456  " elsif(op_latency_stall = '1' and data_hazard = '0') then\n"
1457  " bubble <= '0';\n"
1458  " NS <= HANDLE_OP_LATENCY;\n"
1459  " stall_ifetch <= '1';\n"
1460  " rd_bus_move <= rd_nop_c;\n";
1461  }
1462  executeLogic +=
1463  " elsif(data_hazard = '1') then\n"
1464  " bubble <= '1';\n"
1465  " rd_bus_move <= rd_nop_c;\n"
1466  " stall_ifetch <= '1';\n"
1467  " NS <= EXECUTE;\n"
1468  " elsif (is_control_flow_op = '1') then\n"
1469  " bubble <= '0';\n"
1470  " stall_ifetch <= '1';\n"
1471  " NS <= HANDLE_CONTROL_FLOW_OP;\n"
1472  " handle_control_flow_ns <= '1';\n"
1473  " else\n"
1474  " bubble <= '0';\n"
1475  " stall_ifetch <= '0';\n"
1476  " NS <= EXECUTE;\n"
1477  " end if;\n";
1478  } else {
1480  executeLogic +=
1481  " elsif(op_latency_stall = '1') then\n"
1482  " bubble <= '0';\n"
1483  " NS <= HANDLE_OP_LATENCY;\n"
1484  " stall_ifetch <= '1';\n"
1485  " rd_bus_move <= rd_nop_c;\n";
1486  }
1487  executeLogic +=
1488  " elsif (is_control_flow_op = '1') then\n"
1489  " bubble <= '0';\n"
1490  " stall_ifetch <= '1';\n"
1491  " NS <= HANDLE_CONTROL_FLOW_OP;\n"
1492  " handle_control_flow_ns <= '1';\n"
1493  " else\n"
1494  " bubble <= '0';\n"
1495  " stall_ifetch <= '0';\n"
1496  " NS <= EXECUTE;\n"
1497  " end if;\n";
1498  }
1500  fsm_sensitivity_list_signals += ", op_latency_stall";
1501  executeLogic +=
1502  "\n"
1503  "when HANDLE_OP_LATENCY =>\n"
1504  " bubble <= '1';\n"
1505  " stall_ifetch <= '1';\n"
1506  " rd_bus_move <= rd_nop_c;\n"
1507  " NS <= HANDLE_OP_LATENCY;\n"
1508  " if(op_latency_stall = '0') then\n"
1509  " NS <= EXECUTE;\n"
1510  " stall_ifetch <= '0';\n"
1511  " rd_bus_move <= rd_move;\n"
1512  " end if;";
1513  }
1514  std::string instructionPipelineStates;
1516  instructionPipelineStates =
1517  "when FILL_INSTRUCTION_PIPELINE =>\n"
1518  " filling_instruction_pipeline <= '1';\n"
1519  " bubble <= '1';\n"
1520  " rd_bus_move <= rd_nop_c;\n"
1521  " stall_ifetch <= '0';\n"
1522  " NS <= EXECUTE;\n";
1523  } else {
1524  instructionPipelineStates =
1525  "when FILL_INSTRUCTION_PIPELINE =>\n"
1526  " filling_instruction_pipeline <= '1';\n"
1527  " bubble <= '1';\n"
1528  " rd_bus_move <= rd_nop_c;\n"
1529  " stall_ifetch <= '0';\n"
1530  " NS <= FILL_INSTRUCTION_PIPELINE_2;\n"
1531  "\n"
1532  "\n"
1533  "when FILL_INSTRUCTION_PIPELINE_2 =>\n"
1534  " filling_instruction_pipeline <= '1';\n"
1535  " bubble <= '1';\n"
1536  " rd_bus_move <= rd_nop_c;\n"
1537  " stall_ifetch <= '0';\n"
1538  " NS <= EXECUTE;\n"
1539  "\n";
1540  }
1541  instantiator.replacePlaceholder(
1542  "rv32-microcode-instruction-pipeline-logic",
1543  instructionPipelineStates);
1544 
1545  instantiator.replacePlaceholder(
1546  "rv32-microcode-fsm-sensitivity-list-signals",
1547  fsm_sensitivity_list_signals);
1548  instantiator.replacePlaceholder(
1549  "rv32-microcode-execute-logic", executeLogic);
1550  instantiator.instantiateTemplateFile(
1551  templateDir + DS + "rv32_microcode_wrapper.vhdl.tmpl",
1552  fileDst + DS + "rv32_microcode_wrapper.vhdl");
1553 }

References bypassInstructionRegister_, Environment::dataDirPath(), FileSystem::DIRECTORY_SEPARATOR, DS, eVariant_, generateOperationLatencyLogic(), hasForwarding_, HDLTemplateInstantiator::instantiateTemplateFile(), NOP_, rdBusStart_, rdBusWidth_, rdRFStart_, HDLTemplateInstantiator::replacePlaceholder(), rs1BusStart_, rs1BusWidth_, rs1RFStart_, rs2BusStart_, rs2BusWidth_, rs2RFStart_, simmBusStart_, simmBusWidth_, simmRFStart_, and variableLengthOpLatency_.

Referenced by generateRTL().

Here is the call graph for this function:

◆ initializeOperations()

void ProGe::RV32MicroCodeGenerator::initializeOperations ( )
private

Definition at line 139 of file RV32MicroCodeGenerator.cc.

139  {
140  for (int i = 0; i < bem_->instructionFormatCount(); i++) {
142  std::map<std::string, int> ops = fTemp.operations();
143  for (const auto& op : ops) {
144  std::string name = op.first;
145  int encoding = op.second;
146  BitVector bits = BitVector();
147  if (fTemp.name() == "riscv_r_type") {
148  bits.pushBack(encoding, 17);
149  std::string encBits = bits.toString();
151  const std::string tceOpName = operationNameTable.at(name);
152  rOperations_.insert({tceOpName, encBits});
153  } else {
154  rOperations_.insert({name, encBits});
155  }
156  } else if (fTemp.name() == "riscv_i_type") {
157  std::string encBits;
158  // Shift operations use imm bits for opcode
159  if (name == "srai" || name == "slli" || name == "srli") {
160  bits.pushBack(encoding, 17);
161  encBits = bits.toString();
162  } else {
163  bits.pushBack(encoding, 10);
164  encBits = bits.toString();
165  }
167  const std::string tceOpName = operationNameTable.at(name);
168  iOperations_.insert({tceOpName, encBits});
169  } else {
170  iOperations_.insert({name, encBits});
171  }
172  } else if (fTemp.name() == "riscv_s_type") {
173  bits.pushBack(encoding, 10);
174  std::string encBits = bits.toString();
176  const std::string tceOpName = operationNameTable.at(name);
177  sOperations_.insert({tceOpName, encBits});
178  } else {
179  sOperations_.insert({name, encBits});
180  }
181  } else if (fTemp.name() == "riscv_b_type") {
182  bits.pushBack(encoding, 10);
183  std::string encBits = bits.toString();
185  const std::string tceOpName = operationNameTable.at(name);
186  bOperations_.insert(
187  {operationNameTable.at(name), encBits});
188  } else {
189  bOperations_.insert({name, encBits});
190  }
191  } else if (fTemp.name() == "riscv_u_type") {
192  bits.pushBack(encoding, 7);
193  std::string encBits = bits.toString();
195  const std::string tceOpName = operationNameTable.at(name);
196  ujOperations_.insert({tceOpName, encBits});
197  } else {
198  ujOperations_.insert({name, encBits});
199  }
200  } else if (fTemp.name() == "riscv_j_type") {
201  bits.pushBack(encoding, 7);
202  std::string encBits = bits.toString();
204  const std::string tceOpName = operationNameTable.at(name);
205  ujOperations_.insert({tceOpName, encBits});
206  } else {
207  ujOperations_.insert({name, encBits});
208  }
209  }
210  }
211  }
212 }

References bem_, bOperations_, MapTools::containsKey(), BinaryEncoding::instructionFormat(), BinaryEncoding::instructionFormatCount(), iOperations_, InstructionFormat::name(), operationNameTable, InstructionFormat::operations(), BitVector::pushBack(), rOperations_, sOperations_, BitVector::toString(), and ujOperations_.

Referenced by RV32MicroCodeGenerator().

Here is the call graph for this function:

◆ mapFunctionUnit()

FunctionUnit * ProGe::RV32MicroCodeGenerator::mapFunctionUnit ( const std::string &  operation) const
private

◆ operationPorts()

std::set< Port * > ProGe::RV32MicroCodeGenerator::operationPorts ( const std::unordered_map< std::string, BaseFUPort * > &  ports) const
private

Definition at line 603 of file RV32MicroCodeGenerator.cc.

604  {
605  std::set<Port*> retval;
606  for (const auto& op : ports) {
607  retval.insert(static_cast<Port*>(op.second));
608  }
609  return retval;
610 }

Referenced by findConnectedBusses().

◆ setBypassInstructionRegister()

void ProGe::RV32MicroCodeGenerator::setBypassInstructionRegister ( const bool &  value)

Definition at line 1563 of file RV32MicroCodeGenerator.cc.

1563  {
1565 }

References bypassInstructionRegister_.

Referenced by DefaultICDecoderGenerator::generate().

◆ throwInputPortError()

void ProGe::RV32MicroCodeGenerator::throwInputPortError ( const BaseFUPort port,
const std::string &  type 
) const
private

Definition at line 278 of file RV32MicroCodeGenerator.cc.

279  {
280  std::string fuName = port->parentUnit()->name();
281  std::string msg = type + " operand port \'" + port->name() +
282  "\' in FU \'" + fuName + "\' not mapped as input";
283  throw InvalidData(__FILE__, __LINE__, __func__, msg);
284 }

References __func__, TTAMachine::Port::name(), TTAMachine::Component::name(), and TTAMachine::BaseFUPort::parentUnit().

Referenced by addBPorts(), addRPorts(), and addSPorts().

Here is the call graph for this function:

◆ throwOperandCountError()

void ProGe::RV32MicroCodeGenerator::throwOperandCountError ( const std::string &  op,
int  required,
int  found 
) const
private

Definition at line 296 of file RV32MicroCodeGenerator.cc.

297  {
298  std::string msg = "Operation " + op +
299  " has invalid amount of operands. " +
300  std::to_string(required) + " required, " +
301  std::to_string(found) + " found.";
302  throw InvalidData(__FILE__, __LINE__, __func__, msg);
303 }

References __func__.

Referenced by addBPorts(), addIPorts(), addRPorts(), and addSPorts().

◆ throwOperationNotFoundError()

void ProGe::RV32MicroCodeGenerator::throwOperationNotFoundError ( const std::string &  op) const
private

Definition at line 261 of file RV32MicroCodeGenerator.cc.

262  {
263  std::string msg = "Cannot find operation '" + op + "\' in machine.";
264  throw InvalidData(__FILE__, __LINE__, __func__, msg);
265 }

References __func__.

Referenced by mapFunctionUnit(), and validateOperations().

◆ throwOutputPortError()

void ProGe::RV32MicroCodeGenerator::throwOutputPortError ( const BaseFUPort port,
const std::string &  type 
) const
private

Definition at line 287 of file RV32MicroCodeGenerator.cc.

288  {
289  std::string fuName = port->parentUnit()->name();
290  std::string msg = type + " operand port \'" + port->name() +
291  "\' in FU \'" + fuName + "\' not mapped as output";
292  throw InvalidData(__FILE__, __LINE__, __func__, msg);
293 }

References __func__, TTAMachine::Port::name(), TTAMachine::Component::name(), and TTAMachine::BaseFUPort::parentUnit().

Referenced by addIPorts(), addRPorts(), and addUJPorts().

Here is the call graph for this function:

◆ throwTriggeringPortError()

void ProGe::RV32MicroCodeGenerator::throwTriggeringPortError ( const BaseFUPort port,
const std::string &  type 
) const
private

Definition at line 268 of file RV32MicroCodeGenerator.cc.

269  {
270  std::string fuName = port->parentUnit()->name();
271  std::string msg = type + " operand port \'" + port->name() +
272  "\' in FU \'" + fuName +
273  "\' not mapped as triggering port";
274  throw InvalidData(__FILE__, __LINE__, __func__, msg);
275 }

References __func__, TTAMachine::Port::name(), TTAMachine::Component::name(), and TTAMachine::BaseFUPort::parentUnit().

Referenced by addBPorts(), addRPorts(), addSPorts(), and addUJPorts().

Here is the call graph for this function:

◆ validateOperations()

void ProGe::RV32MicroCodeGenerator::validateOperations ( ) const
private

Definition at line 215 of file RV32MicroCodeGenerator.cc.

215  {
216  for (const auto& op : sOperations_) {
217  const std::string opName = op.first;
218  if (!machine_->hasOperation(opName)) {
220  }
221  }
222  for (const auto& op : bOperations_) {
223  const std::string opName = op.first;
224  if (!machine_->hasOperation(opName)) {
226  }
227  }
228  for (const auto& op : ujOperations_) {
229  const std::string opName = op.first;
230  if (op.first != "move") {
231  if (!machine_->hasOperation(opName)) {
233  }
234  }
235  }
236  for (const auto& op : rOperations_) {
237  const std::string opName = op.first;
238  if (!machine_->hasOperation(opName)) {
240  }
241  }
242 }

References bOperations_, TTAMachine::Machine::hasOperation(), machine_, rOperations_, sOperations_, throwOperationNotFoundError(), and ujOperations_.

Here is the call graph for this function:

Member Data Documentation

◆ bem_

const BinaryEncoding* ProGe::RV32MicroCodeGenerator::bem_
private

Definition at line 179 of file RV32MicroCodeGenerator.hh.

Referenced by findBusWidths(), and initializeOperations().

◆ bOperations_

std::map<std::string, std::string> ProGe::RV32MicroCodeGenerator::bOperations_
private

◆ busses_

std::vector<Bus*> ProGe::RV32MicroCodeGenerator::busses_
private

Definition at line 180 of file RV32MicroCodeGenerator.hh.

Referenced by findConnectedBusses(), and RV32MicroCodeGenerator().

◆ bypassInstructionRegister_

bool ProGe::RV32MicroCodeGenerator::bypassInstructionRegister_
private

Definition at line 213 of file RV32MicroCodeGenerator.hh.

Referenced by generateWrapper(), and setBypassInstructionRegister().

◆ eVariant_

bool ProGe::RV32MicroCodeGenerator::eVariant_
private

Definition at line 216 of file RV32MicroCodeGenerator.hh.

Referenced by findRF(), and generateWrapper().

◆ hasForwarding_

bool ProGe::RV32MicroCodeGenerator::hasForwarding_
private

◆ iOperations_

std::map<std::string, std::string> ProGe::RV32MicroCodeGenerator::iOperations_
private

◆ machine_

const Machine* ProGe::RV32MicroCodeGenerator::machine_
private

Definition at line 178 of file RV32MicroCodeGenerator.hh.

Referenced by addIPorts(), findRF(), mapFunctionUnit(), and validateOperations().

◆ NOP_

std::string ProGe::RV32MicroCodeGenerator::NOP_
private

Definition at line 212 of file RV32MicroCodeGenerator.hh.

Referenced by generateMap(), generateNOP(), and generateWrapper().

◆ pig_

ProgramImageGenerator* ProGe::RV32MicroCodeGenerator::pig_
private

◆ rdBus_

Bus* ProGe::RV32MicroCodeGenerator::rdBus_
private

◆ rdBusStart_

int ProGe::RV32MicroCodeGenerator::rdBusStart_
private

Definition at line 191 of file RV32MicroCodeGenerator.hh.

Referenced by findBusWidths(), and generateWrapper().

◆ rdBusWidth_

int ProGe::RV32MicroCodeGenerator::rdBusWidth_
private

Definition at line 186 of file RV32MicroCodeGenerator.hh.

Referenced by findBusWidths(), and generateWrapper().

◆ rdPorts_

std::unordered_map<std::string, BaseFUPort*> ProGe::RV32MicroCodeGenerator::rdPorts_
private

◆ rdRFPort_

RFPort* ProGe::RV32MicroCodeGenerator::rdRFPort_
private

◆ rdRFStart_

int ProGe::RV32MicroCodeGenerator::rdRFStart_
private

Definition at line 197 of file RV32MicroCodeGenerator.hh.

Referenced by findBusWidths(), and generateWrapper().

◆ RF_

RegisterFile* ProGe::RV32MicroCodeGenerator::RF_
private

Definition at line 182 of file RV32MicroCodeGenerator.hh.

Referenced by connectRF(), and findRF().

◆ rOperations_

std::map<std::string, std::string> ProGe::RV32MicroCodeGenerator::rOperations_
private

◆ rs1Bus_

Bus* ProGe::RV32MicroCodeGenerator::rs1Bus_
private

◆ rs1BusStart_

int ProGe::RV32MicroCodeGenerator::rs1BusStart_
private

◆ rs1BusWidth_

int ProGe::RV32MicroCodeGenerator::rs1BusWidth_
private

◆ rs1Ports_

std::unordered_map<std::string, BaseFUPort*> ProGe::RV32MicroCodeGenerator::rs1Ports_
private

◆ rs1RFPort_

RFPort* ProGe::RV32MicroCodeGenerator::rs1RFPort_
private

◆ rs1RFStart_

int ProGe::RV32MicroCodeGenerator::rs1RFStart_
private

Definition at line 195 of file RV32MicroCodeGenerator.hh.

Referenced by findBusWidths(), and generateWrapper().

◆ rs2Bus_

Bus* ProGe::RV32MicroCodeGenerator::rs2Bus_
private

◆ rs2BusStart_

int ProGe::RV32MicroCodeGenerator::rs2BusStart_
private

◆ rs2BusWidth_

int ProGe::RV32MicroCodeGenerator::rs2BusWidth_
private

◆ rs2Ports_

std::unordered_map<std::string, BaseFUPort*> ProGe::RV32MicroCodeGenerator::rs2Ports_
private

◆ rs2RFPort_

RFPort* ProGe::RV32MicroCodeGenerator::rs2RFPort_
private

Definition at line 207 of file RV32MicroCodeGenerator.hh.

Referenced by addRs1ForwardingConditions(), connectRF(), and generateMap().

◆ rs2RFStart_

int ProGe::RV32MicroCodeGenerator::rs2RFStart_
private

Definition at line 196 of file RV32MicroCodeGenerator.hh.

Referenced by findBusWidths(), and generateWrapper().

◆ simmBus_

Bus* ProGe::RV32MicroCodeGenerator::simmBus_
private

◆ simmBusStart_

int ProGe::RV32MicroCodeGenerator::simmBusStart_
private

Definition at line 192 of file RV32MicroCodeGenerator.hh.

Referenced by findBusWidths(), and generateWrapper().

◆ simmBusWidth_

int ProGe::RV32MicroCodeGenerator::simmBusWidth_
private

Definition at line 187 of file RV32MicroCodeGenerator.hh.

Referenced by findBusWidths(), and generateWrapper().

◆ simmPorts_

std::unordered_map<std::string, BaseFUPort*> ProGe::RV32MicroCodeGenerator::simmPorts_
private

◆ simmRFStart_

int ProGe::RV32MicroCodeGenerator::simmRFStart_
private

Definition at line 198 of file RV32MicroCodeGenerator.hh.

Referenced by findBusWidths(), and generateWrapper().

◆ sOperations_

std::map<std::string, std::string> ProGe::RV32MicroCodeGenerator::sOperations_
private

◆ sourceOperationMap_

std::unordered_map<Port*, std::vector<std::string> > ProGe::RV32MicroCodeGenerator::sourceOperationMap_
private

◆ sourcePortID_

std::unordered_map<Port*, int> ProGe::RV32MicroCodeGenerator::sourcePortID_
private

◆ ujOperations_

std::map<std::string, std::string> ProGe::RV32MicroCodeGenerator::ujOperations_
private

◆ variableLengthOpLatency_

bool ProGe::RV32MicroCodeGenerator::variableLengthOpLatency_
private

Definition at line 215 of file RV32MicroCodeGenerator.hh.

Referenced by generateOperationLatencyLogic(), and generateWrapper().


The documentation for this class was generated from the following files:
ProGe::RV32MicroCodeGenerator::initializeOperations
void initializeOperations()
Definition: RV32MicroCodeGenerator.cc:139
BinaryEncoding::instructionFormat
InstructionFormat & instructionFormat(int index) const
Definition: BinaryEncoding.cc:521
TTAMachine::Bus::immediateWidth
int immediateWidth() const
Definition: Bus.cc:160
ProGe::RV32MicroCodeGenerator::simmPorts_
std::unordered_map< std::string, BaseFUPort * > simmPorts_
Definition: RV32MicroCodeGenerator.hh:83
InstructionFormat::name
std::string name() const
Definition: InstructionFormat.cc:115
TTAProgram::Instruction::addMove
void addMove(std::shared_ptr< Move > move)
Definition: Instruction.cc:147
TTAMachine::Port::inputSocket
virtual Socket * inputSocket() const
Definition: Port.cc:261
ProGe::RV32MicroCodeGenerator::generateMap
void generateMap(const std::string &dstDirectory)
Definition: RV32MicroCodeGenerator.cc:1120
MoveSlot::name
std::string name() const
Definition: MoveSlot.cc:136
TTAMachine::Machine::hasOperation
bool hasOperation(const TCEString &opName) const
Definition: Machine.cc:1048
ProgramImageGenerator::loadBEM
void loadBEM(const BinaryEncoding &bem)
Definition: ProgramImageGenerator.cc:162
ProGe::RV32MicroCodeGenerator::throwOutputPortError
void throwOutputPortError(const BaseFUPort *port, const std::string &type) const
Definition: RV32MicroCodeGenerator.cc:287
InstructionField::bitPosition
int bitPosition() const
Definition: InstructionField.cc:132
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
ProGe::RV32MicroCodeGenerator::operationPorts
std::set< Port * > operationPorts(const std::unordered_map< std::string, BaseFUPort * > &ports) const
Definition: RV32MicroCodeGenerator.cc:603
ProGe::RV32MicroCodeGenerator::bem_
const BinaryEncoding * bem_
Definition: RV32MicroCodeGenerator.hh:179
MoveSlot
Definition: MoveSlot.hh:60
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
InstructionFormat::operations
std::map< std::string, int > operations() const
Definition: InstructionFormat.cc:195
TTAMachine::HWOperation
Definition: HWOperation.hh:52
ProGe::RV32MicroCodeGenerator::addSPorts
void addSPorts(const std::string &opName)
Definition: RV32MicroCodeGenerator.cc:415
ProGe::RV32MicroCodeGenerator::rs1Bus_
Bus * rs1Bus_
Definition: RV32MicroCodeGenerator.hh:200
TTAMachine::BaseFUPort::parentUnit
FunctionUnit * parentUnit() const
Definition: BaseFUPort.cc:96
ProGe::RV32MicroCodeGenerator::sourceOperationMap_
std::unordered_map< Port *, std::vector< std::string > > sourceOperationMap_
Definition: RV32MicroCodeGenerator.hh:90
BitVector
Definition: BitVector.hh:44
ProGe::RV32MicroCodeGenerator::findRF
void findRF()
Definition: RV32MicroCodeGenerator.cc:467
ProGe::RV32MicroCodeGenerator::rdBusWidth_
int rdBusWidth_
Definition: RV32MicroCodeGenerator.hh:186
TTAMachine::Bus::width
int width() const
Definition: Bus.cc:149
ProGe::RV32MicroCodeGenerator::constructIInstructions
std::unordered_map< std::string, InstructionBitVector * > constructIInstructions(Port *src1, Port *src2) const
Definition: RV32MicroCodeGenerator.cc:723
TTAProgram::Instruction
Definition: Instruction.hh:57
TTAMachine::Bus
Definition: Bus.hh:53
TTAMachine::BaseFUPort
Definition: BaseFUPort.hh:44
ProGe::RV32MicroCodeGenerator::constructSInstructions
std::unordered_map< std::string, InstructionBitVector * > constructSInstructions(Port *src1, Port *src2) const
Definition: RV32MicroCodeGenerator.cc:786
mExtensionOps
const std::vector< std::string > mExtensionOps
Definition: RISCVFields.hh:56
BitVector::toString
std::string toString() const
Definition: BitVector.cc:130
ProGe::RV32MicroCodeGenerator::rs1RFPort_
RFPort * rs1RFPort_
Definition: RV32MicroCodeGenerator.hh:206
ProGe::RV32MicroCodeGenerator::connectRF
void connectRF()
Definition: RV32MicroCodeGenerator.cc:520
ProGe::RV32MicroCodeGenerator::busses_
std::vector< Bus * > busses_
Definition: RV32MicroCodeGenerator.hh:180
TTAMachine::Machine::Navigator::count
int count() const
TTAMachine::FUPort::isTriggering
virtual bool isTriggering() const
Definition: FUPort.cc:182
ProGe::RV32MicroCodeGenerator::rdRFPort_
RFPort * rdRFPort_
Definition: RV32MicroCodeGenerator.hh:208
ProGe::RV32MicroCodeGenerator::simmBusStart_
int simmBusStart_
Definition: RV32MicroCodeGenerator.hh:192
ProGe::RV32MicroCodeGenerator::ujOperations_
std::map< std::string, std::string > ujOperations_
Definition: RV32MicroCodeGenerator.hh:113
TTAMachine::RFPort
Definition: RFPort.hh:45
ProGe::RV32MicroCodeGenerator::mapFunctionUnit
FunctionUnit * mapFunctionUnit(const std::string &operation) const
Definition: RV32MicroCodeGenerator.cc:245
SimValue
Definition: SimValue.hh:96
ProGe::RV32MicroCodeGenerator::rs2Bus_
Bus * rs2Bus_
Definition: RV32MicroCodeGenerator.hh:201
operationNameTable
const std::map< std::string, std::string > operationNameTable
Definition: RISCVFields.hh:39
BitVector::pushBack
void pushBack(long long unsigned int integer, int size)
Definition: BitVector.cc:94
assert
#define assert(condition)
Definition: Application.hh:86
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
ProgramImageGenerator::loadMachine
void loadMachine(const TTAMachine::Machine &machine)
Definition: ProgramImageGenerator.cc:151
TTAMachine::HWOperation::port
virtual FUPort * port(int operand) const
Definition: HWOperation.cc:320
TTAMachine::FUPort
Definition: FUPort.hh:46
ProGe::RV32MicroCodeGenerator::rdRFStart_
int rdRFStart_
Definition: RV32MicroCodeGenerator.hh:197
ProGe::RV32MicroCodeGenerator::findOperationSources
void findOperationSources()
Definition: RV32MicroCodeGenerator.cc:128
TTAMachine::Machine::controlUnit
virtual ControlUnit * controlUnit() const
Definition: Machine.cc:345
ProGe::RV32MicroCodeGenerator::sourcePortID_
std::unordered_map< Port *, int > sourcePortID_
Definition: RV32MicroCodeGenerator.hh:87
ProGe::RV32MicroCodeGenerator::generateFUTargetProcess
void generateFUTargetProcess(std::ofstream &stream)
Definition: RV32MicroCodeGenerator.cc:957
InvalidData
Definition: Exception.hh:149
ProGe::RV32MicroCodeGenerator::addBPorts
void addBPorts(const std::string &opName)
Definition: RV32MicroCodeGenerator.cc:369
MapTools::keyForValue
static KeyType keyForValue(const MapType &aMap, const ValueType &aValue)
ProGe::RV32MicroCodeGenerator::rs2RFPort_
RFPort * rs2RFPort_
Definition: RV32MicroCodeGenerator.hh:207
ProGe::RV32MicroCodeGenerator::simmBusWidth_
int simmBusWidth_
Definition: RV32MicroCodeGenerator.hh:187
TTAMachine::ControlUnit
Definition: ControlUnit.hh:50
ProGe::RV32MicroCodeGenerator::rs2Ports_
std::unordered_map< std::string, BaseFUPort * > rs2Ports_
Definition: RV32MicroCodeGenerator.hh:81
TTAMachine::Connection::bus
Segment * bus() const
TTAMachine::Port
Definition: Port.hh:54
CodeCompressorPlugin::bemInstructionBits
InstructionBitVector * bemInstructionBits(const TTAProgram::Instruction &)
Definition: CodeCompressorPlugin.cc:454
ProGe::RV32MicroCodeGenerator::hasForwarding_
bool hasForwarding_
Definition: RV32MicroCodeGenerator.hh:214
MoveSlot::hasDestinationField
bool hasDestinationField() const
Definition: MoveSlot.cc:327
ProGe::RV32MicroCodeGenerator::rs1BusStart_
int rs1BusStart_
Definition: RV32MicroCodeGenerator.hh:189
MachineConnectivityCheck::isConnected
static bool isConnected(const TTAMachine::Port &sourcePort, const TTAMachine::Port &destinationPort, const TTAMachine::Guard *guard=NULL)
Definition: MachineConnectivityCheck.cc:128
ProGe::RV32MicroCodeGenerator::constructUJInstructions
std::unordered_map< std::string, InstructionBitVector * > constructUJInstructions() const
Definition: RV32MicroCodeGenerator.cc:876
__func__
#define __func__
Definition: Application.hh:67
TTAMachine::Machine::functionUnitNavigator
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition: Machine.cc:380
ProGe::RV32MicroCodeGenerator::rdBusStart_
int rdBusStart_
Definition: RV32MicroCodeGenerator.hh:191
SlotField::width
virtual int width() const
Definition: SlotField.cc:307
RV32_RTL_GEN_VERBOSE
#define RV32_RTL_GEN_VERBOSE
Definition: RV32MicroCodeGenerator.cc:74
ProGe::RV32MicroCodeGenerator::throwInputPortError
void throwInputPortError(const BaseFUPort *port, const std::string &type) const
Definition: RV32MicroCodeGenerator.cc:278
ProgramImageGenerator
Definition: ProgramImageGenerator.hh:67
ProGe::RV32MicroCodeGenerator::bypassInstructionRegister_
bool bypassInstructionRegister_
Definition: RV32MicroCodeGenerator.hh:213
ProGe::RV32MicroCodeGenerator::rs2BusStart_
int rs2BusStart_
Definition: RV32MicroCodeGenerator.hh:190
ProGe::RV32MicroCodeGenerator::addRs1ForwardingConditions
void addRs1ForwardingConditions(std::map< std::string, std::string > ops, std::unordered_map< std::string, InstructionBitVector * >(ProGe::RV32MicroCodeGenerator::*instructionFunc)(Port *p1, Port *p2) const, std::ofstream &stream) const
Definition: RV32MicroCodeGenerator.cc:1028
ProGe::RV32MicroCodeGenerator::findBusWidths
void findBusWidths()
Definition: RV32MicroCodeGenerator.cc:490
TTAMachine::FunctionUnit::hasOperation
virtual bool hasOperation(const std::string &name) const
Definition: FunctionUnit.cc:330
ProGe::RV32MicroCodeGenerator::throwTriggeringPortError
void throwTriggeringPortError(const BaseFUPort *port, const std::string &type) const
Definition: RV32MicroCodeGenerator.cc:268
MoveSlot::width
virtual int width() const
Definition: MoveSlot.cc:406
ProGe::RV32MicroCodeGenerator::rdBus_
Bus * rdBus_
Definition: RV32MicroCodeGenerator.hh:202
ProGe::RV32MicroCodeGenerator::addIPorts
void addIPorts(const std::string &opName)
Definition: RV32MicroCodeGenerator.cc:340
InstructionFormat
Definition: InstructionFormat.hh:46
TTAMachine::Port::isOutput
virtual bool isOutput() const
Definition: Port.cc:308
ProGe::RV32MicroCodeGenerator::findConnectedBusses
bool findConnectedBusses(Connection &rs1, Connection &rs2, Connection &rd, Connection &simm, const bool &forwarding) const
Definition: RV32MicroCodeGenerator.cc:613
BinaryEncoding::instructionFormatCount
int instructionFormatCount() const
Definition: BinaryEncoding.cc:488
TTAMachine::Unit::portCount
virtual int portCount() const
Definition: Unit.cc:135
ProGe::RV32MicroCodeGenerator::rs1Ports_
std::unordered_map< std::string, BaseFUPort * > rs1Ports_
Definition: RV32MicroCodeGenerator.hh:80
ProGe::RV32MicroCodeGenerator::simmBus_
Bus * simmBus_
Definition: RV32MicroCodeGenerator.hh:203
ProGe::RV32MicroCodeGenerator::generateNOP
void generateNOP()
Definition: RV32MicroCodeGenerator.cc:458
FileSystem::DIRECTORY_SEPARATOR
static const std::string DIRECTORY_SEPARATOR
Definition: FileSystem.hh:189
TTAProgram::TerminalFUPort
Definition: TerminalFUPort.hh:56
TTAMachine::Unit::outputPortCount
virtual int outputPortCount(bool countBidir=false) const
Definition: Unit.cc:145
TTAMachine::HWOperation::operandCount
int operandCount() const
Definition: HWOperation.cc:306
ProGe::RV32MicroCodeGenerator::addUJPorts
void addUJPorts(const std::string &opName)
Definition: RV32MicroCodeGenerator.cc:391
TTAProgram::TerminalImmediate
Definition: TerminalImmediate.hh:44
ProGe::RV32MicroCodeGenerator::rOperations_
std::map< std::string, std::string > rOperations_
Definition: RV32MicroCodeGenerator.hh:109
ProGe::RV32MicroCodeGenerator::rs2BusWidth_
int rs2BusWidth_
Definition: RV32MicroCodeGenerator.hh:185
TTAMachine::BaseRegisterFile::port
virtual RFPort * port(const std::string &name) const
Definition: BaseRegisterFile.cc:129
ProGe::RV32MicroCodeGenerator::generateOperationLatencyLogic
std::string generateOperationLatencyLogic(HDLTemplateInstantiator &instantiator)
Definition: RV32MicroCodeGenerator.cc:1278
TTAMachine::Machine::registerFileNavigator
virtual RegisterFileNavigator registerFileNavigator() const
Definition: Machine.cc:450
ProGe::RV32MicroCodeGenerator::rdPorts_
std::unordered_map< std::string, BaseFUPort * > rdPorts_
Definition: RV32MicroCodeGenerator.hh:82
TTAMachine::Unit::inputPortCount
virtual int inputPortCount(bool countBidir=false) const
Definition: Unit.cc:160
MapTools::containsKey
static bool containsKey(const MapType &aMap, const KeyType &aKey)
TTAMachine::Connection
Definition: Connection.hh:48
ProGe::RV32MicroCodeGenerator::rs2RFStart_
int rs2RFStart_
Definition: RV32MicroCodeGenerator.hh:196
HDLTemplateInstantiator::replacePlaceholder
void replacePlaceholder(const std::string &key, const std::string &replacer, bool append=false)
Definition: HDLTemplateInstantiator.cc:62
ProGe::RV32MicroCodeGenerator::sOperations_
std::map< std::string, std::string > sOperations_
Definition: RV32MicroCodeGenerator.hh:111
ProGe::RV32MicroCodeGenerator::addRs2ForwardingConditions
void addRs2ForwardingConditions(std::map< std::string, std::string > ops, std::unordered_map< std::string, InstructionBitVector * >(ProGe::RV32MicroCodeGenerator::*instructionFunc)(Port *p1, Port *p2) const, std::ofstream &stream) const
Definition: RV32MicroCodeGenerator.cc:1077
ProGe::RV32MicroCodeGenerator::rs1BusWidth_
int rs1BusWidth_
Definition: RV32MicroCodeGenerator.hh:184
MapTools::containsValue
static bool containsValue(const MapType &aMap, const ValueType &aValue)
ProGe::RV32MicroCodeGenerator::RF_
RegisterFile * RF_
Definition: RV32MicroCodeGenerator.hh:182
TTAMachine::Port::name
virtual std::string name() const
Definition: Port.cc:141
VectorTools::containsValue
static bool containsValue(const ContainerType &aVec, const ValueType &aValue)
ProGe::RV32MicroCodeGenerator::addBitsToMap
void addBitsToMap(std::unordered_map< std::string, InstructionBitVector * > instructions, const std::map< std::string, std::string > encodings, std::ofstream &stream) const
Definition: RV32MicroCodeGenerator.cc:940
CodeCompressorPlugin
Definition: CodeCompressorPlugin.hh:84
ProGe::RV32MicroCodeGenerator::NOP_
std::string NOP_
Definition: RV32MicroCodeGenerator.hh:212
TTAMachine::Machine::busNavigator
virtual BusNavigator busNavigator() const
Definition: Machine.cc:356
TTAMachine::Port::outputSocket
virtual Socket * outputSocket() const
Definition: Port.cc:281
ProGe::RV32MicroCodeGenerator::variableLengthOpLatency_
bool variableLengthOpLatency_
Definition: RV32MicroCodeGenerator.hh:215
TTAMachine::Port::isInput
virtual bool isInput() const
Definition: Port.cc:298
ProGe::RV32MicroCodeGenerator::rs1RFStart_
int rs1RFStart_
Definition: RV32MicroCodeGenerator.hh:195
ProGe::RV32MicroCodeGenerator::findOperationPorts
void findOperationPorts()
Definition: RV32MicroCodeGenerator.cc:439
BinaryEncoding::moveSlot
MoveSlot & moveSlot(int index) const
Definition: BinaryEncoding.cc:121
TTAMachine::Machine::Navigator::item
ComponentType * item(int index) const
MoveSlot::destinationField
DestinationField & destinationField() const
Definition: MoveSlot.cc:341
TTAMachine::FunctionUnit::operation
virtual HWOperation * operation(const std::string &name) const
Definition: FunctionUnit.cc:363
TTAMachine::HWOperation::latency
int latency() const
Definition: HWOperation.cc:216
TTAMachine::RegisterFile
Definition: RegisterFile.hh:47
ProGe::RV32MicroCodeGenerator::pig_
ProgramImageGenerator * pig_
Definition: RV32MicroCodeGenerator.hh:210
HDLTemplateInstantiator::instantiateTemplateFile
void instantiateTemplateFile(const std::string &templateFile, const std::string &dstFile)
Definition: HDLTemplateInstantiator.cc:113
BinaryEncoding::moveSlotCount
int moveSlotCount() const
Definition: BinaryEncoding.cc:104
TTAMachine::ControlUnit::returnAddressPort
SpecialRegisterPort * returnAddressPort() const
Definition: ControlUnit.cc:307
TTAMachine::BaseRegisterFile::size
virtual int size() const
ProGe::RV32MicroCodeGenerator::throwOperandCountError
void throwOperandCountError(const std::string &op, int required, int found) const
Definition: RV32MicroCodeGenerator.cc:296
DS
#define DS
Definition: LLVMBackend.cc:124
ProGe::RV32MicroCodeGenerator::machine_
const Machine * machine_
Definition: RV32MicroCodeGenerator.hh:178
ProGe::RV32MicroCodeGenerator::constructRInstructions
std::unordered_map< std::string, InstructionBitVector * > constructRInstructions(Port *src1, Port *src2) const
Definition: RV32MicroCodeGenerator.cc:678
ProGe::RV32MicroCodeGenerator::addRPorts
void addRPorts(const std::string &opName)
Definition: RV32MicroCodeGenerator.cc:306
ProGe::RV32MicroCodeGenerator::throwOperationNotFoundError
void throwOperationNotFoundError(const std::string &op) const
Definition: RV32MicroCodeGenerator.cc:261
TTAMachine::BaseRegisterFile::width
virtual int width() const
ProgramImageGenerator::compressor
CodeCompressorPlugin & compressor()
Definition: ProgramImageGenerator.hh:106
ProGe::RV32MicroCodeGenerator::iOperations_
std::map< std::string, std::string > iOperations_
Definition: RV32MicroCodeGenerator.hh:110
TTAMachine::Machine::Navigator
Definition: Machine.hh:186
ProGe::RV32MicroCodeGenerator::constructBInstructions
std::unordered_map< std::string, InstructionBitVector * > constructBInstructions(Port *src1, Port *src2) const
Definition: RV32MicroCodeGenerator.cc:831
ProGe::RV32MicroCodeGenerator::bOperations_
std::map< std::string, std::string > bOperations_
Definition: RV32MicroCodeGenerator.hh:112
TTAProgram::TerminalRegister
Definition: TerminalRegister.hh:53
Environment::dataDirPath
static std::string dataDirPath(const std::string &prog)
Definition: Environment.cc:176
TTAMachine::RegisterFile::zeroRegister
virtual bool zeroRegister() const
Definition: RegisterFile.cc:629
ProGe::RV32MicroCodeGenerator::eVariant_
bool eVariant_
Definition: RV32MicroCodeGenerator.hh:216
ProGe::RV32MicroCodeGenerator::generateWrapper
void generateWrapper(HDLTemplateInstantiator &instantiator, const std::string &fileDst)
Definition: RV32MicroCodeGenerator.cc:1339
InstructionBitVector
Definition: InstructionBitVector.hh:50
ProGe::RV32MicroCodeGenerator::simmRFStart_
int simmRFStart_
Definition: RV32MicroCodeGenerator.hh:198