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

#include <ProcessorGenerator.hh>

Collaboration diagram for ProGe::ProcessorGenerator:
Collaboration graph

Public Member Functions

 ProcessorGenerator ()
 
virtual ~ProcessorGenerator ()
 
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)
 
const NetlistBlockprocessorTopLevel () const
 
const ProGeContextgeneratorContext () const
 
TCEString entityName () const
 

Static Public Member Functions

static int iMemAddressWidth (const TTAMachine::Machine &mach)
 
static int iMemWidth (const TTAMachine::Machine &mach, int imemWidthInMAUs)
 
static void removeUnconnectedSockets (TTAMachine::Machine &machine, std::ostream &warningStream)
 

Private Member Functions

void validateMachine (const TTAMachine::Machine &machine, std::ostream &errorStream, std::ostream &warningStream)
 
void checkIULatencies (const TTAMachine::Machine &machine, const IDF::MachineImplementation &implementation, const ICDecoderGeneratorPlugin &plugin)
 
void generateGlobalsPackage (HDL language, const TTAMachine::Machine &machine, int imemWidthInMAUs, const std::string &dstDirectory, ICDecoderGeneratorPlugin &plugin)
 
void generateGCUOpcodesPackage (HDL language, const TTAMachine::Machine &machine, const std::string &dstDirectory)
 

Static Private Member Functions

static std::string coreIdString (int i)
 
static const NetlistPortGroupinstructionBus (NetlistBlock &block)
 

Private Attributes

NetlistBlockcoreTopBlock_
 
TCEString entityStr_
 
ProGeContextgeneratorContext_
 

Static Private Attributes

static const TCEString DEFAULT_ENTITY_STR = "tta0"
 

Detailed Description

Controller class of ProGe.

Acts as a middle-man between user interface, netlist generator, IC/decoder plugin and HDL writers.

Definition at line 74 of file ProcessorGenerator.hh.

Constructor & Destructor Documentation

◆ ProcessorGenerator()

ProGe::ProcessorGenerator::ProcessorGenerator ( )

The constructor.

Definition at line 114 of file ProcessorGenerator.cc.

114: coreTopBlock_(NULL) {}

◆ ~ProcessorGenerator()

ProGe::ProcessorGenerator::~ProcessorGenerator ( )
virtual

The destructor.

Definition at line 119 of file ProcessorGenerator.cc.

119 {
120 delete coreTopBlock_;
121 coreTopBlock_ = NULL;
122}

References coreTopBlock_.

Member Function Documentation

◆ checkIULatencies()

void ProGe::ProcessorGenerator::checkIULatencies ( const TTAMachine::Machine machine,
const IDF::MachineImplementation implementation,
const ICDecoderGeneratorPlugin plugin 
)
private

Checks that the latencies of the HW implementations of the immediate units are compatible with the given IC/GCU generator plugin.

Parameters
machineThe machine.
implementationThe machine implementation.
pluginThe plugin.
Exceptions
InvalidDataIf the latencies are incompatible.

Definition at line 390 of file ProcessorGenerator.cc.

