OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ProGe::ProGeUI Class Reference

#include <ProGeUI.hh>

Inheritance diagram for ProGe::ProGeUI:
Inheritance graph
Collaboration diagram for ProGe::ProGeUI:
Collaboration graph

Public Member Functions

virtual ~ProGeUI ()
 
 ProGeUI ()
 
void generateProcessor (const ProGeOptions &options, int imemWidthInMAUs, std::ostream &errorStream, std::ostream &warningStream, std::ostream &verboseStream)
 
void generateTestBench (const ProGe::HDL language, const std::string &dstDir, const std::string &progeOutDir)
 
void generateScripts (const ProGe::HDL language, const std::string &dstDir, const std::string &progeOutDir, const std::string &sharedOutDir, const std::string &testBenchDir, const std::string &simulationRuntime)
 
void loadMachine (const TTAMachine::Machine &adf)
 
void loadBinaryEncoding (const BinaryEncoding &bem)
 
void loadMachineImplementation (const IDF::MachineImplementation &idf)
 

Protected Member Functions

void loadMachine (const std::string &adfFile)
 
void loadBinaryEncoding (const std::string &bemFile)
 
void loadMachineImplementation (const std::string &idfFile)
 
void loadProcessorConfiguration (const std::string &configurationFile)
 
void loadICDecoderGeneratorPlugin (const std::string &pluginFile, const std::string &pluginName)
 
void integrateProcessor (std::ostream &warningStream, std::ostream &errorStream, std::string progeOutDir, std::string sharedOutputDir, const std::string &platformIntegrator, const std::string &coreEntityName, const std::string &programName, const std::string &deviceFamily, const std::string &deviceName, MemType imem, MemType dmem, HDL language, int fmax, bool syncReset, bool generateIntegratedTestbench)
 

Protected Attributes

TTAMachine::Machinemachine_
 The loaded machine.
 

Private Member Functions

void checkIfNull (void *nullPointer, const std::string &errorMsg)
 
void readLSUParameters (MemInfo &dmem) const
 
void readImemParameters (MemInfo &imem) const
 
void generateIDF (const ProGeOptions &options, std::ostream &verboseStream)
 

Private Attributes

BinaryEncodingbem_
 The loaded binary encoding map.
 
IDF::MachineImplementationidf_
 The loaded machine implementation.
 
PluginTools pluginTool_
 Tool for loading plugin.
 
ICDecoderGeneratorPluginplugin_
 The loaded IC/decoder generator plugin.
 
std::string pluginFile_
 The plugin file.
 
std::string entityName_
 Name of the toplevel entity.
 
ProcessorGenerator generator_
 

Static Private Attributes

static const std::string DEFAULT_ENTITY_STR = "tta0"
 

Detailed Description

Base class for user intefaces of ProGe.

Definition at line 66 of file ProGeUI.hh.

Constructor & Destructor Documentation

◆ ~ProGeUI()

ProGe::ProGeUI::~ProGeUI ( )
virtual

The destructor.

Definition at line 103 of file ProGeUI.cc.

103 {
104 if (machine_ != NULL) {
105 delete machine_;
106 }
107 if (bem_ != NULL) {
108 delete bem_;
109 }
110 if (idf_ != NULL) {
111 delete idf_;
112 }
113 if (plugin_ != NULL) {
114 delete plugin_;
115 }
116}
TTAMachine::Machine * machine_
The loaded machine.
Definition ProGeUI.hh:107
BinaryEncoding * bem_
The loaded binary encoding map.
Definition ProGeUI.hh:120
IDF::MachineImplementation * idf_
The loaded machine implementation.
Definition ProGeUI.hh:122
ICDecoderGeneratorPlugin * plugin_
The loaded IC/decoder generator plugin.
Definition ProGeUI.hh:126

References bem_, idf_, machine_, and plugin_.

◆ ProGeUI()

ProGe::ProGeUI::ProGeUI ( )

The constructor.

Definition at line 94 of file ProGeUI.cc.

94 :
95 machine_(NULL), bem_(NULL), idf_(NULL), plugin_(NULL), pluginFile_(""),
97}
static const std::string DEFAULT_ENTITY_STR
Definition ProGeUI.hh:134
std::string entityName_
Name of the toplevel entity.
Definition ProGeUI.hh:130
std::string pluginFile_
The plugin file.
Definition ProGeUI.hh:128

Member Function Documentation

◆ checkIfNull()

void ProGe::ProGeUI::checkIfNull ( void *  nullPointer,
const std::string &  errorMsg 
)
private

Checks if given pointer is NULL.

Throws a InvalidData exception if given pointer is NULL and sets given error message as exceptions error message.

Parameters
nullPointerSome pointer.
errorMsgError message for the InvalidData exception.

Definition at line 436 of file ProGeUI.cc.

