OpenASIP  2.0
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)
 

Protected Attributes

TTAMachine::Machinemachine_
 The loaded machine. More...
 

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. More...
 
IDF::MachineImplementationidf_
 The loaded machine implementation. More...
 
PluginTools pluginTool_
 Tool for loading plugin. More...
 
ICDecoderGeneratorPluginplugin_
 The loaded IC/decoder generator plugin. More...
 
std::string pluginFile_
 The plugin file. More...
 
std::string entityName_
 Name of the toplevel entity. More...
 
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 }

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 }

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 }

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.
643  if (!idf_->hasICDecoderPluginFile()) {
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 }

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) {
336  if (!idf_->hasICDecoderPluginFile() ||
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 }

References __func__, bem_, checkIfNull(), entityName_, BEMValidator::errorCount(), IDFValidator::errorMessage(), Exception::errorMessage(), BEMValidator::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(), IDFValidator::validate(), BEMValidator::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 }

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 
)
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);
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 }

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 }

References bem_, and BinaryEncoding::saveState().

Referenced by 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 }

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 {
254  pluginTool_.addSearchPath(*iter);
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 }

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 }

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 GenerateProcessorDialog::onOK().

◆ loadMachineImplementation() [1/2]

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

Definition at line 175 of file ProGeUI.cc.

175  {
177 }

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

Referenced by 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 }

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 }

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().

Here is the call graph for this function:

◆ readImemParameters()

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

◆ 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 141 of file ProGeUI.hh.

◆ entityName_

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

Name of the toplevel entity.

Definition at line 137 of file ProGeUI.hh.

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

◆ generator_

ProcessorGenerator ProGe::ProGeUI::generator_
private

Definition at line 139 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 133 of file ProGeUI.hh.

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

◆ pluginFile_

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

The plugin file.

Definition at line 135 of file ProGeUI.hh.

Referenced by loadICDecoderGeneratorPlugin().

◆ pluginTool_

PluginTools ProGe::ProGeUI::pluginTool_
private

Tool for loading plugin.

Definition at line 131 of file ProGeUI.hh.

Referenced by loadICDecoderGeneratorPlugin().