393 {
395 for (int i = 0; i < iuNav.count(); i++) {
396 ImmediateUnit* iu = iuNav.item(i);
399
400 RFEntry* entry = NULL;
401 try {
402 HDBManager& manager = HDBRegistry::instance().hdb(impl.hdbFile());
403 entry = manager.rfByEntryID(impl.id());
404 } catch (const KeyNotFound& e) {
405 throw InvalidData(__FILE__, __LINE__, __func__, e.errorMessage());
406 }
407
408 if (!entry->hasArchitecture()) {
409 delete entry;
410 format text(
411 "RF entry %1% does not have architecture defined in HDB "
412 "%2%.");
413 text % impl.id() % impl.hdbFile();
414 throw InvalidData(__FILE__, __LINE__, __func__, text.str());
415 }
416
417 RFArchitecture& architecture = entry->architecture();
418 int implLatency = architecture.latency();
419 std::set<int> requiredLatencies = plugin.requiredRFLatencies(*iu);
420 delete entry;
421
422 if (requiredLatencies.count(implLatency) == 0) {
423 format errorMsg(
424 "Latency of the implementation of immediate "
425 "unit %1% is %2%,"
426 " acceptable latencies are %3%.");
427 errorMsg % iu->name() % implLatency %
428 TCEString::makeString(requiredLatencies);
429 throw InvalidData(__FILE__, __LINE__, __func__, errorMsg.str());
430 }
431 }
432}
#define __func__
IDF::MachineImplementation * implementation
the implementation definition of the estimated processor
TTAMachine::Machine * machine
the architecture definition of the estimated processor
std::string errorMessage() const
Definition Exception.cc:123
RFEntry * rfByEntryID(RowID id) const
static HDBRegistry & instance()
CachedHDBManager & hdb(const std::string fileName)
RFArchitecture & architecture() const
Definition RFEntry.cc:145
virtual bool hasArchitecture() const
Definition RFEntry.cc:117
RFImplementationLocation & iuImplementation(const std::string &iu) const
static std::string makeString(const IterableContainer &container, const std::string &separator=", ")
virtual TCEString name() const
ComponentType * item(int index) const
virtual ImmediateUnitNavigator immediateUnitNavigator() const
Definition Machine.cc:416

References __func__, HDB::RFEntry::architecture(), TTAMachine::Machine::Navigator< ComponentType >::count(), Exception::errorMessage(), HDB::RFEntry::hasArchitecture(), HDB::HDBRegistry::hdb(), IDF::UnitImplementationLocation::hdbFile(), IDF::UnitImplementationLocation::id(), TTAMachine::Machine::immediateUnitNavigator(), implementation, HDB::HDBRegistry::instance(), TTAMachine::Machine::Navigator< ComponentType >::item(), IDF::MachineImplementation::iuImplementation(), HDB::RFArchitecture::latency(), machine, TCEString::makeString(), TTAMachine::Component::name(), ProGe::ICDecoderGeneratorPlugin::requiredRFLatencies(), and HDB::HDBManager::rfByEntryID().

Referenced by generateProcessor().

Here is the call graph for this function:

◆ coreIdString()

static std::string ProGe::ProcessorGenerator::coreIdString ( int  i)
staticprivate

◆ entityName()

TCEString ProGe::ProcessorGenerator::entityName ( ) const

Definition at line 524 of file ProcessorGenerator.cc.

524 {
525 return entityStr_;
526}

References entityStr_.

Referenced by generateGlobalsPackage().

◆ generateGCUOpcodesPackage()

void ProGe::ProcessorGenerator::generateGCUOpcodesPackage ( HDL  language,
const TTAMachine::Machine machine,
const std::string &  dstDirectory 
)
private

Generates the package that defines opcodes of Global Control Unit.

Parameters
languageThe language of the hardware code, VHDL/Verilog
machineThe machine.
dstDirectoryThe destination directory.

Definition at line 306 of file ProcessorGenerator.cc.

308 {
309 string dstFile = dstDirectory + FileSystem::DIRECTORY_SEPARATOR +
310 "gcu_opcodes_pkg." +
311 ((language == ProGe::VHDL) ? "vhdl" : "vh");
312 std::ofstream stream(dstFile.c_str(), std::ofstream::out);
313 CUOpcodeGenerator gcuOpcodeGen(machine, entityStr_);
314 gcuOpcodeGen.generateOpcodePackage(language, stream);
315 stream.close();
316}
static const std::string DIRECTORY_SEPARATOR
@ VHDL
VHDL.
Definition ProGeTypes.hh:41

References FileSystem::DIRECTORY_SEPARATOR, entityStr_, ProGe::CUOpcodeGenerator::generateOpcodePackage(), machine, and ProGe::VHDL.

Referenced by generateProcessor().

Here is the call graph for this function:

◆ generateGlobalsPackage()

void ProGe::ProcessorGenerator::generateGlobalsPackage ( HDL  language,
const TTAMachine::Machine machine,
int  imemWidthInMAUs,
const std::string &  dstDirectory,
ICDecoderGeneratorPlugin plugin 
)
private

Generates the package that defines global constants used in processor definition files.