436 {
437 if (nullPointer == NULL) {
438 throw InvalidData(__FILE__, __LINE__, __func__, errorMsg);
439 }
440}
#define __func__

References __func__.

Referenced by generateProcessor(), generateTestBench(), and loadICDecoderGeneratorPlugin().

◆ generateIDF()

void ProGe::ProGeUI::generateIDF ( const ProGeOptions options,
std::ostream &  verboseStream 
)
private

Checking only operations that ADF has instead of them all

Definition at line 527 of file ProGeUI.cc.

528 {
529 std::ostream nullstream(0);
530 std::ostream& verbose =
531 Application::increasedVerbose() ? verboseStream : nullstream;
532
533 if (!idf_) {
534 verbose << "IDF not set, trying automated generation.\n";
536 }
537
538 std::vector<std::string> handledFUs;
539
540 // Prefill the handledFUs with values from the .idf-file
541 for (auto&& fu : machine_->functionUnitNavigator()) {
542 if (idf_->hasFUImplementation(fu->name()) ||
543 idf_->hasFUGeneration(fu->name())) {
544 handledFUs.emplace_back(fu->name());
545 }
546 }
547
548 std::vector<IDF::FUGenerated::Info> infos =
550 //! Checking only operations that ADF has instead of them all
551 // would be faster.
552 std::vector<IDF::FUGenerated::DAGOperation> dagops =
554
555 auto already_handled = [&](const std::string& name) {
556 return std::find(handledFUs.begin(), handledFUs.end(), name) !=
557 handledFUs.end();
558 };
559
560 auto select_hdb_implementations = [&]() {
561 for (auto&& fu : machine_->functionUnitNavigator()) {
562 if (already_handled(fu->name())) {
563 continue;
564 }
565 verbose << " select implementation for " << fu->name() << "... ";
567 new IUImplementationLocation("", -1, fu->name());
569 options, *fu, *loc, verbose)) {
570 verbose << "OK (selected " << loc->id() << " from "
571 << loc->hdbFile() << ")\n";
573 handledFUs.emplace_back(fu->name());
574 } else {
575 verbose << "FAIL\n";
576 }
577 }
578 };
579
580 auto generate_implementations = [&]() {
581 for (auto&& fu : machine_->functionUnitNavigator()) {
582 if (already_handled(fu->name())) {
583 continue;
584 }
585 verbose << " generate implementation for " << fu->name()
586 << "... ";
587 IDF::FUGenerated fug(fu->name());
589 options, *fu, fug, infos, dagops)) {
590 verbose << "OK\n";
591 idf_->addFuGeneration(fug);
592 handledFUs.emplace_back(fug.name());
593 } else {
594 verbose << "FAIL\n";
595 }
596 }
597 };
598
599 // Create or select FUs.
600 if (options.preferHDLGeneration) {
601 generate_implementations();
602 select_hdb_implementations();
603 } else {
604 select_hdb_implementations();
605 generate_implementations();
606 }
607
608 // IUs.
609 for (auto&& iu : machine_->immediateUnitNavigator()) {
610 if (idf_->hasIUImplementation(iu->name())) {
611 continue;
612 }
613 verbose << " select implementation for " << iu->name() << "... ";
615 new IUImplementationLocation("", -1, iu->name());
616 if (ProGeTools::checkForSelectableIU(options, *iu, *loc, verbose)) {
617 verbose << "OK (selected " << loc->id() << " from "
618 << loc->hdbFile() << ")\n";
620 } else {
621 verbose << "FAIL\n";
622 }
623 }
624
625 // RFs.
626 for (auto&& rf : machine_->registerFileNavigator()) {
627 if (idf_->hasRFImplementation(rf->name())) {
628 continue;
629 }
630 verbose << " select implementation for " << rf->name() << "... ";
632 new RFImplementationLocation("", -1, rf->name());
633 if (ProGeTools::checkForSelectableRF(options, *rf, *loc, verbose)) {
634 verbose << "OK (selected " << loc->id() << " from "
635 << loc->hdbFile() << ")\n";
637 } else {
638 verbose << "FAIL\n";
639 }
640 }
641
642 // IC/Decoder plugin.
644 idf_->setICDecoderPluginName("DefaultICDecoder");
645 idf_->setICDecoderPluginFile("DefaultICDecoderPlugin.so");
646 }
647 // Set parameters based on argList given in command line.
648 // Overrides the matching .idf-file params with the command line params.
649 for (auto&& kvp : options.icdArgList) {
650 idf_->setICDecoderParameter(kvp.first, kvp.second);
651 }
652
653 // If ICDecoder parameters are not given, give some defaults based
654 // on the GCU's latency.
655 if (idf_->icDecoderParameterCount() == 0) {
656 int delaySlots = machine_->controlUnit()->delaySlots();
657 if (delaySlots == 3) {
658 // Happy old slow default machine.
659 } else if (delaySlots == 2) {
660 idf_->setICDecoderParameter("bypassinstructionregister", "yes");
661 } else {
662 throw std::runtime_error(
663 "Cannot decide ICDecoder parameters for " +
664 std::to_string(delaySlots) + "-stage GCU.");
665 }
666 }
667}
static MachInfoCmdLineOptions options
Definition MachInfo.cc:46
static bool increasedVerbose()
void setICDecoderParameter(const std::string &name, const std::string &value)
void setICDecoderPluginFile(const std::string &file)
void addIUImplementation(RFImplementationLocation *implementation)
void addRFImplementation(RFImplementationLocation *implementation)
bool hasIUImplementation(const std::string &unitName) const
bool hasFUGeneration(const std::string &name) const
bool hasRFImplementation(const std::string &unitName) const
void addFUImplementation(FUImplementationLocation *implementation)
void setICDecoderPluginName(const std::string &name)
bool hasFUImplementation(const std::string &unitName) const
void addFuGeneration(const FUGenerated &fug)
virtual ControlUnit * controlUnit() const
Definition Machine.cc:345
UnitImplementationLocation IUImplementationLocation
UnitImplementationLocation RFImplementationLocation
bool checkForSelectableIU(const ProGeOptions &options, TTAMachine::ImmediateUnit &iu, IDF::IUImplementationLocation &loc, std::ostream &verbose)
bool checkForGeneratableFU(const ProGeOptions &options, TTAMachine::FunctionUnit &fu, IDF::FUGenerated &fug, const std::vector< IDF::FUGenerated::Info > &infos, const std::vector< IDF::FUGenerated::DAGOperation > dagops)
Definition ProGeTools.cc:59
bool checkForSelectableFU(const ProGeOptions &options, TTAMachine::FunctionUnit &fu, IDF::FUImplementationLocation &loc, std::ostream &verbose)
bool checkForSelectableRF(const ProGeOptions &options, TTAMachine::RegisterFile &rf, IDF::RFImplementationLocation &loc, std::ostream &verbose)
std::vector< IDF::FUGenerated::Info > createFUGeneratableOperationInfos(const ProGeOptions &options, std::ostream &verbose)
std::vector< IDF::FUGenerated::DAGOperation > generateableDAGOperations(const std::vector< IDF::FUGenerated::Info > infos, std::ostream &verbose)

