Go to the documentation of this file.
38 #include <boost/format.hpp>
109 const TCEString ProcessorGenerator::DEFAULT_ENTITY_STR =
"tta0";
114 ProcessorGenerator::ProcessorGenerator() : coreTopBlock_(NULL) {}
134 std::ostream& errorStream, std::ostream& warningStream,
135 std::ostream& verboseStream) {
157 "Unable to create directory " +
options.outputDirectory;
161 string pluginDstDir =
165 string errorMsg =
"Unable to create directory " + pluginDstDir;
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");
184 string topLevelDir =
options.outputDirectory +
194 string errorMsg =
"Unable to create directory " +
195 options.sharedOutputDirectory +
".";
204 "decomp-fetchblock-width",
"INSTRUCTIONWIDTH");
239 string errorMsg =
"Unable to create file " + dstFile;
242 std::ofstream stream(dstFile.c_str(), std::ofstream::out);
245 int bustrace_width = 0;
249 bus_width = (bus_width + 31) / 32 * 32;
250 bustrace_width += bus_width;
253 stream <<
"library work;" << endl
254 <<
"use work." <<
entityStr_ <<
"_imem_mau.all;" << endl
257 stream <<
"package " <<
entityStr_ <<
"_globals is" << endl
258 <<
" -- address width of the instruction memory" << endl
259 <<
" constant IMEMADDRWIDTH : positive := "
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
276 stream <<
"end " <<
entityStr_ <<
"_globals;" << endl;
281 stream <<
"// address width of the instruction memory" << endl
284 <<
"// width of the instruction memory in MAUs" << endl
285 <<
"parameter IMEMWIDTHINMAUS = " << imemWidthInMAUs <<
","
287 <<
"// clock period" << endl
288 <<
"parameter PERIOD = 10," << endl;
308 const std::string& dstDirectory) {
312 std::ofstream stream(dstFile.c_str(), std::ofstream::out);
343 std::ostream& warningStream) {
345 set<MachineValidator::ErrorCode> errorsToCheck;
352 errorsToCheck.insert(
362 for (
int i = 0; i < results->
errorCount(); i++) {
364 string errorMsg = results->
error(i).second;
367 warningStream <<
"Warning: " << errorMsg
368 <<
" ProGe uses the value set in the address space."
371 string msg =
"Error: " + errorMsg;
372 errorStream << msg << std::endl;
395 for (
int i = 0; i < iuNav.
count(); i++) {
411 "RF entry %1% does not have architecture defined in HDB "
418 int implLatency = architecture.
latency();
422 if (requiredLatencies.count(implLatency) == 0) {
424 "Latency of the implementation of immediate "
426 " acceptable latencies are %3%.");
427 errorMsg % iu->
name() % implLatency %
463 if (gcuRAPortWidth != imemASWidth) {
469 if (pcPort != NULL) {
470 if (pcPort->
width() != imemASWidth) {
476 if (pcPort != NULL) {
477 if (pcPort->
width() != imemASWidth) {
503 return iMem->
width() * imemWidthInMAUs;
532 std::list<string> removedSockets;
535 for (std::list<string>::iterator i = removedSockets.begin();
536 i != removedSockets.end(); i++) {
537 warningStream <<
"Warning: Removed unconnected socket " << *i
virtual void write(const Path &targetBaseDir, HDL targetLang=VHDL) const override
static bool createDirectory(const std::string &path)
virtual TCEString name() const
virtual void verifyCompatibility() const =0
@ IMEM_ADDR_WIDTH_DIFFERS_FROM_RA_AND_PC
Instruction memory address width differs from PC/RA port width.
bool isRISCVMachine() const
TTAMachine::Machine * machine
the architecture definition of the estimated processor
@ GCU_MISSING
GCU missing in machine.
IDF::MachineImplementation * implementation
the implementation definition of the estimated processor
const TTAMachine::Machine & adf() const
TCEString entityName() const
NetlistBlock * generate(const ProGeOptions &options, int imemWidthInMAUs, TCEString entityNameStr, std::ostream &warningStream)
RFImplementationLocation & iuImplementation(const std::string &iu) const
const NetlistBlock & processorTopLevel() const
@ USED_IO_NOT_BOUND
Pipeline uses an IO which is not bound.
virtual AddressSpace * addressSpace() const
static int iMemAddressWidth(const TTAMachine::Machine &mach)
NetlistBlock * coreTopBlock_
ProGeContext * generatorContext_
@ PC_PORT_MISSING
PC port missing in GCU.
static void implement(const ProGeOptions &options, std::vector< std::string > globalOptions, const std::vector< IDF::FUGenerated > &generatetFUs, const TTAMachine::Machine &machine, ProGe::NetlistBlock *core)
RFArchitecture & architecture() const
@ INSTRUCTION_LINE
Signal group type for serial TTA instruction bus.
void checkIULatencies(const TTAMachine::Machine &machine, const IDF::MachineImplementation &implementation, const ICDecoderGeneratorPlugin &plugin)
#define assert(condition)
virtual FUPort * port(int operand) const
virtual ControlUnit * controlUnit() const
#define abortWithError(message)
static bool spamVerbose()
@ GCU_AS_MISSING
Address space missing in GCU.
static const NetlistPortGroup * instructionBus(NetlistBlock &block)
@ PC_AND_RA_PORTS_HAVE_UNEQUAL_WIDTH
RA and PC ports have unequal width.
void generateOpcodePackage(HDL language, std::ofstream &stream) const
virtual std::vector< const NetlistPortGroup * > portGroupsBy(SignalGroupType type) const
virtual ImmediateUnitNavigator immediateUnitNavigator() const
void copyProcessorSpecific(const std::string &dstDirectory)
static void visualizeBlockTree(const BaseNetlistBlock &root, std::ostream &streamOut)
@ DIFFERENT_PORT_FOR_JUMP_AND_CALL
JUMP and CALL uses different port in GCU.
ErrorCode
Error codes for different errors.
const IDF::MachineImplementation & idf() const
static int iMemWidth(const TTAMachine::Machine &mach, int imemWidthInMAUs)
virtual bool hasOperation(const std::string &name) const
void generateGCUOpcodesPackage(HDL language, const TTAMachine::Machine &machine, const std::string &dstDirectory)
static bool createFile(const std::string &file)
std::string errorMessage() const
void validateMachine(const TTAMachine::Machine &machine, std::ostream &errorStream, std::ostream &warningStream)
static const std::string DIRECTORY_SEPARATOR
virtual void generate(HDL language, const std::string &destinationDirectory, const NetlistGenerator &generator, const IDF::MachineImplementation &implementation, const std::string &entityString)=0
static void removeUnconnectedSockets(TTAMachine::Machine &machine, std::ostream &warningStream)
static MachInfoCmdLineOptions options
void generateGlobalsPackage(HDL language, const TTAMachine::Machine &machine, int imemWidthInMAUs, const std::string &dstDirectory, ICDecoderGeneratorPlugin &plugin)
virtual std::set< int > requiredRFLatencies(const TTAMachine::ImmediateUnit &iu) const =0
@ RA_PORT_MISSING
RA port missing in GCU.
virtual int width() const
void replacePlaceholder(const std::string &key, const std::string &replacer, bool append=false)
virtual ~ProcessorGenerator()
const ProGeContext & generatorContext() const
static bool fileExists(const std::string fileName)
MachineValidatorResults * validate(const std::set< ErrorCode > &errorsToCheck) const
virtual BusNavigator busNavigator() const
static std::string makeString(const IterableContainer &container, const std::string &separator=", ")
HDL
HDLs supported by ProGe.
HDLTemplateInstantiator & getTemplateInstatiator()
void copyShared(const std::string &dstDirectory)
ComponentType * item(int index) const
virtual HWOperation * operation(const std::string &name) const
virtual void writeGlobalDefinitions(HDL language, std::ostream &pkgStream) const =0
virtual std::string hdbFile() const
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)
SpecialRegisterPort * returnAddressPort() const
const std::vector< FUGenerated > & FUGenerations() const
virtual ULongWord end() const
virtual bool hasArchitecture() const
bool hasReturnAddressPort() const
virtual int width() const
void removeNotConnectedSockets(TTAMachine::Machine &mach, std::list< std::string > &removedSocketNames)
RFEntry * rfByEntryID(RowID id) const
Error error(int index) const