Parameters
languageThe language of the hardware code, VHDL/Verilog
machineThe machine.
imemWidthInMAUsWidth of the instruction memory in MAUs.
dstDirectoryThe destination directory.
pluginThe ICDecoderGeneratorPlugin, which gives us bem and bit info
Exceptions
IOExceptionIf an IO error occurs.

Definition at line 230 of file ProcessorGenerator.cc.

232 {
233 string dstFile = dstDirectory + FileSystem::DIRECTORY_SEPARATOR +
234 entityName() + "_globals_pkg." +
235 ((language == ProGe::VHDL) ? "vhdl" : "vh");
236
237 bool created = FileSystem::createFile(dstFile);
238 if (!created) {
239 string errorMsg = "Unable to create file " + dstFile;
240 throw IOException(__FILE__, __LINE__, __func__, errorMsg);
241 }
242 std::ofstream stream(dstFile.c_str(), std::ofstream::out);
243
244 if (language == ProGe::VHDL) {
245 int bustrace_width = 0;
246 for (int i = 0; i < machine.busNavigator().count(); ++i) {
247 int bus_width = machine.busNavigator().item(i)->width();
248 // Busess are padded to a multiple of 32 bits
249 bus_width = (bus_width + 31) / 32 * 32;
250 bustrace_width += bus_width;
251 }
252
253 stream << "library work;" << endl
254 << "use work." << entityStr_ << "_imem_mau.all;" << endl
255 << endl;
256
257 stream << "package " << entityStr_ << "_globals is" << endl
258 << " -- address width of the instruction memory" << endl
259 << " constant IMEMADDRWIDTH : positive := "
260 << iMemAddressWidth(machine) << ";" << endl
261 << " -- width of the instruction memory in MAUs" << endl
262 << " constant IMEMWIDTHINMAUS : positive := "
263 << imemWidthInMAUs << ";" << endl
264 << " -- width of instruction fetch block." << endl
265 << " constant IMEMDATAWIDTH : positive := "
266 << "IMEMWIDTHINMAUS*IMEMMAUWIDTH;" << endl
267 << " -- clock period" << endl
268 << " constant PERIOD : time := 10 ns;" << endl
269 << " -- number of busses." << endl
270 << " constant BUSTRACE_WIDTH : positive := " << bustrace_width
271 << ";" << endl;
272
273 // Insert plugin specific global package constants
274 plugin.writeGlobalDefinitions(ProGe::VHDL, stream);
275
276 stream << "end " << entityStr_ << "_globals;" << endl;
277
278 } else if (language == ProGe::Verilog) {
279 // todo add IMEMDATAWIDTH constant here too.
280
281 stream << "// address width of the instruction memory" << endl
282 << "parameter IMEMADDRWIDTH = " << iMemAddressWidth(machine)
283 << "," << endl
284 << "// width of the instruction memory in MAUs" << endl
285 << "parameter IMEMWIDTHINMAUS = " << imemWidthInMAUs << ","
286 << endl
287 << "// clock period" << endl
288 << "parameter PERIOD = 10," << endl; // 10 will equal 10ns
289
290 plugin.writeGlobalDefinitions(ProGe::Verilog, stream);
291
292 } else {
293 abortWithError("Unsupported HDL.");
294 }
295 stream.close();
296}
#define abortWithError(message)
static bool createFile(const std::string &file)
static int iMemAddressWidth(const TTAMachine::Machine &mach)
virtual BusNavigator busNavigator() const
Definition Machine.cc:356
@ Verilog
Verilog.
Definition ProGeTypes.hh:42

References __func__, abortWithError, TTAMachine::Machine::busNavigator(), FileSystem::createFile(), FileSystem::DIRECTORY_SEPARATOR, entityName(), entityStr_, iMemAddressWidth(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine, ProGe::Verilog, ProGe::VHDL, and ProGe::ICDecoderGeneratorPlugin::writeGlobalDefinitions().

Referenced by generateProcessor().

Here is the call graph for this function:

◆ generateProcessor()

void ProGe::ProcessorGenerator::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 
)

Generates the processor.

See also
ProGeUI::generateProcessor()