References IDF::MachineImplementation::addFuGeneration(), IDF::MachineImplementation::addFUImplementation(), IDF::MachineImplementation::addIUImplementation(), IDF::MachineImplementation::addRFImplementation(), ProGeTools::checkForGeneratableFU(), ProGeTools::checkForSelectableFU(), ProGeTools::checkForSelectableIU(), ProGeTools::checkForSelectableRF(), TTAMachine::Machine::controlUnit(), ProGeTools::createFUGeneratableOperationInfos(), TTAMachine::ControlUnit::delaySlots(), TTAMachine::Machine::functionUnitNavigator(), ProGeTools::generateableDAGOperations(), IDF::MachineImplementation::hasFUGeneration(), IDF::MachineImplementation::hasFUImplementation(), IDF::MachineImplementation::hasICDecoderPluginFile(), IDF::MachineImplementation::hasIUImplementation(), IDF::MachineImplementation::hasRFImplementation(), IDF::UnitImplementationLocation::hdbFile(), IDF::MachineImplementation::icDecoderParameterCount(), IDF::UnitImplementationLocation::id(), idf_, TTAMachine::Machine::immediateUnitNavigator(), Application::increasedVerbose(), machine_, IDF::FUGenerated::name(), options, TTAMachine::Machine::registerFileNavigator(), IDF::MachineImplementation::setICDecoderParameter(), IDF::MachineImplementation::setICDecoderPluginFile(), and IDF::MachineImplementation::setICDecoderPluginName().

Referenced by generateProcessor().

Here is the call graph for this function:

◆ generateProcessor()

void ProGe::ProGeUI::generateProcessor ( const ProGeOptions options,
int  imemWidthInMAUs,
std::ostream &  errorStream = std::cerr,
std::ostream &  warningStream = std::cerr,
std::ostream &  verboseStream = std::cerr 
)

Generates the processor with the loaded data.

