#include <FUGen.hh>
|
typedef std::pair< std::string, std::string > | Replace |
|
|
void | createOutputPipeline () |
|
void | addRegisterIfMissing (std::string name, int width, HDLGenerator::WireType wt=HDLGenerator::WireType::Auto) |
|
std::string | findAbsolutePath (std::string file) |
|
void | createFUHeaderComment () |
|
void | createMandatoryPorts () |
|
void | checkForValidity () |
|
void | createExternalInterfaces (bool genIntegrator) |
|
void | createOperationResources () |
|
void | buildOperations () |
|
void | finalizeHDL () |
|
void | createImplementationFiles () |
|
void | copyImplementation (std::string file, std::string format, bool isSynthesizable) |
|
void | parseOperations () |
|
void | scheduleOperations () |
|
void | createPortPipeline () |
|
void | createShadowRegisters () |
|
OperandConnection | subOpConnection (OperationDAG *dag, OperationDAGEdge *edge, bool isOutput) |
|
int | DAGNodeOperandWidth (OperationDAGNode &node, int id, OperationDAG *dag) |
|
void | readImplementation (std::string filename, std::string opName, std::deque< std::string > &sink) |
|
void | prepareSnippet (std::string name, std::deque< std::string > statements, HDLGenerator::CodeBlock &sink, std::set< std::string > &addedStatements) |
|
std::deque< std::string > | readFile (std::string filename) |
|
std::vector< Replace > | buildReplaces (std::string opName) |
|
std::string | replaceToken (std::string line, Replace replace) |
|
bool | hasToken (std::string line, std::string token) |
|
HDLGenerator::Language | selectedLanguage () |
|
std::string | opcodeSignal (int stage) |
|
std::string | triggerSignal (int stage) |
|
std::string | opcodeConstant (std::string operation) |
|
std::string | operandSignal (std::string operation, int id) |
|
std::string | operandPlaceholder (int id) |
|
std::string | pipelineName (std::string port, int cycle) |
|
std::string | pipelineValid (std::string port, int cycle) |
|
std::string | subOpName (OperationNode *node) |
|
std::string | constantName (ConstantNode *node, OperationDAG *dag) |
|
std::string | constantName (DAGConstant dag) |
|
bool | isLSUDataPort (const std::string &portName) |
|
ProGe::Signal | inferLSUSignal (const std::string &portName) const |
|
|
int | maxLatency_ |
|
int | minLatency_ |
|
const ProGeOptions & | options_ |
|
std::vector< std::string > | globalOptions_ |
|
IDF::FUGenerated & | fug_ |
|
ProGe::NetlistBlock * | core_ |
|
HDLGenerator::Module | fu_ |
|
TTAMachine::FunctionUnit * | adfFU_ |
|
std::vector< std::string > | operations_ |
|
int | opcodeWidth_ |
|
std::string | moduleName_ |
|
ProGe::NetlistBlock * | netlistBlock_ |
|
std::unordered_map< std::string, BaseOperation > | baseOperations_ |
|
std::unordered_map< std::string, OperationSchedule > | scheduledOperations_ |
|
std::unordered_map< std::string, std::vector< Replace > > | replacesPerOp_ |
|
std::unordered_map< std::string, int > | operationCycles_ |
|
std::unordered_map< std::string, int > | implLatency_ |
|
std::unordered_map< std::string, OperationDAG * > | implementapleDAGs_ |
|
std::unordered_map< std::string, int > | subOpCount_ |
|
std::unordered_map< std::string, int > | dagConstantCount_ |
|
std::unordered_map< std::string, int > | resourceCount_ |
|
std::unordered_map< std::string, int > | pipelineLength_ |
|
std::unordered_map< std::string, ProGe::Direction > | portDirection_ |
|
std::unordered_multimap< std::string, OutputConnection > | portInputs_ |
|
std::unordered_map< int, int > | nodeImplementations_ |
|
std::unordered_map< int, DAGConstant > | dagConstants_ |
|
std::vector< std::string > | resourceInputs_ |
|
std::vector< std::string > | resourceOutputs_ |
|
std::unordered_set< std::string > | extIfaces_ |
|
std::set< std::pair< std::string, std::string > > | extOutputs_ |
|
std::unordered_set< std::string > | extInputs_ |
|
std::vector< HDB::Variable > | renamedVariables_ |
|
std::vector< HDB::Variable > | renamedGlobalSignals_ |
|
std::string | triggerPort_ |
|
std::vector< std::string > | registers_ |
|
bool | useGlockRequest_ = false |
|
bool | useGlock_ = false |
|
HDLGenerator::Behaviour | behaviour_ |
|
bool | frontRegistered_ = false |
|
bool | middleRegistered_ = false |
|
bool | backRegistered_ = false |
|
int | addressWidth_ = 0 |
|
bool | isLSU_ = false |
|
Definition at line 58 of file FUGen.hh.
◆ Replace
◆ FUGen() [1/3]
◆ FUGen() [2/3]
FUGen::FUGen |
( |
const FUGen & |
| ) |
|
|
delete |
◆ FUGen() [3/3]
Definition at line 63 of file FUGen.hh.
References TTAMachine::FunctionUnit::addressSpace(), addressWidth_, adfFU_, core_, TTAMachine::FunctionUnit::hasAddressSpace(), ProGe::BaseNetlistBlock::moduleName(), moduleName_, netlistBlock_, MathTools::requiredBits(), StringTools::stringToLower(), ProGe::NetlistBlock::subBlock(), and ProGe::NetlistBlock::subBlockCount().
◆ addRegisterIfMissing()
◆ buildOperations()
void FUGen::buildOperations |
( |
| ) |
|
|
private |
Definition at line 672 of file FUGen.cc.
692 auto spec = pair.second;
699 operationCp.reads(signal);
703 operationCp.reads(signal);
706 std::set<std::string> defaultStatements;
708 auto schedule = pair.second;
709 std::string name = pair.first;
711 for (
int id : schedule.results) {
721 for (
auto&& operand : schedule.operands) {
724 std::string source = operand.signalName;
726 if (operand.portWidth > operand.operandWidth) {
729 Splice(source, operand.operandWidth - 1, 0)));
730 }
else if (operand.portWidth < operand.operandWidth) {
733 Ext(source, operand.operandWidth, operand.portWidth)));
738 if (!operand.isOutput) {
739 operationCp.reads(destination);
745 std::string baseOp = schedule.baseOp;
747 if (!initial.empty()) {
748 prepareSnippet(name, initial, defaultSnippets, defaultStatements);
752 for (
int cycle = 0; cycle <=
maxLatency_; ++cycle) {
754 bool emptySwitch =
true;
758 bool emptyBlock =
true;
761 std::vector<std::string> schedules = schedule.subOperations;
762 schedules.push_back(op);
764 for (std::string subop : schedules) {
766 std::string baseOp = schedule.baseOp;
767 if (schedule.initialCycle == cycle) {
770 std::set<std::string> statements;
776 if (schedule.finalCycle == cycle) {
778 if (!postOp.empty()) {
779 std::set<std::string> statements;
793 opSwitch.addCase(opCase);
800 triggeredSnippets.
append(opIf);
809 triggeredSnippets.
append(opIf);
814 operationCp.reads(
"glock_in");
822 int w = std::stoi(v.width);
823 if (v.type ==
"Logic") {
825 }
else if (v.type ==
"Unsigned") {
838 int w = std::stoi(s.width);
840 operationCp.reads(s.name);
849 operationCp << defaultValues << defaultSnippets << triggeredSnippets;
References HDLGenerator::Switch::addCase(), HDLGenerator::Asynchronous::addVariable(), HDLGenerator::CodeBlock::append(), HDLGenerator::Asynchronous::reads(), and MathTools::requiredBitsSigned().
Referenced by implement().
◆ buildReplaces()
std::vector< FUGen::Replace > FUGen::buildReplaces |
( |
std::string |
opName | ) |
|
|
private |
Definition at line 395 of file FUGen.cc.
397 std::string op = schedule.baseOp;
398 std::vector<FUGen::Replace> replaces;
400 replaces.emplace_back(
"glock",
"glock_in");
401 replaces.emplace_back(
"trigger",
triggerSignal(schedule.initialCycle));
403 for (
auto&& operand : schedule.operands) {
405 replaces.emplace_back(
408 for (
int id : schedule.results) {
409 replaces.emplace_back(
420 if (!schedule.resourceOffsets.count(rName)) {
421 assert(
false &&
"Couldn't find resource offset.");
423 int offset = schedule.resourceOffsets[rName];
425 for (
int i = 0; i < r.count; ++i) {
427 int resID = i + offset + 1;
430 for (
auto&& p : resource.
ports) {
432 std::string replace = pName +
"_" + std::to_string(portID);
434 rName +
"_" + std::to_string(resID) +
"_" + pName;
436 replaces.emplace_back(replace, with);
445 replica = name +
"_" + v.name;
446 replaces.emplace_back(v.name, replica);
448 bool nameFound =
false;
450 if (old_var.name == v.name) {
468 replica = name +
"_" + s.name;
469 replaces.emplace_back(s.name, replica);
472 bool nameFound =
false;
474 if (old_var.name == s.name) {
References assert, FUGen::OperationSchedule::baseOp, FUGen::OperationSchedule::initialCycle, FUGen::OperationSchedule::operands, ipxact::parseComponent(), ipxact::ModuleInfo::ports, FUGen::OperationSchedule::resourceOffsets, FUGen::OperationSchedule::results, StringTools::stringToLower(), and HDB::Variable::width.
◆ checkForValidity()
void FUGen::checkForValidity |
( |
| ) |
|
|
private |
◆ constantName() [1/2]
◆ constantName() [2/2]
◆ copyImplementation()
void FUGen::copyImplementation |
( |
std::string |
file, |
|
|
std::string |
format, |
|
|
bool |
isSynthesizable |
|
) |
| |
|
private |
◆ createExternalInterfaces()
void FUGen::createExternalInterfaces |
( |
bool |
genIntegrator | ) |
|
|
private |
◆ createFUHeaderComment()
void FUGen::createFUHeaderComment |
( |
| ) |
|
|
private |
Creates the header comment for fu.
Definition at line 228 of file FUGen.cc.
234 size_t maxOpNameLen = 0;
237 maxOpNameLen = std::max(maxOpNameLen, hwop->
name().size());
249 std::ostringstream comment;
250 comment << boost::format(
251 " %-" + std::to_string(maxOpNameLen) +
"s : %" +
252 std::to_string(opDigits) +
"s") %
253 op % std::to_string(opcode);
References TTAMachine::HWOperation::name().
Referenced by implement().
◆ createImplementationFiles()
void FUGen::createImplementationFiles |
( |
| ) |
|
|
private |
◆ createMandatoryPorts()
void FUGen::createMandatoryPorts |
( |
| ) |
|
|
private |
◆ createOperationResources()
void FUGen::createOperationResources |
( |
| ) |
|
|
private |
Definition at line 634 of file FUGen.cc.
635 std::map<std::string, int> instantiatedResources;
637 for (
auto&& r : rs.second.resources) {
638 if (!instantiatedResources.count(r.name)) {
639 instantiatedResources[r.name] = 0;
645 for (
int i = instantiatedResources[r.name]; i < rCount; ++i) {
647 Module resource(module, i + 1);
648 resource.set_prefix(rName);
650 for (
auto&& p : module.ports) {
652 rName +
"_" + std::to_string(i + 1) +
"_" + p.name);
659 if (p.direction ==
"in") {
666 instantiatedResources[r.name] = rCount;
References ipxact::parseComponent(), HDLGenerator::Module::set_prefix(), and StringTools::stringToLower().
Referenced by implement().
◆ createOutputPipeline()
void FUGen::createOutputPipeline |
( |
| ) |
|
|
private |
Definition at line 1385 of file FUGen.cc.
1392 int width = port->width();
1397 auto inputs =
portInputs_.equal_range(port->name());
1398 for (
int cycle = length; cycle >= 0; --cycle) {
1399 bool cycleActive =
false;
1401 std::string nextReg =
pipelineName(port->name(), cycle);
1402 std::string prevReg =
pipelineName(port->name(), cycle + 1);
1406 fu_ <<
Wire(nextReg, width, WireType::Vector);
1415 for (
auto it = inputs.first; it != inputs.second; ++it) {
1416 auto connection = it->second;
1417 if (connection.pipelineStage != cycle) {
1432 width, connection.operandWidth);
1436 validOperations.elseIfClause(
1437 triggered,
Assign(nextReg, source));
1439 validOperations.elseIfClause(
1440 active,
Assign(nextReg, source));
1445 If(triggered,
Assign(nextReg, source));
1447 validOperations =
If(active,
Assign(nextReg, source));
1453 bool skip_last_assign =
false;
1455 if (cycle != length) {
1456 std::string prevValid =
1461 validOperations.elseIfClause(
1465 skip_last_assign =
true;
1476 std::string outReg = nextReg +
"_r";
1481 if (!skip_last_assign) {
1483 validOperations.elseClause(finalStep);
1484 lastStage.
append(validOperations);
1486 lastStage.
append(finalStep);
1491 outputPipeline.
append(validOperations);
1495 "data_" + port->name() +
"_out",
References HDLGenerator::CodeBlock::append(), HDLGenerator::If::elseClause(), HDLGenerator::If::elseIfClause(), HDB::OUT, HDLGenerator::Vector, and HDLGenerator::Generatable::width().
Referenced by implement().
◆ createPortPipeline()
void FUGen::createPortPipeline |
( |
| ) |
|
|
private |
◆ createShadowRegisters()
void FUGen::createShadowRegisters |
( |
| ) |
|
|
private |
Definition at line 1243 of file FUGen.cc.
1244 std::vector<std::string> inOperands;
1245 std::unordered_set<std::string> registeredInOperands;
1246 std::unordered_map<std::string, std::string> currentName;
1247 std::unordered_map<std::string, int> portWidth;
1252 portWidth[adfPort->
name()] = adfPort->
width();
1255 currentName[adfPort->
name()] =
"data_" + adfPort->
name() +
"_in";
1261 inOperands.emplace_back(adfPort->
name());
1263 registeredInOperands.emplace(adfPort->
name());
1269 currentName[adfPort->
name()] =
"data_" + adfPort->
name() +
"_out";
1274 for (
auto&& p : inOperands) {
1275 std::string newName =
"data_" + p +
"_gated";
1277 Sext(
"load_" + p +
"_in", portWidth[p], 1);
1279 currentName[p] = newName;
1280 fu_ <<
Wire(newName, portWidth[p]);
1284 for (
auto&& p : inOperands) {
1285 std::string dataPort = currentName[p];
1288 registeredInOperands.find(p) != registeredInOperands.end()) {
1289 std::string loadPort =
"load_" + p +
"_in";
1290 std::string shadowReg =
"shadow_" + p +
"_r";
1292 fu_ <<
Register(shadowReg, portWidth[p], ResetOption::Optional);
1301 auto triggerLoad =
Equals(
1305 triggerLoad && portLoad,
References HDLGenerator::If::elseClause(), ProGeTools::findInOptionList(), TTAMachine::Port::isInput(), TTAMachine::FUPort::isTriggering(), TTAMachine::Port::name(), TTAMachine::FUPort::noRegister(), HDLGenerator::Optional, and TTAMachine::BaseFUPort::width().
Referenced by implement().
◆ DAGNodeOperandWidth()
◆ finalizeHDL()
void FUGen::finalizeHDL |
( |
| ) |
|
|
private |
◆ findAbsolutePath()
std::string FUGen::findAbsolutePath |
( |
std::string |
file | ) |
|
|
private |
◆ hasToken()
bool FUGen::hasToken |
( |
std::string |
line, |
|
|
std::string |
token |
|
) |
| |
|
private |
Definition at line 61 of file FUGen.cc.
62 auto regex = std::regex(
"\\b" + token +
"\\b");
63 return std::regex_search(line, regex);
◆ implement()
Generate all FUGen FUs.
Definition at line 1515 of file FUGen.cc.
1520 for (
auto fug : generatetFUs) {
1526 fug.name(),
options.fuFrontRegistered,
false)) {
1527 fugen.frontRegistered_ =
true;
1529 fug.name(),
options.fuMiddleRegistered,
false)) {
1530 fugen.middleRegistered_ =
true;
1532 fug.name(),
options.fuBackRegistered,
false)) {
1533 fugen.backRegistered_ =
true;
1535 fug.name(),
options.fuFrontRegistered)) {
1536 fugen.frontRegistered_ =
true;
1538 fug.name(),
options.fuMiddleRegistered)) {
1539 fugen.middleRegistered_ =
true;
1541 fugen.backRegistered_ =
true;
1544 fugen.createFUHeaderComment();
1545 fugen.checkForValidity();
1547 fugen.parseOperations();
1548 fugen.scheduleOperations();
1549 fugen.createMandatoryPorts();
1550 fugen.createExternalInterfaces(!
options.integratorName.empty());
1551 fugen.createOperationResources();
1553 fugen.createShadowRegisters();
1554 fugen.createPortPipeline();
1555 fugen.buildOperations();
1556 fugen.createOutputPipeline();
1558 fugen.finalizeHDL();
1559 fugen.createImplementationFiles();
References backRegistered_, buildOperations(), checkForValidity(), createExternalInterfaces(), createFUHeaderComment(), createImplementationFiles(), createMandatoryPorts(), createOperationResources(), createOutputPipeline(), createPortPipeline(), createShadowRegisters(), finalizeHDL(), ProGeTools::findInOptionList(), frontRegistered_, machine, middleRegistered_, options, parseOperations(), and scheduleOperations().
Referenced by ProGe::ProcessorGenerator::generateProcessor().
◆ inferLSUSignal()
ProGe::Signal FUGen::inferLSUSignal |
( |
const std::string & |
portName | ) |
const |
|
private |
(Ugly) heuristics for mapping FUGen generated LSU signal types
- Parameters
-
- Returns
- SignalType
Definition at line 542 of file FUGen.cc.
545 if (((pos = portName.find(
"avalid")) != std::string::npos)) {
547 }
else if (((pos = portName.find(
"aready")) != std::string::npos)) {
549 }
else if (((pos = portName.find(
"aaddr")) != std::string::npos)) {
551 }
else if (((pos = portName.find(
"awren")) != std::string::npos)) {
553 }
else if (((pos = portName.find(
"astrb")) != std::string::npos)) {
555 }
else if (((pos = portName.find(
"rvalid")) != std::string::npos)) {
557 }
else if (((pos = portName.find(
"rready")) != std::string::npos)) {
559 }
else if (((pos = portName.find(
"rdata")) != std::string::npos)) {
561 }
else if (((pos = portName.find(
"adata")) != std::string::npos)) {
564 return SigT::UNDEFINED;
◆ isLSUDataPort()
bool FUGen::isLSUDataPort |
( |
const std::string & |
portName | ) |
|
|
private |
(Ugly) heuristics for identifying an LSU data memory port.
The identification is made by partial match of the port's name.
- Parameters
-
portName | The port name given in HDB. |
- Returns
- True if the port is LSU data memory port.
Definition at line 516 of file FUGen.cc.
521 static const std::set<std::string> magicWords{
522 "avalid",
"aready",
"aaddr",
"awren",
"astrb",
523 "rvalid",
"rready",
"rdata",
"adata"};
525 for (
auto magicWord : magicWords) {
526 if (portName.find(magicWord) != std::string::npos) {
◆ opcodeConstant()
std::string FUGen::opcodeConstant |
( |
std::string |
operation | ) |
|
|
private |
Definition at line 131 of file FUGen.cc.
132 return "op_" + operation +
"_c";
◆ opcodeSignal()
std::string FUGen::opcodeSignal |
( |
int |
stage | ) |
|
|
private |
Definition at line 113 of file FUGen.cc.
115 return "operation_in";
117 return "operation_" + std::to_string(stage) +
"_r";
◆ operandPlaceholder()
std::string FUGen::operandPlaceholder |
( |
int |
id | ) |
|
|
private |
Definition at line 141 of file FUGen.cc.
142 return "op" + std::to_string(
id);
◆ operandSignal()
std::string FUGen::operandSignal |
( |
std::string |
operation, |
|
|
int |
id |
|
) |
| |
|
private |
Definition at line 136 of file FUGen.cc.
137 return operation +
"_op" + std::to_string(
id);
◆ operator=()
◆ parseOperations()
void FUGen::parseOperations |
( |
| ) |
|
|
private |
Definition at line 906 of file FUGen.cc.
908 std::vector<std::string> dagOperations;
911 BaseOperation opInfo;
912 opInfo.name = op.operationName;
913 opInfo.latency = op.latency;
921 std::string implFile;
930 const std::string msg =
931 "Cannot generate operation \"" + opInfo.name +
932 "\" due to missing verilog operation implementation";
933 throw std::runtime_error(msg);
948 if (!ifPath.empty()) {
960 for (
int operand = 0; operand < hwOpOperands; ++operand) {
964 std::string portName = fuPort->
name();
965 int latency = hwOp->
latency(operand + 1);
979 dagOperations.emplace_back(op);
983 for (
auto&& op : dagOperations) {
992 throw std::runtime_error(op +
" has no dags to implement.");
995 bool implementable =
false;
996 for (
int i = 0; i < dagCount; ++i) {
1002 dagPtr = &osalOp->
dag(i);
1009 implementable =
true;
1017 if (!implementable) {
1018 throw std::runtime_error(op +
" has no valid dags to implement.");
References HDB::OperationImplementation::absBusDefFile, ProGeTools::canGenerateFromDAG(), Operation::dag(), Operation::dagCount(), ProGeTools::dagLatency(), OperationIndex::effectiveOperation(), FUGen::BaseOperation::globalsignals, FUGen::BaseOperation::implementation, HDB::OperationImplementation::implFileVerilog, HDB::OperationImplementation::implFileVhdl, OperationPool::index(), FUGen::BaseOperation::initial, HDB::OperationImplementation::initialImplFileVerilog, HDB::OperationImplementation::initialImplFileVhdl, HDB::CachedHDBManager::instance(), TTAMachine::Port::isOutput(), TTAMachine::HWOperation::latency(), FUGen::BaseOperation::latency, TTAMachine::Port::name(), FUGen::BaseOperation::name, TTAMachine::HWOperation::operandCount(), OperationPool::operation(), HDB::HDBManager::OperationImplementationByID(), TTAMachine::HWOperation::port(), FUGen::BaseOperation::postOp, HDB::OperationImplementation::postOpImplFileVerilog, HDB::OperationImplementation::postOpImplFileVhdl, HDB::OperationImplementation::resources, FUGen::BaseOperation::resources, FUGen::BaseOperation::variables, HDB::OperationImplementation::verilogGlobalSignals, HDB::OperationImplementation::verilogVariables, ProGe::VHDL, HDB::OperationImplementation::vhdlGlobalSignals, and HDB::OperationImplementation::vhdlVariables.
Referenced by implement().
◆ pipelineName()
std::string FUGen::pipelineName |
( |
std::string |
port, |
|
|
int |
cycle |
|
) |
| |
|
private |
Definition at line 146 of file FUGen.cc.
148 return "data_" + port;
150 return "data_" + port +
"_" + std::to_string(cycle) +
"_r";
◆ pipelineValid()
std::string FUGen::pipelineValid |
( |
std::string |
port, |
|
|
int |
cycle |
|
) |
| |
|
private |
Definition at line 155 of file FUGen.cc.
156 return "data_" + port +
"_" + std::to_string(cycle) +
"_valid_r";
◆ prepareSnippet()
void FUGen::prepareSnippet |
( |
std::string |
name, |
|
|
std::deque< std::string > |
statements, |
|
|
HDLGenerator::CodeBlock & |
sink, |
|
|
std::set< std::string > & |
addedStatements |
|
) |
| |
|
private |
Definition at line 854 of file FUGen.cc.
857 std::deque<std::string> snippet;
858 std::set<std::string> lines;
859 for (std::string line : statements) {
866 if (addedStatements.count(replaced)) {
869 lines.insert(replaced);
871 snippet.push_back(replaced);
881 for (std::string line : lines) {
882 addedStatements.insert(line);
References HDLGenerator::CodeBlock::append(), and StringTools::stringToLower().
◆ readFile()
std::deque< std::string > FUGen::readFile |
( |
std::string |
filename | ) |
|
|
private |
◆ readImplementation()
void FUGen::readImplementation |
( |
std::string |
filename, |
|
|
std::string |
opName, |
|
|
std::deque< std::string > & |
sink |
|
) |
| |
|
private |
◆ replaceToken()
std::string FUGen::replaceToken |
( |
std::string |
line, |
|
|
Replace |
replace |
|
) |
| |
|
private |
Definition at line 67 of file FUGen.cc.
68 auto regex = std::regex(
"\\b" + replace.first +
"\\b");
69 return std::regex_replace(line, regex, replace.second);
◆ scheduleOperations()
void FUGen::scheduleOperations |
( |
| ) |
|
|
private |
Definition at line 1064 of file FUGen.cc.
1065 std::set<std::string> instantiatedWires;
1067 OperationSchedule schedule;
1068 schedule.baseOp = op;
1074 schedule.initialCycle =
1076 schedule.finalCycle = schedule.initialCycle +
implLatency_[op];
1078 schedule.initialCycle = 0;
1082 schedule.initialCycle >= 0 &&
1083 "Failure likely due to mis-selected operation implementation");
1091 std::string port = fuPort->
name();
1092 int width = osalOperand.
width();
1096 OperandConnection oper = {
1097 i, fuPort->
width(), width,
1100 accessCycle = schedule.initialCycle;
1101 schedule.operands.push_back(oper);
1105 schedule.results.insert(i);
1107 OutputConnection out = {
1108 width, i, schedule.finalCycle, accessCycle, op};
1114 "Failure likely due to mis-selected operation "
1118 if (!instantiatedWires.count(newWire)) {
1120 instantiatedWires.insert(newWire);
1134 throw std::runtime_error(
1135 "Unsupported bidirectional port " + port +
1146 schedule.resourceOffsets[resName] = 0;
1153 std::unordered_map<std::string, int> dagResourceCount;
1155 for (
int n = 0; n < dag->nodeCount(); ++n) {
1156 OperationSchedule subopSchedule;
1162 if (!operationNode) {
1170 std::string name =
subOpName(operationNode);
1171 schedule.subOperations.push_back(name);
1172 subopSchedule.baseOp = subOp;
1174 subopSchedule.initialCycle =
1175 schedule.initialCycle +
1178 subopSchedule.finalCycle =
1181 for (
auto&& input : dag->inEdges(node)) {
1182 int dstID = input->dstOperand();
1184 dag->headNode(*input), dstID, dag);
1187 if (!instantiatedWires.count(newWire)) {
1189 instantiatedWires.insert(newWire);
1192 subopSchedule.operands.push_back(
1196 for (
auto&& output : dag->outEdges(node)) {
1197 int srcID = output->srcOperand();
1199 dag->tailNode(*output), srcID, dag);
1202 if (!instantiatedWires.count(newWire)) {
1204 instantiatedWires.insert(newWire);
1207 subopSchedule.results.insert(srcID);
1213 schedule.operands.push_back(
1222 if (!dagResourceCount.count(resName)) {
1223 dagResourceCount[resName] = 0;
1225 subopSchedule.resourceOffsets[resName] =
1226 dagResourceCount[resName];
1227 dagResourceCount[resName] += r.count;
1233 for (
auto&& d : dagResourceCount) {
References assert, FUGen::OperationSchedule::baseOp, FUGen::OperationSchedule::finalCycle, HDB::IN, FUGen::OperationSchedule::initialCycle, Operand::isInput(), ProGeTools::maxLatencyToNode(), TTAMachine::Port::name(), Operation::name(), Operation::operand(), TTAMachine::HWOperation::operandCount(), FUGen::OperationSchedule::operands, OperationPool::operation(), HDB::OUT, TTAMachine::HWOperation::port(), OperationNode::referencedOperation(), FUGen::OperationSchedule::resourceOffsets, FUGen::OperationSchedule::results, StringTools::stringToLower(), FUGen::OperationSchedule::subOperations, TTAMachine::BaseFUPort::width(), and Operand::width().
Referenced by implement().
◆ selectedLanguage()
◆ subOpConnection()
Definition at line 1024 of file FUGen.cc.
1033 auto dstTerminal =
dynamic_cast<TerminalNode*
>(&dstNode);
1042 std::string signalName;
1044 std::string srcOp =
subOpName(operation);
1047 }
else if (terminal) {
1050 srcID = terminal->operandIndex();
1052 }
else if (constant) {
1055 assert(
false &&
"It shouldn't be possible to get here.");
1059 dstID, srcWidth, dstWidth, signalName, isOutput};
References assert, OperationDAGEdge::dstOperand(), BoostGraph< GraphNode, GraphEdge >::headNode(), OperationPimpl::name(), TerminalNode::operandIndex(), OperationDAG::operation(), OperationDAGEdge::srcOperand(), StringTools::stringToLower(), and BoostGraph< GraphNode, GraphEdge >::tailNode().
◆ subOpName()
◆ triggerSignal()
std::string FUGen::triggerSignal |
( |
int |
stage | ) |
|
|
private |
Definition at line 122 of file FUGen.cc.
126 return "optrig_" + std::to_string(stage) +
"_r";
◆ addressWidth_
int FUGen::addressWidth_ = 0 |
|
private |
◆ adfFU_
◆ backRegistered_
bool FUGen::backRegistered_ = false |
|
private |
◆ baseOperations_
std::unordered_map<std::string, BaseOperation> FUGen::baseOperations_ |
|
private |
◆ behaviour_
◆ core_
◆ dagConstantCount_
std::unordered_map<std::string, int> FUGen::dagConstantCount_ |
|
private |
◆ dagConstants_
std::unordered_map<int, DAGConstant> FUGen::dagConstants_ |
|
private |
◆ extIfaces_
std::unordered_set<std::string> FUGen::extIfaces_ |
|
private |
◆ extInputs_
std::unordered_set<std::string> FUGen::extInputs_ |
|
private |
◆ extOutputs_
std::set<std::pair<std::string, std::string> > FUGen::extOutputs_ |
|
private |
◆ frontRegistered_
bool FUGen::frontRegistered_ = false |
|
private |
◆ fu_
◆ fug_
◆ globalOptions_
std::vector<std::string> FUGen::globalOptions_ |
|
private |
◆ implementapleDAGs_
std::unordered_map<std::string, OperationDAG*> FUGen::implementapleDAGs_ |
|
private |
◆ implLatency_
std::unordered_map<std::string, int> FUGen::implLatency_ |
|
private |
◆ isLSU_
bool FUGen::isLSU_ = false |
|
private |
◆ maxLatency_
◆ middleRegistered_
bool FUGen::middleRegistered_ = false |
|
private |
◆ minLatency_
◆ moduleName_
std::string FUGen::moduleName_ |
|
private |
◆ netlistBlock_
◆ nodeImplementations_
std::unordered_map<int, int> FUGen::nodeImplementations_ |
|
private |
◆ opcodeWidth_
◆ operationCycles_
std::unordered_map<std::string, int> FUGen::operationCycles_ |
|
private |
◆ operations_
std::vector<std::string> FUGen::operations_ |
|
private |
◆ options_
◆ pipelineLength_
std::unordered_map<std::string, int> FUGen::pipelineLength_ |
|
private |
◆ portDirection_
◆ portInputs_
◆ registers_
std::vector<std::string> FUGen::registers_ |
|
private |
◆ renamedGlobalSignals_
◆ renamedVariables_
◆ replacesPerOp_
std::unordered_map<std::string, std::vector<Replace> > FUGen::replacesPerOp_ |
|
private |
◆ resourceCount_
std::unordered_map<std::string, int> FUGen::resourceCount_ |
|
private |
◆ resourceInputs_
std::vector<std::string> FUGen::resourceInputs_ |
|
private |
◆ resourceOutputs_
std::vector<std::string> FUGen::resourceOutputs_ |
|
private |
◆ scheduledOperations_
◆ subOpCount_
std::unordered_map<std::string, int> FUGen::subOpCount_ |
|
private |
◆ triggerPort_
std::string FUGen::triggerPort_ |
|
private |
◆ useGlock_
bool FUGen::useGlock_ = false |
|
private |
◆ useGlockRequest_
bool FUGen::useGlockRequest_ = false |
|
private |
The documentation for this class was generated from the following files:
TTAMachine::FunctionUnit * adfFU_
virtual const Netlist & netlist() const
std::vector< HDB::Variable > renamedGlobalSignals_
std::string initialImplFileVerilog
std::vector< std::string > fuIcGateList
std::string pipelineValid(std::string port, int cycle)
Operation & operation(const char *name)
const ProGeOptions & options_
std::string findAbsolutePath(std::string file)
std::vector< std::string > resourceInputs_
@ BYTEMASKED_SRAM_PORT
Signal group type for one port SRAM having read and write capability and bitmask for writing with sep...
HDLGenerator::Language selectedLanguage()
std::vector< std::string > globalOptions_
virtual Node & tailNode(const Edge &edge) const
std::string triggerSignal(int stage)
static bool createDirectory(const std::string &path)
virtual TCEString name() const
std::string replaceToken(std::string line, Replace replace)
std::unordered_set< std::string > extInputs_
virtual bool hasAddressSpace() const
TTAMachine::Machine * machine
the architecture definition of the estimated processor
virtual Node & headNode(const Edge &edge) const
@ BIT_VECTOR
Several bits.
bool hasToken(std::string line, std::string token)
std::string subOpName(OperationNode *node)
std::unordered_map< std::string, std::vector< Replace > > replacesPerOp_
std::unordered_map< std::string, int > subOpCount_
std::string initialImplFileVhdl
std::set< std::pair< std::string, std::string > > extOutputs_
void appendToHeader(const std::string &line)
std::unordered_map< std::string, ProGe::Direction > portDirection_
std::vector< std::string > resourceOutputs_
std::unordered_map< std::string, int > dagConstantCount_
virtual int width() const
std::unordered_multimap< std::string, OutputConnection > portInputs_
std::string postOpImplFileVerilog
BusInfo parseBus(std::string file)
std::unordered_map< std::string, BaseOperation > baseOperations_
virtual BaseFUPort * port(const std::string &name) const
Operation & referencedOperation() const
virtual AddressSpace * addressSpace() const
std::string outputDirectory
std::unordered_set< std::string > extIfaces_
virtual bool isTriggering() const
virtual TCEString name() const
std::string postOpImplFileVhdl
std::vector< Port > ports
static std::string fileOfPath(const std::string pathName)
bool connect(const NetlistPort &port1, const NetlistPort &port2, int port1FirstBit, int port2FirstBit, int width=1)
std::vector< Variable > verilogVariables
std::vector< std::string > registers_
std::unordered_map< int, DAGConstant > dagConstants_
std::vector< std::string > operations_
std::vector< HDB::Variable > renamedVariables_
#define assert(condition)
std::deque< std::string > readFile(std::string filename)
virtual FUPort * port(int operand) const
std::vector< Variable > verilogGlobalSignals
std::unordered_map< int, int > nodeImplementations_
const std::string & name() const
static std::vector< std::string > hdbPaths(bool libraryPathsOnly=false)
std::pair< std::string, std::string > Replace
ProGe::NetlistBlock * core_
std::string implFileVerilog
std::vector< Info > & operations()
ProGe::NetlistBlock * netlistBlock_
HDLGenerator::Behaviour behaviour_
static std::string directoryOfPath(const std::string fileName)
virtual FunctionUnitNavigator functionUnitNavigator() const
int DAGNodeOperandWidth(OperationDAGNode &node, int id, OperationDAG *dag)
std::unordered_map< std::string, int > pipelineLength_
static void copy(const std::string &source, const std::string &target)
void addPort(NetlistPort &port)
std::unordered_map< std::string, int > resourceCount_
std::string operandPlaceholder(int id)
virtual int operationCount() const
void addRegisterIfMissing(std::string name, int width, HDLGenerator::WireType wt=HDLGenerator::WireType::Auto)
std::string opcodeConstant(std::string operation)
void implement(std::ostream &stream, Language lang, int level=0)
std::string constantName(ConstantNode *node, OperationDAG *dag)
virtual bool isOutput() const
virtual int portCount() const
std::string opcodeSignal(int stage)
std::vector< OperationImplementationResource > resources
std::unordered_map< std::string, int > operationCycles_
std::vector< Variable > vhdlVariables
static const std::string DIRECTORY_SEPARATOR
static MachInfoCmdLineOptions options
std::string absBusDefFile
std::vector< Port > ports
virtual Operand & operand(int id) const
virtual int dagCount() const
std::string operandSignal(std::string operation, int id)
OperationImplementation OperationImplementationByID(RowID id) const
virtual long value() const
std::vector< Replace > buildReplaces(std::string opName)
static bool fileExists(const std::string fileName)
Operation * effectiveOperation(const TCEString &name)
virtual std::string name() const
bool isLSUDataPort(const std::string &portName)
void addPortGroup(NetlistPortGroup *portGroup)
const std::string & name() const noexcept
virtual bool isInput() const
const std::string & moduleName() const
ComponentType * item(int index) const
std::unordered_map< std::string, OperationSchedule > scheduledOperations_
virtual HWOperation * operation(const std::string &name) const
std::unordered_map< std::string, OperationDAG * > implementapleDAGs_
std::vector< Variable > vhdlGlobalSignals
virtual bool isInput() const
virtual size_t subBlockCount() const
std::unordered_map< std::string, int > implLatency_
NetlistBlock & subBlock(size_t index) override
static std::string findFileInSearchPaths(const std::vector< std::string > &searchPaths, const std::string &file)
Direction
Direction of the port.
void copyImplementation(std::string file, std::string format, bool isSynthesizable)
const class OperationPimpl & operation() const
OperandConnection subOpConnection(OperationDAG *dag, OperationDAGEdge *edge, bool isOutput)
std::string pipelineName(std::string port, int cycle)
ModuleInfo parseComponent(std::string file)
void prepareSnippet(std::string name, std::deque< std::string > statements, HDLGenerator::CodeBlock &sink, std::set< std::string > &addedStatements)
virtual OperationDAG & dag(int index) const
ProGe::Signal inferLSUSignal(const std::string &portName) const
virtual int operandIndex() const
std::vector< std::string > hdbList
virtual int width() const
static CachedHDBManager & instance(const std::string &hdbFile)