Definition at line 130 of file ProcessorGenerator.cc.

135 {
136 entityStr_ = options.entityName;
137 generatorContext_ = new ProGeContext(
138 machine, implementation, options.outputDirectory,
139 options.sharedOutputDirectory, options.entityName, options.language,
140 imemWidthInMAUs);
141
142 // validate the machine
143 validateMachine(machine, errorStream, warningStream);
144 // check the compatibility of the plugin
145 plugin.verifyCompatibility();
146 // check that IU implementation latencies are compatible with the
147 // IC/GCU plugin
149
150 NetlistGenerator netlistGenerator(*generatorContext_, plugin);
151 coreTopBlock_ = netlistGenerator.generate(
152 options, imemWidthInMAUs, options.entityName, warningStream);
153
154 bool created = FileSystem::createDirectory(options.outputDirectory);
155 if (!created) {
156 string errorMsg =
157 "Unable to create directory " + options.outputDirectory;
158 throw IOException(__FILE__, __LINE__, __func__, errorMsg);
159 }
160
161 string pluginDstDir =
162 options.outputDirectory + FileSystem::DIRECTORY_SEPARATOR + "gcu_ic";
163 created = FileSystem::createDirectory(pluginDstDir);
164 if (!created) {
165 string errorMsg = "Unable to create directory " + pluginDstDir;
166 throw IOException(__FILE__, __LINE__, __func__, errorMsg);
167 }
168
169 plugin.generate(
170 options.language, pluginDstDir, netlistGenerator, implementation,
171 options.entityName);
172
173 // Generate generatable FU implementations.
174 std::vector<std::string> globalOptions;
175 globalOptions.emplace_back("active low reset");
176 globalOptions.emplace_back("asynchronous reset");
177 globalOptions.emplace_back("reset everything");
179 options, globalOptions, generatorContext_->idf().FUGenerations(),
181
182 coreTopBlock_->write(Path(options.outputDirectory), options.language);
183
184 string topLevelDir = options.outputDirectory +
186 (options.language == VHDL ? "vhdl" : "verilog");
187
190 *coreTopBlock_, verboseStream);
191
192 if (!FileSystem::fileExists(options.sharedOutputDirectory)) {
193 if (!FileSystem::createDirectory(options.sharedOutputDirectory)) {
194 string errorMsg = "Unable to create directory " +
195 options.sharedOutputDirectory + ".";
196 throw IOException(__FILE__, __LINE__, __func__, errorMsg);
197 }
198 }
199 BlockSourceCopier copier(
200 implementation, options.entityName, options.language);
201
202 if (machine.isRISCVMachine()) {
203 copier.getTemplateInstatiator().replacePlaceholder(
204 "decomp-fetchblock-width", "INSTRUCTIONWIDTH");
205 }
206
207 copier.copyShared(options.sharedOutputDirectory);
208 copier.copyProcessorSpecific(options.outputDirectory);
210 options.language, machine,
211 options.outputDirectory + FileSystem::DIRECTORY_SEPARATOR + "gcu_ic");
212
214 options.language, machine, imemWidthInMAUs, topLevelDir, plugin);
215}
static MachInfoCmdLineOptions options
Definition MachInfo.cc:46
static bool spamVerbose()
static void implement(const ProGeOptions &options, std::vector< std::string > globalOptions, const std::vector< IDF::FUGenerated > &generatetFUs, const TTAMachine::Machine &machine, ProGe::NetlistBlock *core)
Definition FUGen.cc:1515
static bool createDirectory(const std::string &path)
static bool fileExists(const std::string fileName)
const std::vector< FUGenerated > & FUGenerations() const
virtual void write(const Path &targetBaseDir, HDL targetLang=VHDL) const override
static void visualizeBlockTree(const BaseNetlistBlock &root, std::ostream &streamOut)
const IDF::MachineImplementation & idf() const
const TTAMachine::Machine & adf() const
void generateGCUOpcodesPackage(HDL language, const TTAMachine::Machine &machine, const std::string &dstDirectory)
void generateGlobalsPackage(HDL language, const TTAMachine::Machine &machine, int imemWidthInMAUs, const std::string &dstDirectory, ICDecoderGeneratorPlugin &plugin)
void validateMachine(const TTAMachine::Machine &machine, std::ostream &errorStream, std::ostream &warningStream)
void checkIULatencies(const TTAMachine::Machine &machine, const IDF::MachineImplementation &implementation, const ICDecoderGeneratorPlugin &plugin)
bool isRISCVMachine() const
Definition Machine.cc:1057