Parameters
imemWidthInMAUsWidth of the instruction memory in MAUs.
languageThe language to generate.
dstDirectoryThe destination directory.
sharedDstDirectoryThe destination directory for VHDL files.
entityStringThe string that is used as the top level entity name and to differentiate the entity and package names in processor-specific HDL files.
errorStreamStream where error messages are written.
warningStreamStream where warning messages are written.
Exceptions
InvalidDataIf ADF or IDF is not loaded.
IOExceptionIf an IO exception occurs.
DynamicLibraryExceptionIf the default plugin cannot be opened.
InvalidDataIf HDB or IDF is erroneous or if BEM is not compatible with the machine.
IllegalMachineIf the machine is illegal.
OutOfRangeIf the given instruction memory width is not positive.
InstanceNotFoundSomething missing from HDB.
IllegalParametersIC/Decoder plugin parameter not recognized

Definition at line 298 of file ProGeUI.cc.

302 {
303 entityName_ = options.entityName;
304
305 checkIfNull(machine_, "ADF not loaded");
306
307 generateIDF(options, verboseStream);
308
309 if (bem_ == NULL) {
310 BEMGenerator generator(*machine_);
311 bem_ = generator.generate();
312 }
313
314 // validate IDF against machine
315 IDFValidator idfValidator(*idf_, *machine_);
316 if (!idfValidator.validate()) {
317 string errorMsg = idfValidator.errorMessage(0);
318 throw InvalidData(__FILE__, __LINE__, __func__, errorMsg);
319 }
320
321 // validate BEM against machine
322 BEMValidator bemValidator(*bem_, *machine_);
323 if (!bemValidator.validate()) {
324 string errorMsg("");
325 if (bemValidator.errorCount() > 0) {
326 errorMsg = bemValidator.errorMessage(0);
327 }
328 throw InvalidData(__FILE__, __LINE__, __func__, errorMsg);
329 } else if (bemValidator.warningCount() > 0) {
330 for (int i = 0; i < bemValidator.warningCount(); i++) {
331 warningStream << bemValidator.warningMessage(i) << std::endl;
332 }
333 }
334
335 if (plugin_ == NULL) {
338 string errorMsg = "IC/decoder generator plugin not defined";
339 throw InvalidData(__FILE__, __LINE__, __func__, errorMsg);
340 } else {
343
344 // set plugin parameters
345 for (unsigned i = 0; i < idf_->icDecoderParameterCount(); i++) {
349 }
351 }
352 }
353 // remove unconnected sockets (if any) before generation
355 *machine_, warningStream);
356
357 try {
359 options, *machine_, *idf_, *plugin_, imemWidthInMAUs, errorStream,
360 warningStream, verboseStream);
361 } catch (Exception& e) {
362 std::cerr << e.errorMessage() << std::endl;
363 }
364}
std::string errorMessage() const
Definition Exception.cc:123
std::string icDecoderPluginName() const
std::string icDecoderPluginFile() const
std::string icDecoderParameterValue(const std::string &name) const
std::string icDecoderParameterName(unsigned param) const
void setParameter(const std::string &name, const std::string &value)
void generateIDF(const ProGeOptions &options, std::ostream &verboseStream)
Definition ProGeUI.cc:527
ProcessorGenerator generator_
Definition ProGeUI.hh:132
void loadICDecoderGeneratorPlugin(const std::string &pluginFile, const std::string &pluginName)
Definition ProGeUI.cc:239
void checkIfNull(void *nullPointer, const std::string &errorMsg)
Definition ProGeUI.cc:436
static void removeUnconnectedSockets(TTAMachine::Machine &machine, std::ostream &warningStream)
void generateProcessor(const ProGeOptions &options, const TTAMachine::Machine &machine, const IDF::MachineImplementation &implementation, ICDecoderGeneratorPlugin &plugin, int imemWidthInMAUs, std::ostream &errorStream, std::ostream &warningStream, std::ostream &verboseStream)

References __func__, bem_, checkIfNull(), entityName_, BEMValidator::errorCount(), Exception::errorMessage(), BEMValidator::errorMessage(), IDFValidator::errorMessage(), BEMGenerator::generate(), generateIDF(), ProGe::ProcessorGenerator::generateProcessor(), generator_, IDF::MachineImplementation::hasICDecoderPluginFile(), IDF::MachineImplementation::hasICDecoderPluginName(), IDF::MachineImplementation::icDecoderParameterCount(), IDF::MachineImplementation::icDecoderParameterName(), IDF::MachineImplementation::icDecoderParameterValue(), IDF::MachineImplementation::icDecoderPluginFile(), IDF::MachineImplementation::icDecoderPluginName(), idf_, loadICDecoderGeneratorPlugin(), machine_, options, plugin_, ProGe::ICDecoderGeneratorPlugin::readParameters(), ProGe::ProcessorGenerator::removeUnconnectedSockets(), ProGe::ICDecoderGeneratorPlugin::setParameter(), BEMValidator::validate(), IDFValidator::validate(), BEMValidator::warningCount(), and BEMValidator::warningMessage().

Referenced by GenerateProcessor::generateProcessor(), and GenerateProcessorDialog::onOK().

Here is the call graph for this function:

