Go to the documentation of this file.
68 std::ostream& warningStream, std::ostream& errorStream,
71 machine, idf, hdl, progeOutputDir, coreEntityName, outputDir,
72 programName, targetClockFreq, warningStream, errorStream, imem,
83 syncReset_(syncReset),
84 broadcast_pmem_(
false) {
91 "AlmaIF interface requires connections to an external debugger.";
92 throw InvalidData(__FILE__, __LINE__,
"AlmaIFIntegrator", msg);
102 std::map<TCEString, MemoryGenerator*>::iterator iter =
115 bool foundDmem =
false;
116 bool foundPmem =
false;
126 for (
int i = 0; i < fuNav.
count(); i++) {
133 std::string prefix = operation.substr(0, 2);
134 if (prefix ==
"ld" || prefix ==
"st") {
188 }
else if (foundDmem) {
198 }
else if (foundPmem) {
213 for (
int i = 0; i < coreCount; i++) {
214 int coreId = coreCount == 1 ? -1 : i;
239 int imemAddressWidth = 0;
247 int debugAddressWidth = 8;
248 int dmemAddressWidth =
255 int pmemAddressWidth = 0;
265 std::max(imemAddressWidth, debugAddressWidth),
266 std::max(dmemAddressWidth, pmemAddressWidth));
284 int bustrace_width = 0;
293 bus_width = (bus_width + 31) / 32 * 32;
294 bustrace_width += bus_width;
304 "axi_addr_width_g",
"integer",
"axi_addr_width_g");
311 "imem_axi_addr_width_g",
"integer",
323 "local_mem_addrw_g",
"integer",
"local_mem_addrw_g");
334 "second_dmem_data_width_g",
"integer",
337 "second_dmem_addr_width_g",
"integer",
343 "second-dmem-port-declarations",
344 Path(platformPath +
"second_dmem_port_declaration.snippet"));
348 "second-dmem-signal-declarations",
349 Path(platformPath +
"second_dmem_signal_declaration.snippet"));
355 "second-pmem-port-declarations",
356 Path(platformPath +
"second_pmem_port_declaration.snippet"));
360 "second-pmem-signal-declarations",
361 Path(platformPath +
"second_pmem_signal_declaration.snippet"));
365 "second_pmem_data_width_g",
"integer",
369 "second_pmem_addr_width_g",
"integer",
"local_mem_addrw_g");
372 "second_pmem_addr_width_g",
"integer",
386 "pmem-bcast",
Path(platformPath +
"pmem_broadcast.snippet"));
401 "Broadcasting pmem not supported with m_axi");
403 "local_mem_addrw_g",
"integer",
407 "axi_offset_low_g",
"integer",
"1136656384");
410 "axi_offset_low_g",
"integer",
"axi_offset_low_g");
412 "axi_offset_high_g",
"integer",
"axi_offset_high_g");
421 "local_mem_addrw_g",
"integer",
425 "axi_offset_high_g",
"integer",
"0");
433 "full-debugger-port-declarations",
434 Path(platformPath +
"full_debugger_port_declaration.snippet"));
436 "debugger",
Path(platformPath +
"full_debugger.snippet"));
439 "core_db_pc_start", coreCount * imemaddrw,
ProGe::OUT,
442 "core_db_pc_next", coreCount * imemaddrw,
ProGe::IN,
445 "core_db_bustraces", coreCount * bustrace_width,
ProGe::IN,
450 "mini-debugger-signal-declarations",
451 Path(platformPath +
"mini_debugger_signal_declaration.snippet"));
453 "debugger",
Path(platformPath +
"mini_debugger.snippet"));
461 "reserved_sp_bytes_g",
"integer",
466 "core_db_pc", coreCount * imemaddrw,
ProGe::IN,
"db_pc");
468 "core_db_lockcnt", coreCount * 64,
ProGe::IN,
"db_lockcnt");
470 "core_db_cyclecnt", coreCount * 64,
ProGe::IN,
"db_cyclecnt");
472 "core_db_tta_nreset", coreCount,
ProGe::OUT,
"db_tta_nreset");
474 "core_db_lockrq", coreCount,
ProGe::OUT,
"db_lockrq");
477 "core_db_dram_offset", 32,
ProGe::OUT,
"db_dram_offset");
479 "dram-offset-port-declaration",
480 "core_db_dram_offset : out std_logic_vector(32-1 downto 0);");
483 "enable-dmem",
"constant enable_dmem : boolean := false;");
488 "dram-offset-dummy-declaration",
489 "signal core_db_dram_offset : std_logic_vector(32-1 downto 0);");
492 "constant enable_dmem : boolean := dmem_data_width_g > 0;");
499 "core_imem_data_out", coreCount * imemdataw,
ProGe::OUT,
502 "core_imem_en_x_in", coreCount,
ProGe::IN,
"imem_en_x");
504 "core_imem_addr_in", coreCount * imemaddrw,
ProGe::IN,
508 const int strb_width = imemdataw / 8;
509 const int half_cores_ceil = (coreCount + 1) / 2;
513 "INSTR_a", half_cores_ceil, imemdataw * half_cores_ceil,
514 imemaddrw * half_cores_ceil, strb_width * half_cores_ceil,
517 "INSTR_b", half_cores_ceil, imemdataw * half_cores_ceil,
518 imemaddrw * half_cores_ceil, strb_width * half_cores_ceil,
530 Path(platformPath +
"imem_statements.snippet"));
534 Path(platformPath +
"imem_broadcast_dualport.snippet"));
536 "imem-port-declarations",
538 platformPath +
"imem_port_declaration_dualport.snippet"));
541 "imem-bcast",
Path(platformPath +
"imem_broadcast.snippet"));
543 "imem-port-declarations",
544 Path(platformPath +
"imem_port_declaration.snippet"));
556 mem_name +
"_data_width_g",
"integer",
559 mem_name +
"_addr_width_g",
"integer",
569 Path snippet(platformPath + mem_name +
"_signal_declaration.snippet");
571 mem_name +
"-signal-declarations", snippet);
577 Path snippet(platformPath +
"pmem_port_declaration_wide.snippet");
579 mem_name +
"-port-declarations", snippet);
581 Path snippet(platformPath + mem_name +
"_port_declaration.snippet");
583 mem_name +
"-port-declarations", snippet);
590 "core_" + mem_name +
"_avalid_in", coreCount,
ProGe::IN,
591 lsu_prefix +
"_avalid_out");
593 "core_" + mem_name +
"_aready_out", coreCount,
ProGe::OUT,
594 lsu_prefix +
"_aready_in");
596 "core_" + mem_name +
"_aaddr_in", coreCount * mem.
portAddrw,
599 "core_" + mem_name +
"_awren_in", coreCount,
ProGe::IN,
600 lsu_prefix +
"_awren_out");
602 "core_" + mem_name +
"_astrb_in",
604 lsu_prefix +
"_astrb_out");
607 "core_" + mem_name +
"_adata_in",
609 lsu_prefix +
"_adata_out");
611 "core_" + mem_name +
"_rvalid_out", coreCount,
ProGe::OUT,
612 lsu_prefix +
"_rvalid_in");
614 "core_" + mem_name +
"_rready_in", coreCount,
ProGe::IN,
615 lsu_prefix +
"_rready_out");
617 "core_" + mem_name +
"_rdata_out",
619 lsu_prefix +
"_rdata_in");
622 int addrWidth, dataWidth;
633 "core_" + mem_name +
"_2nd_avalid_in", coreCount,
ProGe::IN,
634 lsu_prefix +
"_avalid_out");
636 "core_" + mem_name +
"_2nd_aready_out", coreCount,
ProGe::OUT,
637 lsu_prefix +
"_aready_in");
639 "core_" + mem_name +
"_2nd_aaddr_in", coreCount * addrWidth,
642 "core_" + mem_name +
"_2nd_awren_in", coreCount,
ProGe::IN,
643 lsu_prefix +
"_awren_out");
645 "core_" + mem_name +
"_2nd_astrb_in", coreCount * dataWidth / 8,
649 "core_" + mem_name +
"_2nd_adata_in", coreCount * dataWidth,
652 "core_" + mem_name +
"_2nd_rvalid_out", coreCount,
ProGe::OUT,
653 lsu_prefix +
"_rvalid_in");
655 "core_" + mem_name +
"_2nd_rready_in", coreCount,
ProGe::IN,
656 lsu_prefix +
"_rready_out");
658 "core_" + mem_name +
"_2nd_rdata_out", coreCount * dataWidth,
670 bool make_local_sized =
779 const TCEString prefix,
int data_width,
int addr_width,
780 const bool ,
const bool overrideAsWidth) {
783 data_width = data_width * mem_count;
784 addr_width = addr_width * mem_count;
789 int strb_width = (data_width / mem_count + 7) / 8 * mem_count;
792 prefix, mem_count, data_width, addr_width, strb_width,
798 const TCEString prefix,
int mem_count,
int data_width,
int addr_width,
799 int strb_width,
const bool overrideAsWidth) {
802 if (overrideAsWidth) {
804 prefix +
"_aaddr_out",
"local_mem_addrw_g",
ProGe::OUT);
819 std::vector<TCEString> almaifFiles;
827 Path snippet(platformPath +
"axi_master_port_declaration.snippet");
829 "m-axi-port-declarations", snippet);
831 Path snippet(platformPath +
"axi_master_signal_declaration.snippet");
833 "m-axi-signal-declarations", snippet);
837 platformPath +
"tta-accel.vhdl.tmpl",
outputPath);
869 scriptPath +
"utilization.tcl.tmpl",
outputPath);
871 for (
unsigned int i = 0; i < almaifFiles.size(); i++) {
878 const TCEString inputPath, std::vector<TCEString>& fileList,
879 bool isScript)
const {
903 auto ttaCCPort = core.
port(
"debug_cycle_count_in");
905 netlist.
connect(*core.
port(
"db_cyclecnt"), *ttaCCPort);
907 auto ttaLCPort = core.
port(
"debug_lock_count_in");
909 netlist.
connect(*core.
port(
"db_lockcnt"), *ttaLCPort);
911 for (
size_t i = 0; i < core.
portCount(); ++i) {
921 if (portName.substr(0, 4) ==
"core") {
923 coreKey <<
"core" << coreId;
924 size_t cutoff = portName.find_first_of(
'_');
925 if (portName.substr(0, cutoff) != coreKey) {
929 portName = portName.substr(cutoff + 1);
937 if (coreId != -1 &&
imem_dp_ && portName ==
"imem_data") {
943 portWidth * coreId,
imemInfo().mauWidth);
945 }
else if (coreId != -1) {
948 portWidth * coreId, portWidth);
1008 TCEString msg =
"Unsupported instruction memory type";
1009 throw InvalidData(__FILE__, __LINE__,
"AlmaIFIntegrator", msg);
1018 std::vector<std::string> lsuPorts) {
1026 bool genSingleRam =
false;
1027 bool genDualPortRam =
false;
1028 bool overrideAsWidth =
false;
1031 bool isSecondInstance =
false;
1042 if (isDmem || isPmem) {
1043 genDualPortRam =
true;
1047 isSecondInstance =
true;
1056 isSecondInstance =
true;
1067 overrideAsWidth =
true;
1089 TCEString msg =
"Unsupported data memory type";
1090 throw InvalidData(__FILE__, __LINE__,
"AlmaIFIntegrator", msg);
1092 memGen->
addLsu(lsuArch, lsuPorts);
1101 <<
"Integrator name: AlmaIFIntegrator" << std::endl
1102 <<
"-----------------------------" << std::endl
1103 <<
"Integrates the processor core to an AXI4 bus interface according "
1104 <<
"to ALMARVI HW Integration Interface specification." << std::endl
1105 <<
"Supported instruction memory types are 'onchip' and 'none'."
1107 <<
"Supported data memory types are 'onchip' and 'none'." << std::endl
1108 <<
"Data and Parameter memory spaces must be named '" <<
DMEM_NAME
1109 <<
"' and '" <<
PMEM_NAME <<
"' respectively." << std::endl
HDLTemplateInstantiator accelInstantiator_
virtual const Netlist & netlist() const
virtual NetlistPortGroup * clone(bool asMirrored=false) const
static const int DEFAULT_LOCAL_MEMORY_WIDTH
static const TCEString AXI_AS_NAME
virtual void printInfo(std::ostream &stream) const
virtual TCEString name() const
virtual TCEString devicePackage() const
bool hasSeparateLocalMemory_
virtual bool hasAddressSpace() const
TTAMachine::Machine * machine
the architecture definition of the estimated processor
ProGe::NetlistPortGroup * axiMasterPortGroup()
virtual TCEString deviceFamily() const
std::string secondDmemName_
@ BIT_VECTOR
Several bits.
virtual bool hasNumericalId(unsigned id) const
virtual void setDeviceFamily(TCEString devFamily)
void setParameter(const std::string &name, const std::string &type, const std::string &value)
virtual AddressSpace * addressSpace() const
virtual void writeProjectFiles()=0
virtual bool chopTaggedSignals() const
static std::string fileOfPath(const std::string pathName)
static std::string toString(const T &source)
virtual size_t portCount() const
void replacePlaceholderFromFile(const std::string &key, const Path &filePath, bool append=false)
virtual TCEString deviceSpeedClass() const
bool connect(const NetlistPort &port1, const NetlistPort &port2, int port1FirstBit, int port2FirstBit, int width=1)
bool connectGroupByName(const NetlistPortGroup &group1, const NetlistPortGroup &group2)
#define assert(condition)
std::string icDecoderParameterValue(const std::string &name) const
TCEString axiAddressWidth() const
virtual MemoryGenerator & dmemInstance(MemInfo dmem, TTAMachine::FunctionUnit &lsuArch, std::vector< std::string > lsuPorts)
const std::string & name() const
ProGe::NetlistPortGroup * axiSlavePortGroup()
std::map< TCEString, ProGe::NetlistPort * > almaif_ttacore_ports
virtual FunctionUnitNavigator functionUnitNavigator() const
static void copy(const std::string &source, const std::string &target)
void addPort(NetlistPort &port)
void addPortToAlmaIFBlock(const TCEString name, const TCEString width, const ProGe::Direction dir, const TCEString core_name="")
virtual int operationCount() const
void addPortToGroup(ProGe::NetlistPortGroup *port_group, const ProGe::Direction dir, const TCEString name, const TCEString width)
void addLsu(TTAMachine::FunctionUnit &lsuArch, std::vector< std::string > lsuPorts)
virtual TCEString pinTag() const
void connectCoreMemories(MemInfo mem, TCEString mem_name, TCEString mem_block_name, bool seconds)
static const TCEString PMEM_NAME
void addHdlFile(const TCEString &file)
void exportUnconnectedPorts(int coreId)
void addMemoryPorts(const TCEString as_name, int data_width, int addr_width, const bool isShared, const bool overrideAsWidth)
static const std::string DIRECTORY_SEPARATOR
void copyPlatformFile(const TCEString inputPath, std::vector< TCEString > &fileList, bool isScript=false) const
void replacePlaceholder(const std::string &key, const std::string &replacer, bool append=false)
MemoryGenerator * imemGen_
find Finds info of the inner loops in the false
static const TCEString DEFAULT_DEVICE
static const int DEFAULT_RESERVED_PRIVATE_MEM_SIZE
virtual ~AlmaIFIntegrator()
DataType
Data types of hardware ports.
static const TCEString ALMAIF_MODULE
virtual BusNavigator busNavigator() const
void addPortGroup(NetlistPortGroup *portGroup)
HDL
HDLs supported by ProGe.
std::map< TCEString, MemoryGenerator * > dmemGen_
virtual bool integrateCore(const ProGe::NetlistBlock &cores, int coreId)
ProGe::NetlistBlock * almaifBlock_
ComponentType * item(int index) const
virtual HWOperation * operation(const std::string &name) const
virtual ProjectFileGenerator * projectFileGenerator() const
void instantiateTemplateFile(const std::string &templateFile, const std::string &dstFile)
virtual void integrateProcessor(const ProGe::NetlistBlock *progeBlock)
virtual MemoryGenerator & imemInstance(MemInfo imem, int coreId)
Direction
Direction of the port.
DefaultProjectFileGenerator * fileGen_
virtual NetlistPort * port(const std::string &portName, bool partialMatch=true)
std::string secondPmemName_
static std::string dataDirPath(const std::string &prog)
static const TCEString DMEM_NAME
virtual int targetClockFrequency() const