55 BlocksModel& blocksModel,
const string& outputName) {
59 const int bitWidth = 8;
60 const unsigned int minAddress = 0;
62 const unsigned int maxAddressInstr = 2046;
64 const unsigned int maxAddressData = 32768;
66 "data", bitWidth, minAddress, maxAddressData, ttaMach);
68 "instructions", bitWidth, minAddress, maxAddressInstr, ttaMach);
71 list<BlocksALUPair*> aluList;
72 list<BlocksLSUPair*> lsuList;
73 list<BlocksRF*> rfList;
74 list<BlocksIMM*> iuList;
75 list<BlocksMULPair*> mulList;
86 for (
auto& source : fu.src) {
88 string sourcePort = source.substr(source.rfind(
".") + 1);
89 string sourceFu = source.substr(0, source.rfind(
"."));
92 if (srcFu.name == sourceFu) {
93 if (sourcePort ==
"0")
94 srcFu.usesOut0 =
true;
96 srcFu.usesOut1 =
true;
109 ttaMach, fu.name, fu.src, asData, fu.usesOut0,
114 ttaMach, fu.name, fu.src, fu.usesOut0, fu.usesOut1));
117 rfList.push_back(
new BlocksRF(ttaMach, fu.name, fu.src));
120 iuList.push_back(
new BlocksIMM(ttaMach, fu.name, fu.src));
121 if (iuList.size() == 1)
122 limm.
addSlot(
"ra_out_to_ra_in", 32, *(iuList.back()->iu));
126 ttaMach, fu.name, fu.src, fu.usesOut0, fu.usesOut1));
133 throw "Illegal function unit type in Blocks.xml file, aborting translation. \n";
134 }
catch (
const char* error) {
135 fprintf(stderr,
"%s", error);
137 ttaMach, aluList, lsuList, rfList, iuList, mulList);
143 ConnectInputs(ttaMach, gcu, aluList, lsuList, rfList, mulList);
145 Deinitialize(ttaMach, aluList, lsuList, rfList, iuList, mulList);
165 const int busWidth = 32;
166 const int immWidth = 0;
167 const string& to = inputSocket->
name();
168 const string& from = outputSocket->
name();
171 const string newBusNum = to_string(busNav.
count());
176 ttaBus =
new Bus(
"bus_" + newBusNum, busWidth, immWidth, busExt);
179 if (inputSocket->
name() ==
"ra_in" || inputSocket->
name() ==
"pc") {
188 ttaBus =
new Bus(
"bus_" + newBusNum, busWidth, immWidth, busExt);
191 if (inputSocket->
name() ==
"ra_in" || inputSocket->
name() ==
"pc") {
227 std::list<BlocksALUPair*> aluList, std::list<BlocksLSUPair*> lsuList,
228 std::list<BlocksRF*> rfList, std::list<BlocksMULPair*> mulList) {
231 for (
auto& blocksAlu : aluList) {
232 for (
auto& source : blocksAlu->sources) {
235 mach, blocksAlu->in1sock.get(), outputSocket, gcu);
237 mach, blocksAlu->in2sock.get(), outputSocket, gcu);
242 for (
auto& lsu : lsuList) {
243 for (
auto& source : lsu->sources) {
251 for (
auto& mul : mulList) {
252 for (
auto& source : mul->sources) {
260 for (
auto& rf : rfList) {
261 for (
auto& source : rf->sources) {
269 for (
auto& source : gcu.
sources) {
287 source.replace(source.rfind(
"."), 1,
"_out");
290 "Cannot create connection, output socket not found!");
291 return nav.
item(source);
306 std::list<BlocksLSUPair*> lsuList, std::list<BlocksRF*> rfList,
307 std::list<BlocksIMM*> iuList, std::list<BlocksMULPair*> mulList) {
308 while (!aluList.empty()) {
309 delete aluList.front();
312 while (!lsuList.empty()) {
313 delete lsuList.front();
316 while (!rfList.empty()) {
317 delete rfList.front();
320 while (!iuList.empty()) {
321 delete iuList.front();
324 while (!mulList.empty()) {
325 delete mulList.front();
330 while (busNav.
count() != 0) {
346 throw "Invalid number of arguments, expected 2 arguments. \n";
347 }
catch (
const char* error) {
348 fprintf(stderr,
"%s", error);
351 "Expected path to .xml file with Blocks architecture and name of "
352 "output architecture (<name>.adf). \n");
356 const string filepath = string(argv[1]);