◆ generateScripts()

void ProGe::ProGeUI::generateScripts ( const ProGe::HDL  language,
const std::string &  dstDir,
const std::string &  progeOutDir,
const std::string &  sharedOutDir,
const std::string &  testBenchDir,
const std::string &  simulationRuntime 
)

Generates vhdl compilation and simulation scripts.

Parameters
dstDirDestination directory for the scripts.
progeOutDirProGe output directory.
progeOutDirShared HDL output directory.
testBenchDirDirectory where a test bench is stored.

Definition at line 416 of file ProGeUI.cc.

419 {
421 language, *idf_, dstDir, progeOutDir, sharedOutDir, testBenchDir,
422 entityName_, simulationRuntime);
423 sGen.generateAll();
424}

References entityName_, ProGeScriptGenerator::generateAll(), and idf_.

Referenced by GenerateProcessor::generateProcessor(), and GenerateProcessorDialog::onOK().

Here is the call graph for this function:

◆ generateTestBench()

void ProGe::ProGeUI::generateTestBench ( const ProGe::HDL  language,
const std::string &  dstDir,
const std::string &  progeOutDir 
)

Generates a test bench for simulating.

Parameters
dstDirDestination directory for the test bench.
progeOutDirProGe output directory.
Exceptions
InvalidDataIf Machine or implementation not loaded.

Definition at line 375 of file ProGeUI.cc.