The documentation for this class was generated from the following files:
IDF::UnitImplementationLocation
Definition: UnitImplementationLocation.hh:48
Path
Definition: FileSystem.hh:197
ProGeTools::createFUGeneratableOperationInfos
std::vector< IDF::FUGenerated::Info > createFUGeneratableOperationInfos(const ProGeOptions &options, std::ostream &verbose)
Definition: ProGeTools.cc:306
IDF::RFImplementationLocation
UnitImplementationLocation RFImplementationLocation
Definition: ComponentImplementationSelector.hh:57
BinaryEncoding
Definition: BinaryEncoding.hh:61
IDF::MachineImplementation::hasRFImplementation
bool hasRFImplementation(const std::string &unitName) const
Definition: MachineImplementation.cc:245
AvalonIntegrator
Definition: AvalonIntegrator.hh:39
IDF::MachineImplementation::hasICDecoderPluginFile
bool hasICDecoderPluginFile() const
Definition: MachineImplementation.cc:168
FileNotFound
Definition: Exception.hh:224
ProGeTestBenchGenerator
Definition: ProGeTestBenchGenerator.hh:54
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
PlatformIntegrator::setSharedOutputDir
void setSharedOutputDir(const TCEString &sharedDir)
Definition: PlatformIntegrator.cc:169
ProGe::Verilog
@ Verilog
Verilog.
Definition: ProGeTypes.hh:42
XMLSerializer::setSourceFile
void setSourceFile(const std::string &fileName)
Definition: XMLSerializer.cc:115
UnreachableStream
Definition: Exception.hh:171
PlatformIntegrator::setDeviceFamily
virtual void setDeviceFamily(TCEString devFamily)=0
PlatformIntegrator::integrateProcessor
virtual void integrateProcessor(const ProGe::NetlistBlock *progeBlock)=0
ProcessorConfigurationFile
Definition: ProcessorConfigurationFile.hh:46
MemInfo
Definition: MemoryGenerator.hh:67
IDF::IDFSerializer::readMachineImplementation
MachineImplementation * readMachineImplementation()
Definition: IDFSerializer.cc:148
ProGe::ProGeUI::entityName_
std::string entityName_
Name of the toplevel entity.
Definition: ProGeUI.hh:137
ProGe::ProcessorGenerator::processorTopLevel
const NetlistBlock & processorTopLevel() const
Definition: ProcessorGenerator.cc:510
ProGe::ProGeUI::generator_
ProcessorGenerator generator_
Definition: ProGeUI.hh:139
KoskiIntegrator
Definition: KoskiIntegrator.hh:40
ProGe::ProGeUI::pluginFile_
std::string pluginFile_
The plugin file.
Definition: ProGeUI.hh:135
Environment::icDecoderPluginPaths
static std::vector< std::string > icDecoderPluginPaths(bool libraryPathsOnly=false)
Definition: Environment.cc:635
Stratix3DevKitIntegrator
Definition: Stratix3DevKitIntegrator.hh:44
TTAMachine::FunctionUnit::addressSpace
virtual AddressSpace * addressSpace() const
Definition: FunctionUnit.cc:580
PlatformIntegrator::setDeviceName
void setDeviceName(TCEString devName)
Definition: PlatformIntegrator.hh:113
BEMSerializer
Definition: BEMSerializer.hh:43
FileSystem::absolutePathOf
static std::string absolutePathOf(const std::string &pathName)
Definition: FileSystem.cc:303
ProGeTools::checkForGeneratableFU
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
IDF::MachineImplementation::hasFUImplementation
bool hasFUImplementation(const std::string &unitName) const
Definition: MachineImplementation.cc:231
ProGeTools::checkForSelectableFU
bool checkForSelectableFU(const ProGeOptions &options, TTAMachine::FunctionUnit &fu, IDF::FUImplementationLocation &loc, std::ostream &verbose)
Definition: ProGeTools.cc:352
IDF::MachineImplementation::hasIUImplementation
bool hasIUImplementation(const std::string &unitName) const
Definition: MachineImplementation.cc:259
BEMGenerator
Definition: BEMGenerator.hh:61
TTAMachine::AddressSpace::isShared
virtual bool isShared() const
Definition: AddressSpace.hh:72
IDF::MachineImplementation::hasFUGeneration
bool hasFUGeneration(const std::string &name) const
Definition: MachineImplementation.cc:1590
assert
#define assert(condition)
Definition: Application.hh:86
IDF::MachineImplementation::icDecoderParameterValue
std::string icDecoderParameterValue(const std::string &name) const
Definition: MachineImplementation.cc:1415
IDF::MachineImplementation::saveState
virtual ObjectState * saveState() const
Definition: MachineImplementation.cc:862
Application::increasedVerbose
static bool increasedVerbose()
Definition: Application.hh:179
IDF::MachineImplementation::icDecoderParameterCount
unsigned icDecoderParameterCount() const
Definition: MachineImplementation.cc:1371
ProGe::ProGeUI::plugin_
ICDecoderGeneratorPlugin * plugin_
The loaded IC/decoder generator plugin.
Definition: ProGeUI.hh:133
ProGeTestBenchGenerator::generate
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")
Definition: ProGeTestBenchGenerator.cc:119
TTAMachine::Machine::controlUnit
virtual ControlUnit * controlUnit() const
Definition: Machine.cc:345
IDF::MachineImplementation::icDecoderParameterName
std::string icDecoderParameterName(unsigned param) const
Definition: MachineImplementation.cc:1382
MemInfo::type
MemType type
Definition: MemoryGenerator.hh:68
BinaryEncoding::saveState
virtual ObjectState * saveState() const
Definition: BinaryEncoding.cc:858
InvalidData
Definition: Exception.hh:149
ProGe::ProGeUI::loadICDecoderGeneratorPlugin
void loadICDecoderGeneratorPlugin(const std::string &pluginFile, const std::string &pluginName)
Definition: ProGeUI.cc:239
PluginTools::importSymbol
void importSymbol(const std::string &symbolName, T *&target, const std::string &module)
IDF::FUGenerated
Definition: FUGenerated.hh:41
TTAMachine::Machine::immediateUnitNavigator
virtual ImmediateUnitNavigator immediateUnitNavigator() const
Definition: Machine.cc:416
MemInfo::asAddrw
int asAddrw
Definition: MemoryGenerator.hh:72
IDF::MachineImplementation::setICDecoderPluginName
void setICDecoderPluginName(const std::string &name)
Definition: MachineImplementation.cc:1462
ProGeScriptGenerator
Definition: ProGeScriptGenerator.hh:52
MemInfo::asName
TCEString asName
Definition: MemoryGenerator.hh:74
ProGeTools::checkForSelectableRF
bool checkForSelectableRF(const ProGeOptions &options, TTAMachine::RegisterFile &rf, IDF::RFImplementationLocation &loc, std::ostream &verbose)
Definition: ProGeTools.cc:422
IDF::MachineImplementation::addFuGeneration
void addFuGeneration(const FUGenerated &fug)
Definition: MachineImplementation.cc:1619
ADFSerializer
Definition: ADFSerializer.hh:49
BinaryEncoding::width
virtual int width(const TCEString &templateName) const
Definition: BinaryEncoding.cc:768
Stratix2DSPBoardIntegrator
Definition: Stratix2DSPBoardIntegrator.hh:52
IDFValidator
Definition: IDFValidator.hh:52
__func__
#define __func__
Definition: Application.hh:67
FileSystem::directoryOfPath
static std::string directoryOfPath(const std::string fileName)
Definition: FileSystem.cc:79
PluginTools::registerModule
void registerModule(const std::string &module)
Definition: PluginTools.cc:138
ProGe::ICDecoderGeneratorPlugin::setParameter
void setParameter(const std::string &name, const std::string &value)
Definition: ICDecoderGeneratorPlugin.cc:140
TTAMachine::Machine::functionUnitNavigator
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition: Machine.cc:380
MathTools::requiredBits
static int requiredBits(unsigned long int number)
ProGeTools::generateableDAGOperations
std::vector< IDF::FUGenerated::DAGOperation > generateableDAGOperations(const std::vector< IDF::FUGenerated::Info > infos, std::ostream &verbose)
Definition: ProGeTools.cc:142
AlmaIFIntegrator
Definition: AlmaIFIntegrator.hh:40
ProGe::ICDecoderGeneratorPlugin::readParameters
virtual void readParameters()=0
IDF::MachineImplementation::addRFImplementation
void addRFImplementation(RFImplementationLocation *implementation)
Definition: MachineImplementation.cc:554
TTAMachine::ControlUnit::delaySlots
int delaySlots() const
ProGe::ProGeUI::DEFAULT_ENTITY_STR
static const std::string DEFAULT_ENTITY_STR
Definition: ProGeUI.hh:141
Exception
Definition: Exception.hh:54
ProGe::ProGeUI::machine_
TTAMachine::Machine * machine_
The loaded machine.
Definition: ProGeUI.hh:114
MemInfo::widthInMaus
int widthInMaus
Definition: MemoryGenerator.hh:70
ProGe::ProGeUI::readImemParameters
void readImemParameters(MemInfo &imem) const
Definition: ProGeUI.cc:514
MemInfo::mauWidth
int mauWidth
Definition: MemoryGenerator.hh:69
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
ProGeTools::checkForSelectableIU
bool checkForSelectableIU(const ProGeOptions &options, TTAMachine::ImmediateUnit &iu, IDF::IUImplementationLocation &loc, std::ostream &verbose)
Definition: ProGeTools.cc:500
FileSystem::DIRECTORY_SEPARATOR
static const std::string DIRECTORY_SEPARATOR
Definition: FileSystem.hh:189
ProGe::ProcessorGenerator::removeUnconnectedSockets
static void removeUnconnectedSockets(TTAMachine::Machine &machine, std::ostream &warningStream)
Definition: ProcessorGenerator.cc:529
options
static MachInfoCmdLineOptions options
Definition: MachInfo.cc:46
MemInfo::isShared
bool isShared
Definition: MemoryGenerator.hh:73
ProGe::ProGeUI::idf_
IDF::MachineImplementation * idf_
The loaded machine implementation.
Definition: ProGeUI.hh:129
IDF::MachineImplementation::setICDecoderParameter
void setICDecoderParameter(const std::string &name, const std::string &value)
Definition: MachineImplementation.cc:1437
TTAMachine::Machine::registerFileNavigator
virtual RegisterFileNavigator registerFileNavigator() const
Definition: Machine.cc:450
IDF::MachineImplementation::icDecoderPluginFile
std::string icDecoderPluginFile() const
Definition: MachineImplementation.cc:153
ProGe::ProcessorGenerator::generatorContext
const ProGeContext & generatorContext() const
Definition: ProcessorGenerator.cc:519
IDF::UnitImplementationLocation::id
virtual int id() const
Definition: UnitImplementationLocation.cc:127
IDF::MachineImplementation::addFUImplementation
void addFUImplementation(FUImplementationLocation *implementation)
Definition: MachineImplementation.cc:533
PluginTools::addSearchPath
void addSearchPath(const std::string &searchPath)
Definition: PluginTools.cc:95
IDF::IUImplementationLocation
UnitImplementationLocation IUImplementationLocation
Definition: ComponentImplementationSelector.hh:58
ProGe::ProGeUI::bem_
BinaryEncoding * bem_
The loaded binary encoding map.
Definition: ProGeUI.hh:127
ADFSerializer::readMachine
TTAMachine::Machine * readMachine()
Definition: ADFSerializer.cc:275
PlatformIntegrator
Definition: PlatformIntegrator.hh:65
KeyNotFound
Definition: Exception.hh:285
IDF::UnitImplementationLocation::hdbFile
virtual std::string hdbFile() const
Definition: UnitImplementationLocation.cc:99
BEMValidator
Definition: BEMValidator.hh:57
IDF::MachineImplementation::hasICDecoderPluginName
bool hasICDecoderPluginName() const
Definition: MachineImplementation.cc:142
ProGe::ProcessorGenerator::generateProcessor
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)
Definition: ProcessorGenerator.cc:130
IDF::MachineImplementation::setICDecoderPluginFile
void setICDecoderPluginFile(const std::string &file)
Definition: MachineImplementation.cc:1474
TTAMachine::ControlUnit::returnAddressPort
SpecialRegisterPort * returnAddressPort() const
Definition: ControlUnit.cc:307
IDF::IDFSerializer
Definition: IDFSerializer.hh:45
MemInfo::portAddrw
int portAddrw
Definition: MemoryGenerator.hh:71
IDF::MachineImplementation::icDecoderPluginName
std::string icDecoderPluginName() const
Definition: MachineImplementation.cc:132
TTAMachine::AddressSpace::end
virtual ULongWord end() const
Definition: AddressSpace.cc:177
ProGe::ProGeUI::pluginTool_
PluginTools pluginTool_
Tool for loading plugin.
Definition: ProGeUI.hh:131
IDF::MachineImplementation
Definition: MachineImplementation.hh:54
IDF::MachineImplementation::addIUImplementation
void addIUImplementation(RFImplementationLocation *implementation)
Definition: MachineImplementation.cc:575
TTAMachine::BaseFUPort::width
virtual int width() const
Definition: BaseFUPort.cc:109
ProGe::ProGeUI::generateIDF
void generateIDF(const ProGeOptions &options, std::ostream &verboseStream)
Definition: ProGeUI.cc:527
TTAMachine::Machine
Definition: Machine.hh:73
ProGe::ProGeUI::checkIfNull
void checkIfNull(void *nullPointer, const std::string &errorMsg)
Definition: ProGeUI.cc:436
BEMSerializer::readBinaryEncoding
BinaryEncoding * readBinaryEncoding()
Definition: BEMSerializer.cc:258