References __func__, ProGe::ProGeContext::adf(), checkIULatencies(), ProGe::BlockSourceCopier::copyProcessorSpecific(), ProGe::BlockSourceCopier::copyShared(), coreTopBlock_, FileSystem::createDirectory(), FileSystem::DIRECTORY_SEPARATOR, entityStr_, FileSystem::fileExists(), IDF::MachineImplementation::FUGenerations(), ProGe::NetlistGenerator::generate(), ProGe::ICDecoderGeneratorPlugin::generate(), generateGCUOpcodesPackage(), generateGlobalsPackage(), generatorContext_, ProGe::BlockSourceCopier::getTemplateInstatiator(), ProGe::ProGeContext::idf(), FUGen::implement(), implementation, TTAMachine::Machine::isRISCVMachine(), machine, options, HDLTemplateInstantiator::replacePlaceholder(), Application::spamVerbose(), validateMachine(), ProGe::ICDecoderGeneratorPlugin::verifyCompatibility(), ProGe::VHDL, ProGe::NetlistVisualization::visualizeBlockTree(), and ProGe::NetlistBlock::write().

Referenced by ProGe::ProGeUI::generateProcessor().

Here is the call graph for this function:

◆ generatorContext()

const ProGeContext & ProGe::ProcessorGenerator::generatorContext ( ) const

Returns the context (adf, idf, entity name, etc.) that is used in the processor generation.

Definition at line 519 of file ProcessorGenerator.cc.

519 {
520 return *generatorContext_;
521}

References generatorContext_.

Referenced by ProGe::ProGeUI::generateTestBench().

◆ iMemAddressWidth()

int ProGe::ProcessorGenerator::iMemAddressWidth ( const TTAMachine::Machine mach)
static

Returns the width of the memory address of instruction memory of the given machine.

If the memory address width set in machine instruction memory address space differ from gcu port widths, the value set in the address space is used. In this case, GCU port widths are changed accordingly.

Parameters
machThe machine.
Returns
The bit width.
Exceptions
InvalidDataIf the GCU of the machine does not have an address space.

Definition at line 449 of file ProcessorGenerator.cc.

449 {
450 ControlUnit* gcu = mach.controlUnit();
451 // must have been already caught in main method: generateProcessor
452 assert(gcu != NULL);
453
454 AddressSpace* iMem = gcu->addressSpace();
455 // must have been already caught in main method: generateProcessor
456 assert(iMem != NULL);
457
458 int imemASWidth = MathTools::requiredBits(iMem->end());
459 // if gcu port have different width than imemASWidth, change port
460 // widths
461 if (gcu->hasReturnAddressPort()) {
462 int gcuRAPortWidth = gcu->returnAddressPort()->width();
463 if (gcuRAPortWidth != imemASWidth) {
464 gcu->returnAddressPort()->setWidth(imemASWidth);
465 }
466 }
467 if (gcu->hasOperation(CALL)) {
468 FUPort* pcPort = gcu->operation(CALL)->port(1);
469 if (pcPort != NULL) {
470 if (pcPort->width() != imemASWidth) {
471 pcPort->setWidth(imemASWidth);
472 }
473 }
474 } else if (gcu->hasOperation(JUMP)) {
475 FUPort* pcPort = gcu->operation(JUMP)->port(1);
476 if (pcPort != NULL) {
477 if (pcPort->width() != imemASWidth) {
478 pcPort->setWidth(imemASWidth);
479 }
480 }
481 }
482
483 return imemASWidth;
484}
#define assert(condition)
const string JUMP
const string CALL
static int requiredBits(unsigned long int number)
virtual ULongWord end() const
virtual int width() const
void setWidth(int width)
SpecialRegisterPort * returnAddressPort() const
bool hasReturnAddressPort() const
virtual AddressSpace * addressSpace() const
virtual HWOperation * operation(const std::string &name) const
virtual bool hasOperation(const std::string &name) const
virtual FUPort * port(int operand) const
virtual ControlUnit * controlUnit() const
Definition Machine.cc:345

References TTAMachine::FunctionUnit::addressSpace(), assert, CALL, TTAMachine::Machine::controlUnit(), TTAMachine::AddressSpace::end(), TTAMachine::FunctionUnit::hasOperation(), TTAMachine::ControlUnit::hasReturnAddressPort(), JUMP, TTAMachine::FunctionUnit::operation(), TTAMachine::HWOperation::port(), MathTools::requiredBits(), TTAMachine::ControlUnit::returnAddressPort(), TTAMachine::BaseFUPort::setWidth(), and TTAMachine::BaseFUPort::width().

Referenced by generateGlobalsPackage().

Here is the call graph for this function:

◆ iMemWidth()

int ProGe::ProcessorGenerator::iMemWidth ( const TTAMachine::Machine mach,
int  imemWidthInMAUs 
)
static

Returns the width of the instruction memory of the given machine.

Parameters
machThe machine.
Returns
The bit width.

Definition at line 493 of file ProcessorGenerator.cc.

494 {
495 ControlUnit* gcu = mach.controlUnit();
496 // must have been already caught in main method: generateProcessor
497 assert(gcu != NULL);
498
499 AddressSpace* iMem = gcu->addressSpace();
500 // must have been already caught in main method: generateProcessor
501 assert(iMem != NULL);
502
503 return iMem->width() * imemWidthInMAUs;
504}
virtual int width() const

References TTAMachine::FunctionUnit::addressSpace(), assert, TTAMachine::Machine::controlUnit(), and TTAMachine::AddressSpace::width().

Here is the call graph for this function:

◆ instructionBus()

const NetlistPortGroup * ProGe::ProcessorGenerator::instructionBus ( NetlistBlock block)
staticprivate

Definition at line 319 of file ProcessorGenerator.cc.

319 {
320 assert(!block.portGroupsBy(SignalGroupType::INSTRUCTION_LINE).empty());
321 return block.portGroupsBy(SignalGroupType::INSTRUCTION_LINE).at(0);
322}
@ INSTRUCTION_LINE
Signal group type for serial TTA instruction bus.

References assert, ProGe::INSTRUCTION_LINE, and ProGe::BaseNetlistBlock::portGroupsBy().

Here is the call graph for this function:

◆ processorTopLevel()

const NetlistBlock & ProGe::ProcessorGenerator::processorTopLevel ( ) const

Returns Toplevel block of the core.

Definition at line 510 of file ProcessorGenerator.cc.

510 {
511 return *coreTopBlock_;
512}

References coreTopBlock_.

Referenced by ProGe::ProGeUI::generateTestBench(), and ProGe::ProGeUI::integrateProcessor().

◆ removeUnconnectedSockets()

void ProGe::ProcessorGenerator::removeUnconnectedSockets ( TTAMachine::Machine machine,
std::ostream &  warningStream 
)
static

Definition at line 529 of file ProcessorGenerator.cc.

530 {
532 std::list<string> removedSockets;
533 modifier.removeNotConnectedSockets(machine, removedSockets);
534
535 for (std::list<string>::iterator i = removedSockets.begin();
536 i != removedSockets.end(); i++) {
537 warningStream << "Warning: Removed unconnected socket " << *i
538 << std::endl;
539 }
540}
void removeNotConnectedSockets(TTAMachine::Machine &mach, std::list< std::string > &removedSocketNames)

References machine, and MachineResourceModifier::removeNotConnectedSockets().

Referenced by ProGe::ProGeUI::generateProcessor().

Here is the call graph for this function:

◆ validateMachine()

void ProGe::ProcessorGenerator::validateMachine ( const TTAMachine::Machine machine,
std::ostream &  errorStream,
std::ostream &  warningStream 
)
private

Validates the machine for compatibility with the given block implementations.

If the target architecture contains errors (incomplete definition) or if its structure is not compatible with this HDL generator, this method throws IllegalMachine exception. For less serious errors (such as non-critical bit width discrepancies), warning messages are written to the given stream.

Parameters
machineThe machine to validate.
errorStreamOutput stream where errors are printed
warningStreamOutput stream where warnings are printed
Exceptions
IllegalMachineIf there is a fundamental error in the machine.

Definition at line 341 of file ProcessorGenerator.cc.

343 {
344 MachineValidator validator(machine);
345 set<MachineValidator::ErrorCode> errorsToCheck;
346 errorsToCheck.insert(MachineValidator::GCU_MISSING);
347 errorsToCheck.insert(MachineValidator::GCU_AS_MISSING);
348 errorsToCheck.insert(MachineValidator::USED_IO_NOT_BOUND);
350 errorsToCheck.insert(MachineValidator::PC_PORT_MISSING);
351 errorsToCheck.insert(MachineValidator::RA_PORT_MISSING);
352 errorsToCheck.insert(
354 // we should not check for this as the designer is not supposed to
355 // know the width of these ports before the design has been finalized,
356 // thus we generate them automatically in ProGe
357 // errorsToCheck.insert(
358 // MachineValidator::IMEM_ADDR_WIDTH_DIFFERS_FROM_RA_AND_PC);
359
360 MachineValidatorResults* results = validator.validate(errorsToCheck);
361
362 for (int i = 0; i < results->errorCount(); i++) {
363 MachineValidator::ErrorCode code = results->error(i).first;
364 string errorMsg = results->error(i).second;
365 if (code ==
367 warningStream << "Warning: " << errorMsg
368 << " ProGe uses the value set in the address space."
369 << endl;
370 } else {
371 string msg = "Error: " + errorMsg;
372 errorStream << msg << std::endl;
373 delete results;
374 throw IllegalMachine(__FILE__, __LINE__, __func__, msg);
375 }
376 }
377 delete results;
378}
ErrorCode
Error codes for different errors.
@ PC_AND_RA_PORTS_HAVE_UNEQUAL_WIDTH
RA and PC ports have unequal width.
@ IMEM_ADDR_WIDTH_DIFFERS_FROM_RA_AND_PC
Instruction memory address width differs from PC/RA port width.
@ GCU_AS_MISSING
Address space missing in GCU.
@ DIFFERENT_PORT_FOR_JUMP_AND_CALL
JUMP and CALL uses different port in GCU.
@ RA_PORT_MISSING
RA port missing in GCU.
@ USED_IO_NOT_BOUND
Pipeline uses an IO which is not bound.
@ GCU_MISSING
GCU missing in machine.
@ PC_PORT_MISSING
PC port missing in GCU.

References __func__, MachineValidator::DIFFERENT_PORT_FOR_JUMP_AND_CALL, MachineValidatorResults::error(), MachineValidatorResults::errorCount(), MachineValidator::GCU_AS_MISSING, MachineValidator::GCU_MISSING, MachineValidator::IMEM_ADDR_WIDTH_DIFFERS_FROM_RA_AND_PC, machine, MachineValidator::PC_AND_RA_PORTS_HAVE_UNEQUAL_WIDTH, MachineValidator::PC_PORT_MISSING, MachineValidator::RA_PORT_MISSING, MachineValidator::USED_IO_NOT_BOUND, and MachineValidator::validate().

Referenced by generateProcessor().

Here is the call graph for this function:

Member Data Documentation

◆ coreTopBlock_

NetlistBlock* ProGe::ProcessorGenerator::coreTopBlock_
private

◆ DEFAULT_ENTITY_STR

const TCEString ProGe::ProcessorGenerator::DEFAULT_ENTITY_STR = "tta0"
staticprivate

Definition at line 120 of file ProcessorGenerator.hh.

◆ entityStr_

TCEString ProGe::ProcessorGenerator::entityStr_
private

◆ generatorContext_

ProGeContext* ProGe::ProcessorGenerator::generatorContext_
private

Definition at line 118 of file ProcessorGenerator.hh.

Referenced by generateProcessor(), and generatorContext().


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