378 {
379
380 checkIfNull(machine_, "ADF not loaded");
381 checkIfNull(idf_, "IDF not loaded");
382
383 if (language == Verilog) {
384 // Note: deprecated legacy test bench. Still used since the new test
385 // bench does not yet support generation for verilog.
387 tbGen.generate(
388 language, *machine_, *idf_, dstDir, progeOutDir, entityName_);
389 } else {
390 // New test bench generation to be replacing the old one. WIP and
391 // first used to generate test benches for TTA processors.
392 try {
393 TestBenchBlock coreTestbench(
396 coreTestbench.write(Path(progeOutDir), language);
397 } catch (Exception& e) {
398 // There is one case the new test bench can not handle: same data
399 // address spaces shared by two LSUs.
401 tbGen.generate(
402 language, *machine_, *idf_, dstDir, progeOutDir, entityName_);
403 }
404 }
405}
void generate(const ProGe::HDL language, const TTAMachine::Machine &mach, const IDF::MachineImplementation &implementation, const std::string &dstDirectory, const std::string &progeOutDir, const std::string &entityStr="tta0")
const ProGeContext & generatorContext() const
const NetlistBlock & processorTopLevel() const
@ Verilog
Verilog.
Definition ProGeTypes.hh:42

References checkIfNull(), entityName_, ProGeTestBenchGenerator::generate(), generator_, ProGe::ProcessorGenerator::generatorContext(), idf_, machine_, ProGe::ProcessorGenerator::processorTopLevel(), ProGe::Verilog, and ProGe::TestBenchBlock::write().

Referenced by GenerateProcessor::generateProcessor(), and GenerateProcessorDialog::onOK().

Here is the call graph for this function:

◆ integrateProcessor()

void ProGe::ProGeUI::integrateProcessor ( std::ostream &  warningStream,
std::ostream &  errorStream,
std::string  progeOutDir,
std::string  sharedOutputDir,
const std::string &  platformIntegrator,
const std::string &  coreEntityName,
const std::string &  programName,
const std::string &  deviceFamily,
const std::string &  deviceName,
MemType  imem,
MemType  dmem,
HDL  language,
int  fmax,
bool  syncReset,
bool  generateIntegratedTestbench 
)
protected

Definition at line 443 of file ProGeUI.cc.

449 {
450 string platformDir = progeOutDir + FileSystem::DIRECTORY_SEPARATOR +
451 "platform";
452
453 MemInfo imemInfo;
454 imemInfo.type = imem;
455 readImemParameters(imemInfo);
456
457 PlatformIntegrator* integrator = NULL;
458 // TODO: append new integrators here
459 if (platformIntegrator == "Stratix2DSP") {
460 integrator = new Stratix2DSPBoardIntegrator(
461 machine_, idf_, language, progeOutDir, coreEntityName,
462 platformDir, programName, fmax, warningStream, errorStream,
463 imemInfo, dmem);
464 } else if (platformIntegrator == "KoskiIntegrator") {
465 integrator = new KoskiIntegrator(
466 machine_, idf_, language, progeOutDir, coreEntityName,
467 platformDir, programName, fmax, warningStream, errorStream,
468 imemInfo, dmem);
469 } else if (platformIntegrator == "AvalonIntegrator") {
470 integrator = new AvalonIntegrator(
471 machine_, idf_, language, progeOutDir, coreEntityName,
472 platformDir, programName, fmax, warningStream, errorStream,
473 imemInfo, dmem);
474 } else if (platformIntegrator == "Stratix3DevKit") {
475 integrator = new Stratix3DevKitIntegrator(
476 machine_, idf_, language, progeOutDir, coreEntityName,
477 platformDir, programName, fmax, warningStream, errorStream,
478 imemInfo, dmem);
479 } else if (platformIntegrator == "AlmaIFIntegrator") {
480 integrator = new AlmaIFIntegrator(
481 machine_, idf_, language, progeOutDir, coreEntityName,
482 platformDir, programName, fmax, warningStream, errorStream,
483 imemInfo, dmem, syncReset, generateIntegratedTestbench);
484 } else {
485 string errorMsg = "Unknown platform integrator: "
486 + platformIntegrator;
487 InvalidData exc(__FILE__, __LINE__, __func__, errorMsg);
488 throw exc;
489 }
490 if (!deviceFamily.empty()) {
491 integrator->setDeviceFamily(deviceFamily);
492 }
493 if (!deviceName.empty()) {
494 integrator->setDeviceName(deviceName);
495 }
496
497 if (FileSystem::absolutePathOf(sharedOutputDir) !=
498 FileSystem::absolutePathOf(progeOutDir)) {
499 integrator->setSharedOutputDir(sharedOutputDir);
500 }
501
502 const NetlistBlock& ttaToplevel = generator_.processorTopLevel();
503
504 try {
505 integrator->integrateProcessor(&ttaToplevel);
506 } catch (Exception& e) {
507 delete integrator;
508 throw e;
509 }
510 delete integrator;
511}
static std::string absolutePathOf(const std::string &pathName)
static const std::string DIRECTORY_SEPARATOR
virtual void integrateProcessor(const ProGe::NetlistBlock *progeBlock)=0
virtual void setDeviceFamily(TCEString devFamily)=0
void setSharedOutputDir(const TCEString &sharedDir)
void setDeviceName(TCEString devName)
void readImemParameters(MemInfo &imem) const
Definition ProGeUI.cc:514
MemType type

References __func__, FileSystem::absolutePathOf(), FileSystem::DIRECTORY_SEPARATOR, generator_, idf_, PlatformIntegrator::integrateProcessor(), machine_, ProGe::ProcessorGenerator::processorTopLevel(), readImemParameters(), PlatformIntegrator::setDeviceFamily(), PlatformIntegrator::setDeviceName(), PlatformIntegrator::setSharedOutputDir(), and MemInfo::type.

Referenced by GenerateProcessor::generateProcessor().

Here is the call graph for this function:

◆ loadBinaryEncoding() [1/2]

void ProGe::ProGeUI::loadBinaryEncoding ( const BinaryEncoding bem)

Definition at line 170 of file ProGeUI.cc.

170 {
171 bem_ = new BinaryEncoding(bem.saveState());
172}
virtual ObjectState * saveState() const

References bem_, and BinaryEncoding::saveState().

Referenced by GenerateProcessor::generateProcessor(), and GenerateProcessorDialog::onOK().

Here is the call graph for this function:

◆ loadBinaryEncoding() [2/2]

void ProGe::ProGeUI::loadBinaryEncoding ( const std::string &  bemFile)
protected

Loads the binary encoding from the given BEM file.

Parameters
bemFileThe BEM file.
Exceptions
SerializerExceptionIf the file cannot be read or is erroneous.
ObjectStateLoadingExceptionIf the object model cannot be constructed.

Definition at line 143 of file ProGeUI.cc.

143 {
144 BEMSerializer serializer;
145 serializer.setSourceFile(bemFile);
146 bem_ = serializer.readBinaryEncoding();
147}
BinaryEncoding * readBinaryEncoding()
void setSourceFile(const std::string &fileName)

References bem_, BEMSerializer::readBinaryEncoding(), and XMLSerializer::setSourceFile().

Here is the call graph for this function:

◆ loadICDecoderGeneratorPlugin()

void ProGe::ProGeUI::loadICDecoderGeneratorPlugin ( const std::string &  pluginFile,
const std::string &  pluginName 
)
protected

Loads the given IC/decoder generator plugin.

Parameters
pluginFileThe file that implements the plugin.
pluginNameName of the plugin.
Exceptions
FileNotFoundIf the module is not found.
DynamicLibraryExceptionIf the module cannot be opened.
InvalidDataIf the machine or BEM is not loaded yet.

Definition at line 239 of file ProGeUI.cc.

240 {
241 pluginFile_ = pluginFile;
242
243 checkIfNull(machine_, "ADF not loaded");
244 if (bem_ == NULL) {
245 string errorMsg = "BEM not loaded";
246 throw InvalidData(__FILE__, __LINE__, __func__, errorMsg);
247 }
248
249 // initialize the plugin tool
250 vector<string> pluginPaths = Environment::icDecoderPluginPaths();
251 for (vector<string>::const_iterator iter = pluginPaths.begin();
252 iter != pluginPaths.end(); iter++) {
253 try {
255 } catch (const FileNotFound&) {
256 }
257 }
258
259 try {
260 pluginTool_.registerModule(pluginFile);
261 } catch (const FileNotFound&) {
262 string errorMsg = "Plugin file '" + pluginFile + "' doesn't exist";
263 throw FileNotFound(__FILE__, __LINE__, __func__, errorMsg);
264 }
265
266 ICDecoderGeneratorPlugin* (*creator)(
269 "create_generator_plugin_" + pluginName, creator, pluginFile);
270 plugin_ = creator(*machine_, *bem_);
271 assert(plugin_ != NULL);
272}
#define assert(condition)
static std::vector< std::string > icDecoderPluginPaths(bool libraryPathsOnly=false)
void importSymbol(const std::string &symbolName, T *&target, const std::string &module)
void addSearchPath(const std::string &searchPath)
void registerModule(const std::string &module)
PluginTools pluginTool_
Tool for loading plugin.
Definition ProGeUI.hh:124

References __func__, PluginTools::addSearchPath(), assert, bem_, checkIfNull(), Environment::icDecoderPluginPaths(), PluginTools::importSymbol(), machine_, plugin_, pluginFile_, pluginTool_, and PluginTools::registerModule().

Referenced by generateProcessor().

Here is the call graph for this function:

◆ loadMachine() [1/2]

void ProGe::ProGeUI::loadMachine ( const std::string &  adfFile)
protected

Loads machine from the given ADF file.

Parameters
adfFileThe ADF file.
Exceptions
SerializerExceptionIf the file cannot be read or is erroneous.
ObjectStateLoadingExceptionIf the machine cannot be constructed.

Definition at line 128 of file ProGeUI.cc.

128 {
129 ADFSerializer serializer;
130 serializer.setSourceFile(adfFile);
131 machine_ = serializer.readMachine();
132}
TTAMachine::Machine * readMachine()

References machine_, ADFSerializer::readMachine(), and XMLSerializer::setSourceFile().

Here is the call graph for this function:

◆ loadMachine() [2/2]

void ProGe::ProGeUI::loadMachine ( const TTAMachine::Machine adf)

Definition at line 165 of file ProGeUI.cc.

165 {
166 machine_ = new TTAMachine::Machine(adf);
167}

References machine_.

Referenced by GenerateProcessor::generateProcessor(), and GenerateProcessorDialog::onOK().

◆ loadMachineImplementation() [1/2]

void ProGe::ProGeUI::loadMachineImplementation ( const IDF::MachineImplementation idf)

Definition at line 175 of file ProGeUI.cc.

175 {
177}
virtual ObjectState * saveState() const

References idf_, and IDF::MachineImplementation::saveState().

Referenced by GenerateProcessor::generateProcessor(), and GenerateProcessorDialog::onOK().

Here is the call graph for this function:

◆ loadMachineImplementation() [2/2]

void ProGe::ProGeUI::loadMachineImplementation ( const std::string &  idfFile)
protected

Loads the machine implementation from the given IDF file.

Parameters
idfFileThe IDF file.
Exceptions
SerializerExceptionIf the file cannot be read or is erroneous.
ObjectStateLoadingExceptionIf the object model cannot be constructed.

Definition at line 158 of file ProGeUI.cc.

158 {
159 IDFSerializer serializer;
160 serializer.setSourceFile(idfFile);
161 idf_ = serializer.readMachineImplementation();
162}
MachineImplementation * readMachineImplementation()

References idf_, IDF::IDFSerializer::readMachineImplementation(), and XMLSerializer::setSourceFile().

Here is the call graph for this function:

◆ loadProcessorConfiguration()

void ProGe::ProGeUI::loadProcessorConfiguration ( const std::string &  configurationFile)
protected

Loads the given processor configuration.

Parameters
configurationFileThe PCF file.
Exceptions
UnreachableStreamIf the PCF file cannot be read.
SerializerExceptionIf some files defined in PCF cannot be read or is erroneous.
ObjectStateLoadingExceptionIf some of the object models cannot be constructed.

Definition at line 190 of file ProGeUI.cc.

190 {
191 std::ifstream fileStream(configurationFile.c_str());
192 if (!fileStream.good()) {
193 string errorMsg = "Unable to read the PCF from '" +
194 configurationFile + "'.";
195 throw UnreachableStream(__FILE__, __LINE__, __func__, errorMsg);
196 }
197
198 ProcessorConfigurationFile pcf(fileStream);
199 pcf.setPCFDirectory(FileSystem::directoryOfPath(configurationFile));
200
201 // load machine
202 try {
203 string adfFile = pcf.architectureName();
204 ADFSerializer serializer;
205 serializer.setSourceFile(adfFile);
206 machine_ = serializer.readMachine();
207 } catch (const KeyNotFound&) {
208 }
209
210 // load BEM
211 try {
212 string bemFile = pcf.encodingMapName();
213 BEMSerializer serializer;
214 serializer.setSourceFile(bemFile);
215 bem_ = serializer.readBinaryEncoding();
216 } catch (const KeyNotFound&) {
217 }
218
219 // load IDF
220 try {
221 string idfFile = pcf.implementationName();
222 IDFSerializer serializer;
223 serializer.setSourceFile(idfFile);
224 idf_ = serializer.readMachineImplementation();
225 } catch (const KeyNotFound&) {
226 }
227}
static std::string directoryOfPath(const std::string fileName)
Definition FileSystem.cc:79

References __func__, ProcessorConfigurationFile::architectureName(), bem_, FileSystem::directoryOfPath(), ProcessorConfigurationFile::encodingMapName(), idf_, ProcessorConfigurationFile::implementationName(), machine_, BEMSerializer::readBinaryEncoding(), ADFSerializer::readMachine(), IDF::IDFSerializer::readMachineImplementation(), ProcessorConfigurationFile::setPCFDirectory(), and XMLSerializer::setSourceFile().

Referenced by GenerateProcessor::generateProcessor().

Here is the call graph for this function:

◆ readImemParameters()

void ProGe::ProGeUI::readImemParameters ( MemInfo imem) const
private

Definition at line 514 of file ProGeUI.cc.

514 {
515 imem.mauWidth = bem_->width();
516 // imem width in MAUs is fixed to 1 in ProGe
517 imem.widthInMaus = 1;
520
521 int lastAddr = machine_->controlUnit()->addressSpace()->end();
522 imem.asAddrw = MathTools::requiredBits(lastAddr);
524}
virtual int width(const TCEString &templateName) const
static int requiredBits(unsigned long int number)
virtual ULongWord end() const
virtual bool isShared() const
virtual int width() const
virtual TCEString name() const
SpecialRegisterPort * returnAddressPort() const
virtual AddressSpace * addressSpace() const
TCEString asName

References TTAMachine::FunctionUnit::addressSpace(), MemInfo::asAddrw, MemInfo::asName, bem_, TTAMachine::Machine::controlUnit(), TTAMachine::AddressSpace::end(), MemInfo::isShared, TTAMachine::AddressSpace::isShared(), machine_, MemInfo::mauWidth, TTAMachine::Component::name(), MemInfo::portAddrw, MathTools::requiredBits(), TTAMachine::ControlUnit::returnAddressPort(), TTAMachine::BaseFUPort::width(), BinaryEncoding::width(), and MemInfo::widthInMaus.

Referenced by integrateProcessor().

Here is the call graph for this function:

◆ readLSUParameters()

void ProGe::ProGeUI::readLSUParameters ( MemInfo dmem) const
private

Member Data Documentation

◆ bem_

BinaryEncoding* ProGe::ProGeUI::bem_
private

◆ DEFAULT_ENTITY_STR

const std::string ProGe::ProGeUI::DEFAULT_ENTITY_STR = "tta0"
staticprivate

Definition at line 134 of file ProGeUI.hh.

◆ entityName_

std::string ProGe::ProGeUI::entityName_
private

Name of the toplevel entity.

Definition at line 130 of file ProGeUI.hh.

Referenced by generateProcessor(), generateScripts(), and generateTestBench().

◆ generator_

ProcessorGenerator ProGe::ProGeUI::generator_
private

Definition at line 132 of file ProGeUI.hh.

Referenced by generateProcessor(), generateTestBench(), and integrateProcessor().

◆ idf_

IDF::MachineImplementation* ProGe::ProGeUI::idf_
private

◆ machine_

TTAMachine::Machine* ProGe::ProGeUI::machine_
protected

◆ plugin_

ICDecoderGeneratorPlugin* ProGe::ProGeUI::plugin_
private

The loaded IC/decoder generator plugin.

Definition at line 126 of file ProGeUI.hh.

Referenced by generateProcessor(), loadICDecoderGeneratorPlugin(), and ~ProGeUI().

◆ pluginFile_

std::string ProGe::ProGeUI::pluginFile_
private

The plugin file.

Definition at line 128 of file ProGeUI.hh.

Referenced by loadICDecoderGeneratorPlugin().

◆ pluginTool_

PluginTools ProGe::ProGeUI::pluginTool_
private

Tool for loading plugin.

Definition at line 124 of file ProGeUI.hh.

Referenced by loadICDecoderGeneratorPlugin().


The documentation for this class was generated from the following files: