Go to the documentation of this file.
39 #include <boost/format.hpp>
80 #define ALLOW_OPCODE_EDITING
104 " id INTEGER PRIMARY KEY,"
105 " architecture REFERENCES fu_architecture(id),"
106 " cost_function REFERENCES cost_function_plugin(id));";
109 "CREATE TABLE fu_architecture("
110 " id INTEGER PRIMARY KEY);";
113 "CREATE TABLE pipeline_resource("
114 " id INTEGER PRIMARY KEY,"
115 " fu_arch REFERENCES fu_architecture(id) NOT NULL);";
118 "CREATE TABLE operation_pipeline("
119 " id INTEGER PRIMARY KEY,"
120 " fu_arch REFERENCES fu_architecture(id) NOT NULL,"
121 " operation REFERENCES operation(id) NOT NULL);";
124 "CREATE TABLE pipeline_resource_usage("
125 " id INTEGER PRIMARY KEY,"
126 " cycle INTEGER NOT NULL,"
127 " resource REFERENCES pipeline_resource(id) NOT NULL,"
128 " pipeline REFERENCES operation_pipeline(id) NOT NULL);";
131 "CREATE TABLE io_usage("
132 " id INTEGER PRIMARY KEY,"
133 " cycle INTEGER NOT NULL,"
134 " io_number INTEGER NOT NULL,"
135 " action BOOLEAN NOT NULL,"
136 " pipeline REFERENCES operation_pipeline(id) NOT NULL);";
139 "CREATE TABLE operation("
140 " id INTEGER PRIMARY KEY,"
141 " name TEXT UNIQUE NOT NULL);";
144 "CREATE TABLE fu_data_port("
145 " id INTEGER PRIMARY KEY,"
146 " triggers BOOLEAN NOT NULL,"
147 " sets_opcode BOOLEAN NOT NULL,"
148 " guard_support BOOLEAN NOT NULL,"
150 " fu_arch REFERENCES fu_architecture(id));";
153 "CREATE TABLE io_binding("
154 " id INTEGER PRIMARY KEY,"
155 " io_number INTEGER NOT NULL,"
156 " port REFERENCES fu_data_port(id) NOT NULL,"
157 " operation REFERENCES operation(id) NOT NULL);";
160 "CREATE TABLE fu_implementation("
161 " id INTEGER PRIMARY KEY,"
162 " name TEXT NOT NULL,"
164 " clk_port TEXT NOT NULL,"
165 " rst_port TEXT NOT NULL,"
166 " glock_port TEXT NOT NULL,"
167 " glock_req_port TEXT,"
168 " fu REFERENCES fu(id) UNIQUE NOT NULL);";
171 "CREATE TABLE opcode_map("
172 " id INTEGER PRIMARY KEY,"
173 " opcode INTEGER NOT NULL,"
174 " operation REFERENCES operation(id) NOT NULL,"
175 " fu_impl REFERENCES fu_implementation(id) NOT NULL);";
178 "CREATE TABLE fu_port_map("
179 " id INTEGER PRIMARY KEY,"
180 " name TEXT NOT NULL,"
181 " width_formula TEXT NOT NULL,"
184 " fu_impl REFERENCES fu_implementation(id) NOT NULL,"
185 " arch_port REFERENCES fu_data_port(id) NOT NULL,"
186 " UNIQUE (name, fu_impl));";
189 "CREATE TABLE fu_external_port("
190 " id INTEGER PRIMARY KEY,"
191 " name TEXT NOT NULL,"
192 " direction TEXT NOT NULL,"
193 " width_formula TEXT NOT NULL,"
195 " fu_impl REFERENCES fu_implementation(id) NOT NULL, "
196 " UNIQUE (name, fu_impl));";
199 "CREATE TABLE rf_external_port("
200 " id INTEGER PRIMARY KEY,"
201 " name TEXT NOT NULL,"
202 " direction TEXT NOT NULL,"
203 " width_formula TEXT NOT NULL,"
205 " rf_impl REFERENCES rf_implementation(id) NOT NULL, "
206 " UNIQUE (name, rf_impl));";
209 "CREATE TABLE fu_implementation_parameter("
210 " id INTEGER PRIMARY KEY,"
211 " name TEXT NOT NULL,"
214 " fu_impl REFERENCES fu_implementation(id) NOT NULL);";
217 "CREATE TABLE rf_implementation_parameter("
218 " id INTEGER PRIMARY KEY,"
219 " name TEXT NOT NULL,"
222 " rf_impl REFERENCES rf_implementation(id) NOT NULL);";
225 "CREATE TABLE fu_ext_port_parameter_dependency("
226 " id INTEGER PRIMARY KEY,"
227 " port REFERENCES fu_external_port(id) NOT NULL,"
228 " parameter REFERENCES fu_implementation_parameter(id) NOT NULL);";
231 "CREATE TABLE rf_ext_port_parameter_dependency("
232 " id INTEGER PRIMARY KEY,"
233 " port REFERENCES rf_external_port(id) NOT NULL,"
234 " parameter REFERENCES rf_implementation_parameter(id) NOT NULL);";
238 " id INTEGER PRIMARY KEY,"
239 " architecture REFERENCES rf_architecture(id),"
240 " cost_function REFERENCES cost_function_plugin(id));";
243 "CREATE TABLE rf_architecture("
244 " id INTEGER PRIMARY KEY,"
247 " read_ports INTEGER NOT NULL,"
248 " write_ports INTEGER NOT NULL,"
249 " bidir_ports INTEGER NOT NULL,"
250 " latency INTEGER NOT NULL,"
251 " max_reads INTEGER NOT NULL,"
252 " max_writes INTEGER NOT NULL,"
253 " guard_support BOOLEAN NOT NULL,"
254 " guard_latency INTEGER NOT NULL,"
255 " zero_register BOOLEAN DEFAULT FALSE);";
258 "CREATE TABLE rf_implementation("
259 " id INTEGER PRIMARY KEY,"
260 " name TEXT NOT NULL,"
263 " clk_port TEXT NOT NULL,"
264 " rst_port TEXT NOT NULL,"
265 " glock_port TEXT NOT NULL,"
267 " rf REFERENCES rf(id) NOT NULL,"
268 " sac_param INTEGER DEFAULT 0);";
271 "CREATE TABLE rf_data_port("
272 " id INTEGER PRIMARY KEY,"
273 " name TEXT NOT NULL,"
274 " direction TEXT NOT NULL,"
275 " load_port TEXT NOT NULL,"
276 " opcode_port TEXT NOT NULL,"
277 " opcode_port_width_formula TEXT NOT NULL,"
278 " rf_impl REFERENCES rf_implementation(id),"
279 " UNIQUE (name, rf_impl));";
282 "CREATE TABLE block_source_file("
283 " id INTEGER PRIMARY KEY,"
284 " file TEXT NOT NULL,"
285 " format REFERENCES format(id));";
288 "CREATE TABLE rf_source_file("
289 " id INTEGER PRIMARY KEY,"
290 " rf_impl REFERENCES rf_implementation(id),"
291 " file REFERENCES block_source_file(id));";
294 "CREATE TABLE fu_source_file("
295 " id INTEGER PRIMARY KEY,"
296 " fu_impl REFERENCES fu_implementation(id),"
297 " file REFERENCES block_source_file(id));";
300 "CREATE TABLE format("
301 " id INTEGER PRIMARY KEY,"
302 " format TEXT NOT NULL);";
306 " id INTEGER PRIMARY KEY);";
309 "CREATE TABLE socket ("
310 " id INTEGER PRIMARY KEY);";
313 "CREATE TABLE cost_function_plugin("
314 " id INTEGER PRIMARY KEY, "
315 " description TEXT, "
317 " plugin_file_path TEXT NOT NULL, "
318 " type STRING NOT NULL);";
321 "CREATE TABLE cost_estimation_data("
322 " id INTEGER PRIMARY KEY, "
323 " plugin_reference REFERENCES cost_function_plugin(id), "
324 " rf_reference REFERENCES rf(id), "
325 " fu_reference REFERENCES fu(id), "
326 " bus_reference REFERENCES bus(id), "
327 " socket_reference REFERENCES socket(id), "
332 "CREATE INDEX fu_port_map_arch_index ON fu_port_map(arch_port)";
335 "CREATE INDEX fu_impl_entry_index ON fu_implementation(fu)";
338 "CREATE INDEX rf_impl_entry_index ON rf_implementation(rf)";
341 "CREATE TABLE operation_implementation_resource_source_file("
342 " id INTEGER PRIMARY KEY,"
343 " resource REFERENCES operation_implementation_resource(id),"
344 " file REFERENCES block_source_file(id)"
348 "CREATE TABLE operation_implementation_source_file("
349 " id INTEGER PRIMARY KEY,"
350 " operation REFERENCES operation_implementation(id),"
351 " file REFERENCES block_source_file(id)"
355 "CREATE TABLE operation_implementation_resource("
356 " id INTEGER PRIMARY KEY,"
357 " name TEXT NOT NULL"
361 "CREATE TABLE operation_implementation("
362 " id INTEGER PRIMARY KEY,"
363 " name TEXT NOT NULL"
367 "CREATE TABLE operation_implementation_resources("
368 " id INTEGER PRIMARY KEY,"
369 " operation REFERENCES operation_implementation(id),"
370 " resource REFERENCES operation_implementation_resource(id),"
371 " count INTEGER NOT NULL"
375 "CREATE TABLE operation_implementation_variable("
376 " id INTEGER PRIMARY KEY,"
377 " operation REFERENCES operation_implementation(id),"
378 " name TEXT NOT NULL,"
379 " width TEXT NOT NULL,"
380 " type TEXT NOT NULL,"
381 " language TEXT NOT NULL"
386 HDBManager* HDBManager::instance_ = NULL;
394 HDBManager::HDBManager(
const std::string& hdbFile)
395 : db_(new
SQLite()), dbConnection_(NULL), hdbFile_(hdbFile) {
397 string errorMsg =
"File '" + hdbFile +
"' doesn't exist.";
402 string errorMsg =
"File '" + hdbFile +
"' has no read rights.";
427 "INSERT INTO format(id,format) VALUES"
430 "INSERT INTO format(id,format) VALUES"
446 "ALTER TABLE operation_implementation_resource ADD COLUMN "
456 "ALTER TABLE operation_implementation ADD COLUMN "
457 "bus_definition TEXT;"));
459 "ALTER TABLE operation_implementation ADD COLUMN "
460 "post_op_vhdl TEXT;"));
462 "ALTER TABLE operation_implementation ADD COLUMN "
463 "post_op_verilog TEXT;"));
470 "ALTER TABLE operation_implementation_resource ADD COLUMN "
471 "latency INTEGER;"));
473 "ALTER TABLE operation_implementation ADD COLUMN "
474 "default_verilog TEXT;"));
476 "ALTER TABLE operation_implementation ADD COLUMN "
477 "default_vhdl TEXT;"));
487 "ALTER TABLE operation_implementation RENAME TO "
488 "operation_implementation_old"));
490 "CREATE TABLE operation_implementation ( "
491 "id INTEGER PRIMARY KEY, "
493 "name TEXT NOT NULL, "
494 "bus_definition TEXT, "
495 "post_op_vhdl TEXT, "
496 "post_op_verilog TEXT, "
497 "initial_vhdl TEXT, "
498 "initial_verilog TEXT)"));
500 "INSERT INTO operation_implementation "
501 "(id, name, bus_definition, post_op_vhdl, post_op_verilog, "
502 "initial_vhdl, initial_verilog) "
503 "SELECT id, name, bus_definition, post_op_vhdl, post_op_verilog, "
504 "default_vhdl, default_verilog "
505 "FROM operation_implementation_old"));
507 "DROP TABLE operation_implementation_old"));
519 if (!
hasColumn(
"rf_architecture",
"zero_register")) {
550 const string procName =
"HDBManager::createNew";
595 db.
close(connection);
598 std::string(
"Initialization of HDB failed. ") +
635 switch (plugin.
type()) {
651 (boost::format(
"Illegal cost_function_plugin type %d.") %
656 string name = plugin.
name();
660 "INSERT INTO cost_function_plugin(id,description,name,"
661 "plugin_file_path,type) VALUES"
662 "(NULL,\"" + description +
"\",\"" + name +
"\",\"" +
663 pluginFilePath +
"\",\"" + type +
"\");"));
692 "DELETE FROM cost_function_plugin "
696 "DELETE FROM cost_estimation_data "
697 "WHERE plugin_reference=" +
729 std::map<FUPort*, RowID> portIDMap;
736 std::string(
"INSERT INTO fu_architecture(id) VALUES(NULL);"));
743 "INSERT INTO fu_data_port(id,triggers,sets_opcode,"
744 "guard_support,width,fu_arch) "
758 portIDMap.insert(std::pair<FUPort*, RowID>(port, portID));
767 "INSERT INTO operation(id,name) VALUES(NULL,\"" +
768 operation->
name() +
"\");"));
777 if (operation->
isBound(*port)) {
778 int io = operation->
io(*port);
780 "INSERT INTO io_binding(id,io_number,port,operation)"
783 MapTools::valueForKey<RowID>(portIDMap, port)) +
784 ",(SELECT id FROM operation WHERE "
785 "lower(name)=\"" + operation->
name() +
"\"));");
791 std::map<HWOperation*, RowID> pLineIDMap;
798 "INSERT INTO operation_pipeline(id,fu_arch,operation) "
800 ",(SELECT id FROM operation WHERE lower(name)=\"" +
801 operation->
name() +
"\"));"));
803 std::pair<HWOperation*, RowID>(
811 for (
int cycle = 0; cycle < pLine->
latency(); cycle++) {
816 for (ExecutionPipeline::OperandSet::const_iterator iter =
817 readOperands.begin();
818 iter != readOperands.end(); iter++) {
821 "INSERT INTO io_usage(id,cycle,io_number,action,"
822 "pipeline) VALUES(NULL," +
827 MapTools::valueForKey<RowID>(
828 pLineIDMap, operation)) +
");"));
830 for (ExecutionPipeline::OperandSet::const_iterator iter =
831 writtenOperands.begin();
832 iter != writtenOperands.end(); iter++) {
835 "INSERT INTO io_usage(id,cycle,io_number,action,"
836 "pipeline) VALUES(NULL," +
841 MapTools::valueForKey<RowID>(
842 pLineIDMap, operation)) +
");"));
848 std::map<PipelineElement*, RowID> pipelineElementMap;
853 "INSERT INTO pipeline_resource(id,fu_arch) VALUES "
855 pipelineElementMap.insert(
856 std::pair<PipelineElement*, RowID>(
866 for (
int cycle = 0; cycle < pLine->
latency(); cycle++) {
869 MapTools::valueForKey<RowID>(
870 pipelineElementMap, element));
872 MapTools::valueForKey<RowID>(
873 pLineIDMap, operation));
876 "INSERT INTO pipeline_resource_usage(id,"
877 "cycle,resource,pipeline) VALUES(NULL," +
879 resID +
"," + pLineID +
");"));
910 "SELECT id FROM fu WHERE architecture=" +
952 "DELETE FROM io_binding "
961 "DELETE FROM fu_data_port "
967 "DELETE FROM io_usage "
969 "(SELECT id FROM operation_pipeline "
975 "DELETE FROM pipeline_resource_usage "
977 "(SELECT id FROM operation_pipeline "
983 "DELETE FROM pipeline_resource "
989 "DELETE FROM operation_pipeline "
995 "DELETE FROM fu_architecture "
1017 std::string(
"INSERT INTO fu(id) VALUES(NULL);"));
1050 "SELECT id FROM fu_implementation "
1069 "SELECT id FROM cost_estimation_data "
1125 delete existingEntry;
1128 delete existingEntry;
1129 existingEntry = NULL;
1140 string clkPort = impl.
clkPort();
1141 string rstPort = impl.
rstPort();
1147 "INSERT INTO fu_implementation(id,name,opcode_port,"
1148 "clk_port,rst_port,glock_port,glock_req_port,fu) VALUES"
1149 "(NULL,\"" + module +
"\",\"" + opcPort +
"\",\"" +
1150 clkPort +
"\",\"" + rstPort +
"\",\"" + glockPort +
"\",\""
1158 string name = portImpl.
name();
1160 string loadPort = portImpl.
loadPort();
1161 string guardPort = portImpl.
guardPort();
1167 bool portAdded =
false;
1170 if (operation->
isBound(*port)) {
1171 int io = operation->
io(*port);
1175 "SELECT fu_data_port.id FROM fu_data_port,"
1176 "io_binding,operation WHERE "
1177 "fu_data_port.fu_arch=" +
1179 " AND io_binding.port=fu_data_port.id AND "
1180 "io_binding.io_number=" +
1182 " AND lower(operation.name)=\"" +
1184 "\" AND io_binding.operation=operation.id;"));
1196 "INSERT INTO fu_port_map(id,name,width_formula,"
1197 "load_port,guard_port,fu_impl,arch_port) VALUES"
1198 "(NULL,\"" + name +
"\",\"" + widthFormula +
1199 "\",\"" + loadPort +
"\",\"" + guardPort +
1211 #ifdef ALLOW_OPCODE_EDITING
1217 "FU implementation uses unknown operation %1%.");
1218 errorMsg % operation->
name();
1220 __FILE__, __LINE__,
__func__, errorMsg.str());
1224 format errorMsg(
"Opcode not defined for operation %1%.");
1225 errorMsg % operation->
name();
1227 __FILE__, __LINE__,
__func__, errorMsg.str());
1233 "INSERT INTO opcode_map(id,opcode,operation,fu_impl)"
1235 ",(SELECT id FROM operation WHERE lower(name)=\"" +
1236 operation->
name() +
"\")," +
1247 "INSERT INTO fu_external_port(id,name,direction,"
1248 "width_formula,description,fu_impl) VALUES(NULL,\"" +
1249 port.
name() +
"\",\"" + direction +
"\",\"" +
1259 "INSERT INTO fu_implementation_parameter(id,name,type,"
1260 "value,fu_impl) VALUES(NULL,\"" + param.
name +
1261 "\",\"" + param.
type +
"\",\"" + param.
value +
1272 "INSERT INTO fu_ext_port_parameter_dependency(id,"
1273 "port,parameter) VALUES(NULL,(SELECT id FROM "
1274 "fu_external_port WHERE fu_impl=" +
1276 port.
name() +
"\"),(SELECT id FROM "
1277 "fu_implementation_parameter WHERE fu_impl=" +
1295 "INSERT INTO fu_source_file(id,fu_impl,file) "
1297 ",(SELECT id FROM block_source_file WHERE file=\"" +
1333 "DELETE FROM fu_ext_port_parameter_dependency "
1334 "WHERE parameter in (SELECT ALL id FROM "
1335 "fu_implementation_parameter WHERE fu_impl="
1341 "DELETE FROM fu_external_port "
1347 "DELETE FROM fu_port_map "
1353 "DELETE FROM opcode_map "
1359 "DELETE FROM fu_implementation_parameter "
1365 "DELETE FROM fu_source_file "
1371 "DELETE FROM block_source_file "
1373 "(SELECT file FROM fu_source_file UNION "
1374 "SELECT file FROM rf_source_file);"));
1379 "DELETE FROM fu_implementation "
1415 "UPDATE fu SET architecture=" +
1446 "UPDATE fu SET architecture=NULL WHERE id=" +
1465 "INSERT INTO rf_architecture(id,size,width,read_ports,"
1466 "write_ports,bidir_ports,latency,max_reads,max_writes,"
1467 "guard_support,guard_latency,zero_register) VALUES(NULL,";
1512 "SELECT id FROM rf WHERE architecture=" +
1514 bool returnValue = !result->
hasNext();
1543 "DELETE FROM rf_architecture WHERE id=" +
1561 "INSERT INTO rf(id,architecture,cost_function) "
1562 "VALUES(NULL,NULL,NULL);"));
1593 "DELETE FROM cost_estimation_data WHERE rf_reference=" +
1604 "SELECT id FROM rf_implementation WHERE rf=" +
1653 if(!
hasColumn(
"rf_implementation",
"sac_param")) {
1673 int sacFlagAsInt =
implementation.separateAddressCycleParameter();
1676 std::string insert_query(
1677 "INSERT INTO rf_implementation(id,name,size_param,"
1678 "width_param,clk_port,rst_port,glock_port,guard_port,sac_param,rf) "
1697 "INSERT INTO rf_data_port(id,name,direction,load_port,"
1698 "opcode_port,opcode_port_width_formula,rf_impl) "
1699 "VALUES(NULL,\"" + port.
name() +
"\",\"" +
1707 for (
int i = 0; i <
implementation.implementationFileCount(); i++) {
1713 for (
int i = 0; i <
implementation.implementationFileCount(); i++) {
1718 "INSERT INTO rf_source_file values(NULL, " +
1720 ", (SELECT id FROM block_source_file WHERE file=\"" +
1730 "INSERT INTO rf_external_port(id,name,direction,"
1731 "width_formula,description,rf_impl) VALUES(NULL,\"" +
1732 port.
name() +
"\",\"" + direction +
"\",\"" +
1742 "INSERT INTO rf_implementation_parameter(id,name,type,"
1743 "value,rf_impl) VALUES(NULL,\"" + param.
name +
1744 "\",\"" + param.
type +
"\",\"" + param.
value +
1752 if (!widthParam.empty() && !
implementation.hasParameter(widthParam)) {
1755 "INSERT INTO rf_implementation_parameter(id,name,type,"
1756 "value,rf_impl) VALUES(NULL,\"" + widthParam +
1757 "\", \"integer\", \"\"," +
1761 if (!sizeParam.empty() && !
implementation.hasParameter(sizeParam)) {
1764 "INSERT INTO rf_implementation_parameter(id,name,type,"
1765 "value,rf_impl) VALUES(NULL,\"" + sizeParam +
1766 "\", \"integer\", \"\"," +
1777 "INSERT INTO rf_ext_port_parameter_dependency(id,"
1778 "port,parameter) VALUES(NULL,(SELECT id FROM "
1779 "rf_external_port WHERE rf_impl=" +
1781 port.
name() +
"\"),(SELECT id FROM "
1782 "rf_implementation_parameter WHERE rf_impl=" +
1810 bool dependencyTableExists =
1812 bool parameterTableExists =
1814 bool externalPortTableExists =
1822 if (dependencyTableExists) {
1823 assert(parameterTableExists && externalPortTableExists);
1826 "DELETE FROM rf_ext_port_parameter_dependency "
1827 "WHERE parameter in (SELECT ALL id "
1828 "FROM rf_implementation_parameter WHERE rf_impl = " +
1834 if (externalPortTableExists) {
1837 "DELETE FROM rf_external_port "
1844 if (parameterTableExists) {
1847 "DELETE FROM rf_implementation_parameter "
1854 "DELETE FROM rf_source_file WHERE rf_impl=" +
1860 "DELETE FROM block_source_file WHERE id NOT IN "
1861 "(SELECT file FROM fu_source_file UNION "
1862 "SELECT file FROM rf_source_file);"));
1867 "DELETE FROM rf_data_port WHERE rf_impl=" +
1873 "DELETE FROM rf_implementation WHERE id=" +
1915 "UPDATE rf SET architecture=" +
1934 "UPDATE rf SET architecture=NULL WHERE id=" +
1956 "UPDATE fu SET cost_function=" +
1977 "UPDATE fu SET cost_function=NULL WHERE id=" +
1999 "UPDATE rf SET cost_function=" +
2020 "UPDATE rf SET cost_function=NULL WHERE id=" +
2037 string query =
"SELECT id AS 'fu.id' FROM fu;";
2049 std::set<RowID> idSet;
2050 while (queryResult->
hasNext()) {
2051 queryResult->
next();
2069 string query =
"SELECT id AS 'rf.id' FROM rf;";
2081 std::set<RowID> idSet;
2082 while (queryResult->
hasNext()) {
2083 queryResult->
next();
2101 string query =
"SELECT id AS 'bus.id' FROM bus;";
2113 std::set<RowID> idSet;
2114 while (queryResult->
hasNext()) {
2115 queryResult->
next();
2133 string query =
"SELECT id AS 'socket.id' FROM socket;";
2145 std::set<RowID> idSet;
2146 while (queryResult->
hasNext()) {
2147 queryResult->
next();
2168 std::string(
"SELECT id FROM fu_architecture;"));
2174 std::set<RowID> idSet;
2197 std::string(
"SELECT id FROM operation_implementation;"));
2203 std::set<RowID> idSet;
2225 std::string(
"SELECT id FROM operation_implementation_resource;"));
2231 std::set<RowID> idSet;
2252 std::string(
"SELECT * FROM operation_implementation WHERE id = ") +
2253 std::to_string(
id) +
2283 std::string(
"SELECT block_source_file.file "
2284 "FROM operation_implementation_source_file, "
2285 "block_source_file "
2286 "WHERE operation_implementation_source_"
2287 "file.operation = ") +
2288 std::to_string(
id) +
2289 std::string(
" AND operation_implementation_source_file.file = "
2290 " block_source_file.id"
2291 " AND block_source_file.format = "
2309 std::string(
"SELECT block_source_file.file "
2310 "FROM operation_implementation_source_file, "
2311 "block_source_file "
2312 "WHERE operation_implementation_"
2313 "source_file.operation = ") +
2314 std::to_string(
id) +
2315 std::string(
" AND operation_implementation_source_file.file = "
2316 " block_source_file.id"
2317 " AND block_source_file.format = "
2333 std::string q1 =
"SELECT resource, count "
2334 "FROM operation_implementation_resources "
2335 "WHERE operation_implementation_resources.operation = "
2336 + std::to_string(
id) +
";";
2347 std::string q2 =
"SELECT name, width, type, language "
2348 "FROM operation_implementation_variable "
2349 "WHERE CAST(operation as TEXT) = \"" + std::to_string(
id) +
"\";";
2362 if (lang ==
"VHDL") {
2363 Variable var = {name, width, type, rename};
2365 }
else if (lang ==
"Verilog") {
2367 Variable{name, width, type, rename});
2369 throw std::runtime_error(
"Unknown language");
2374 "operation_implementation_globalsignal")) {
2376 "SELECT name, width, type, language, rename "
2377 "FROM operation_implementation_globalsignal "
2378 "WHERE CAST(operation as TEXT) = \"" +
2379 std::to_string(
id) +
"\";";
2388 bool rename = renamestr !=
"0";
2389 if (lang ==
"VHDL") {
2390 Variable var = {name, width, type, rename};
2392 }
else if (lang ==
"Verilog") {
2394 Variable{name, width, type, rename});
2396 throw std::runtime_error(
"Unknown language");
2414 std::string(
"SELECT * FROM "
2415 "operation_implementation_resource WHERE id = ") +
2416 std::to_string(
id) +
2436 std::string(
"SELECT block_source_file.file, "
2438 "FROM operation_implementation_resource_"
2439 "source_file, block_source_file, "
2441 "WHERE operation_implementation_resource_"
2442 "source_file.resource = ") +
2443 std::to_string(
id) +
2444 std::string(
" AND operation_implementation_resource_"
2445 "source_file.file = "
2446 " block_source_file.id "
2447 "AND block_source_file.format = "
2487 "INSERT INTO operation_implementation_resource(id,name,ipxact) "
2488 "VALUES (NULL, \"" +
2489 resource.
name +
"\", \"" + resource.
ipxact+
"\");"));
2493 auto f = resource.
simFiles.begin();
2494 for (; f != resource.
simFiles.end(); ++f, ++t) {
2499 "INSERT INTO block_source_file(id,file,format) "
2500 "VALUES (NULL, \"" + *f +
"\","
2501 + std::to_string(type) +
2507 "INSERT INTO operation_implementation_resource_source_file"
2508 "(id,resource,file) "
2509 "VALUES (NULL, " + std::to_string(resourceID) +
", "
2510 + std::to_string(fileID) +
2515 auto sf = resource.
synFiles.begin();
2516 for (; sf != resource.
synFiles.end(); ++sf, ++st) {
2521 "INSERT INTO block_source_file(id,file,format) "
2522 "VALUES (NULL, \"" + *sf +
"\","
2523 + std::to_string(type) +
2529 "INSERT INTO operation_implementation_resource_source_file"
2530 "(id,resource,file) "
2531 "VALUES (NULL, " + std::to_string(resourceID) +
", "
2532 + std::to_string(fileID) +
2545 std::string i1 =
"INSERT INTO operation_implementation(id,name,latency,"
2546 "post_op_vhdl,post_op_verilog,bus_definition,"
2547 "initial_vhdl,initial_verilog) "
2548 "VALUES (NULL,\"" + operation.
name +
"\","
2549 + std::to_string(operation.
latency) +
","
2559 for (
const auto r : operation.
resources) {
2560 std::string i2 =
"INSERT INTO operation_implementation_resources("
2561 "id, operation, resource, count) "
2562 "VALUES (NULL, " + std::to_string(newid)
2563 +
", " + std::to_string(r.id)
2564 +
", " + std::to_string(r.count)
2570 std::string i2 =
"INSERT INTO operation_implementation_variable("
2571 "id, operation, name, width, type, language) "
2572 "VALUES (NULL, " + std::to_string(newid)
2573 +
", \"" + r.name +
"\""
2574 +
", \"" + r.width +
"\""
2575 +
", \"" + r.type +
"\""
2581 std::string i2 =
"INSERT INTO operation_implementation_variable("
2582 "id, operation, name, width, type, language) "
2583 "VALUES (NULL, " + std::to_string(newid)
2584 +
", \"" + r.name +
"\""
2585 +
", \"" + r.width +
"\""
2586 +
", \"" + r.type +
"\""
2587 +
", \"Verilog\");";
2591 std::string i3 =
"INSERT INTO block_source_file(id,file,format) "
2597 std::string i4 =
"INSERT INTO "
2598 "operation_implementation_source_file(id, operation, file) "
2599 "VALUES (NULL, " + std::to_string(newid) +
2600 ", " + std::to_string(vhdl) +
2604 std::string i5 =
"INSERT INTO block_source_file(id,file,format) "
2610 std::string i6 =
"INSERT INTO "
2611 "operation_implementation_source_file(id, operation, file) "
2612 "VALUES (NULL, " + std::to_string(newid) +
2613 ", " + std::to_string(verilog) +
2623 std::string d1 =
"DELETE FROM operation_implementation "
2624 "WHERE id = " + std::to_string(
id) +
";";
2626 "DELETE FROM operation_implementation_source_file "
2627 "WHERE operation = " + std::to_string(
id) +
";";
2629 "DELETE FROM operation_implementation_resources "
2630 "WHERE operation = " + std::to_string(
id) +
";";
2632 "DELETE FROM operation_implementation_variable "
2633 "WHERE operation = " + std::to_string(
id) +
";";
2634 std::string s1 =
"SELECT file FROM "
2635 "operation_implementation_source_file "
2636 "WHERE operation = " + std::to_string(
id) +
";";
2642 std::string d3lete =
"DELETE FROM block_source_file "
2643 "WHERE id = " + std::to_string(file_id) +
";";
2659 std::string d1 =
"DELETE FROM operation_implementation_resource "
2660 "WHERE id = " + std::to_string(
id) +
";";
2662 "DELETE FROM operation_implementation_resource_source_file "
2663 "WHERE resource = " + std::to_string(
id) +
";";
2664 std::string s1 =
"SELECT file FROM "
2665 "operation_implementation_resource_source_file "
2666 "WHERE resource = " + std::to_string(
id) +
";";
2672 std::string d3 =
"DELETE FROM block_source_file "
2673 "WHERE id = " + std::to_string(file_id) +
";";
2685 const std::set<std::string>& operationNames)
const {
2689 std::string operationQuery =
"(";
2690 std::set<string>::const_iterator iter = operationNames.begin();
2691 while (iter != operationNames.end()) {
2694 "operation.name LIKE '" + *iter +
"'";
2696 if (iter != operationNames.end()) {
2697 operationQuery +=
" OR ";
2700 operationQuery +=
")";
2701 if (operationQuery ==
"()") {
2702 return std::set<RowID>();
2705 std::string(
"SELECT fu_architecture.id FROM operation_pipeline,"
2706 "operation, fu_architecture WHERE "
2707 "operation.id=operation_pipeline.operation AND "
2708 "operation_pipeline.fu_arch=fu_architecture.id AND "
2710 "GROUP BY fu_architecture.id ORDER BY "
2711 "fu_architecture.id;"));
2713 std::string eMsg =
", HDB file where error occurred was: " +
hdbFile_;
2718 std::set<RowID> idSet;
2739 std::string(
"SELECT id FROM rf_architecture;"));
2745 std::set<RowID> idSet;
2770 "SELECT fu from fu_implementation WHERE id=" +
2801 "SELECT rf from rf_implementation WHERE id=" +
2829 std::string query =
"SELECT architecture FROM fu WHERE id=";
2840 bool hasArch =
false;
2853 std::ostringstream stream;
2854 stream <<
"FU entry with id " <<
id <<
" not found from hdb "
2886 std::string query =
"SELECT architecture FROM rf WHERE id=";
2897 bool hasArch =
false;
2947 architecture->
setID(
id);
2950 return architecture;
2976 int sizeColumn = architectureData->
column(
"size");
2977 int widthColumn = architectureData->
column(
"width");
2978 int readPortsColumn = architectureData->
column(
"read_ports");
2979 int writePortsColumn = architectureData->
column(
"write_ports");
2980 int bidirPortsColumn = architectureData->
column(
"bidir_ports");
2981 int latencyColumn = architectureData->
column(
"latency");
2982 int maxReadsColumn = architectureData->
column(
"max_reads");
2983 int maxWritesColumn = architectureData->
column(
"max_writes");
2984 int guardSupportColumn = architectureData->
column(
"guard_support");
2985 int guardLatencyColumn = architectureData->
column(
"guard_latency");
2986 int zeroRegisterColumn = architectureData->
column(
"zero_register");
2989 architectureData->
next();
2992 const DataObject& widthData = architectureData->
data(widthColumn);
3006 guardSupportColumn);
3008 guardLatencyColumn);
3010 zeroRegisterColumn);
3018 architecture->
setID(
id);
3019 if (!sizeData.
isNull()) {
3022 if (!widthData.
isNull()) {
3025 delete architectureData;
3026 return architecture;
3043 std::set<RowID> architectureIDs;
3044 std::set<RowID> entryIDs;
3051 "SELECT fu_arch FROM operation_pipeline,operation "
3053 "\" AND operation_pipeline.operation=operation.id";
3055 query +=
" INTERSECT ";
3064 while (queryResult->
hasNext()) {
3065 queryResult->
next();
3069 architectureIDs.insert(arch->
id());
3076 if (!architectureIDs.empty()) {
3078 string fuEntryQuery =
"SELECT id FROM fu WHERE ";
3079 for (std::set<RowID>::const_iterator iter =
3080 architectureIDs.begin();
3081 iter != architectureIDs.end(); iter++) {
3082 fuEntryQuery +=
"architecture=" +
3084 std::set<RowID>::const_iterator nextIter = iter;
3086 if (nextIter == architectureIDs.end()) {
3087 fuEntryQuery +=
";";
3089 fuEntryQuery +=
" OR ";
3095 while (fuEntryResult->
hasNext()) {
3096 fuEntryResult->
next();
3101 delete fuEntryResult;
3144 bool zeroRegister)
const {
3148 string query =
"SELECT rf.id FROM rf,rf_architecture "
3149 "WHERE rf_architecture.read_ports=" +
3151 " AND rf_architecture.write_ports=" +
3153 " AND rf_architecture.bidir_ports=" +
3155 " AND rf_architecture.max_reads>=" +
3157 " AND rf_architecture.max_writes>=" +
3159 " AND rf_architecture.latency=" +
3162 query +=
" AND rf_architecture.guard_support=" +
3164 " AND rf_architecture.guard_latency=" +
3168 query +=
" AND (rf_architecture.size=" +
3170 " OR rf_architecture.size is NULL)";
3173 query +=
" AND (rf_architecture.width=" +
3175 " OR rf_architecture.width is NULL)";
3177 query +=
" AND (rf_architecture.zero_register=" +
3179 if (!zeroRegister) {
3180 query +=
" OR rf_architecture.zero_register is NULL";
3183 query +=
" AND rf.architecture=rf_architecture.id;";
3190 std::set<RowID> entryIDs;
3212 const std::string& valueName,
3213 const std::string& value,
3214 RowID pluginID)
const {
3223 "INSERT INTO cost_estimation_data (id,plugin_reference,"
3224 "fu_reference,name,value) VALUES (NULL," +
3248 const std::string& valueName,
3249 const std::string& value,
3250 RowID pluginID)
const {
3258 "INSERT INTO cost_estimation_data (id,plugin_reference,"
3259 "rf_reference,name,value) VALUES (NULL," +
3290 const std::string& valueName,
RowID implementationId,
3291 const std::string& pluginName)
const {
3298 "FROM cost_estimation_data, cost_function_plugin "
3299 "WHERE plugin_reference = cost_function_plugin.id AND "
3300 "cost_function_plugin.name LIKE('") +
3301 pluginName +
"') " +
3302 " AND rf_reference IS NULL " +
3303 " AND bus_reference IS NULL " +
3304 " AND socket_reference IS NULL AND " +
3306 " AND cost_estimation_data.name LIKE('" + valueName +
"');");
3314 queryResult->
next();
3346 const std::string& valueName,
RowID implementationId,
3347 const std::string& pluginName)
const {
3354 "FROM cost_estimation_data, cost_function_plugin "
3355 "WHERE plugin_reference = cost_function_plugin.id AND "
3356 "cost_function_plugin.name LIKE('") +
3357 pluginName +
"') " +
3358 " AND fu_reference IS NULL " +
3359 " AND bus_reference IS NULL " +
3360 " AND socket_reference IS NULL AND " +
3362 " AND cost_estimation_data.name LIKE('" + valueName +
"');");
3370 queryResult->
next();
3396 std::string(
"INSERT INTO bus(id) VALUES(NULL);"));
3429 "SELECT id FROM cost_estimation_data "
3467 const std::string& valueName,
3468 const std::string& value,
3469 RowID pluginID)
const {
3478 "INSERT INTO cost_estimation_data (id,plugin_reference,"
3479 "bus_reference,name,value) VALUES (NULL," +
3507 const std::string& valueName,
RowID busID,
3508 const std::string& pluginName)
const {
3514 "FROM cost_estimation_data, cost_function_plugin "
3515 "WHERE plugin_reference = cost_function_plugin.id AND "
3516 "cost_function_plugin.name LIKE('") +
3517 pluginName +
"') " +
3518 " AND rf_reference IS NULL " +
3519 " AND socket_reference IS NULL AND " +
3521 " AND cost_estimation_data.name LIKE('" + valueName +
"');");
3529 queryResult->
next();
3557 const std::string& valueName,
RowID busID,
3558 const std::string& pluginName)
const {
3564 "FROM cost_estimation_data, cost_function_plugin "
3565 "WHERE plugin_reference = cost_function_plugin.id AND "
3566 "cost_function_plugin.name LIKE('") +
3567 pluginName +
"') " +
3568 " AND rf_reference IS NULL " +
3569 " AND socket_reference IS NULL AND " +
3571 " AND cost_estimation_data.name LIKE('" + valueName +
"');");
3582 while (queryResult->
hasNext()) {
3583 queryResult->
next();
3585 data->push_back(value);
3609 std::string(
"INSERT INTO socket(id) VALUES(NULL);"));
3642 "SELECT id FROM cost_estimation_data "
3660 "DELETE FROM socket "
3680 const std::string& valueName,
3681 const std::string& value,
3682 RowID pluginID)
const {
3691 "INSERT INTO cost_estimation_data (id,plugin_reference,"
3692 "socket_reference,name,value) VALUES (NULL," +
3719 const std::string& valueName,
RowID socketID,
3720 const std::string& pluginName)
const {
3724 std::string theQuery =
3727 "FROM cost_estimation_data, cost_function_plugin "
3728 "WHERE plugin_reference = cost_function_plugin.id AND "
3729 "cost_function_plugin.name LIKE('") +
3730 pluginName +
"') " +
3731 " AND rf_reference IS NULL " +
3732 " AND bus_reference IS NULL AND " +
3733 " socket_reference = " +
3735 " AND cost_estimation_data.name LIKE('" + valueName +
"');";
3745 queryResult->
next();
3773 const std::string& valueName,
RowID socketID,
3774 const std::string& pluginName)
const {
3780 "FROM cost_estimation_data, cost_function_plugin "
3781 "WHERE plugin_reference = cost_function_plugin.id AND "
3782 "cost_function_plugin.name LIKE('") +
3783 pluginName +
"') " +
3784 " AND rf_reference IS NULL " +
3785 " AND bus_reference IS NULL AND " +
3786 " socket_reference = " +
3788 " AND cost_estimation_data.name LIKE('" + valueName +
"');");
3799 while (queryResult->
hasNext()) {
3800 queryResult->
next();
3802 data->push_back(value);
3832 const std::string& valueName,
const std::string& pluginName)
const {
3836 std::string theQuery =
3839 "FROM cost_estimation_data, cost_function_plugin "
3840 "WHERE plugin_reference = cost_function_plugin.id AND "
3841 "cost_function_plugin.name LIKE('") +
3842 pluginName +
"') " +
3843 " AND rf_reference IS NULL " +
3844 " AND fu_reference IS NULL " +
3845 " AND socket_reference IS NULL " +
3846 " AND bus_reference IS NULL " +
3847 " AND cost_estimation_data.name LIKE('" + valueName +
"');";
3857 queryResult->
next();
3886 std::string theQuery =
3889 "FROM cost_estimation_data "
3890 "WHERE cost_estimation_data.id = ") +
3902 queryResult->
next();
4038 std::string query =
"SELECT id FROM cost_estimation_data WHERE id=";
4067 std::string query =
"SELECT id FROM cost_function_plugin WHERE id=";
4102 "SELECT architecture FROM fu WHERE id=" +
4134 "SELECT architecture FROM rf WHERE id=" +
4163 "SELECT * FROM operation WHERE lower(name)=lower(\"" + opName
4165 bool returnValue = result->
hasNext();
4189 "SELECT * FROM block_source_file WHERE file=\"" +
4190 pathToFile +
"\";"));
4191 bool returnValue = result->
hasNext();
4217 "SELECT id FROM fu_architecture WHERE id=" +
4219 bool returnValue = result->
hasNext();
4244 "SELECT id FROM rf_architecture WHERE id=" +
4246 bool returnValue = result->
hasNext();
4273 "SELECT architecture FROM fu WHERE id=" +
4310 "SELECT architecture FROM rf WHERE id=" +
4343 const std::string& table,
const std::string& columnName)
const {
4345 std::string table_info_query(
"PRAGMA table_info(");
4346 table_info_query += table;
4347 table_info_query +=
");";
4361 std::string columnNameFromTable = columnData.
stringValue();
4363 assert(!columnNameFromTable.empty());
4364 if(columnNameFromTable == columnName) {
4381 const std::string& newcolumn) {
4382 std::string add_column_query(
"ALTER TABLE ");
4383 add_column_query += table +
" ADD COLUMN " + newcolumn;
4384 add_column_query +=
" INTEGER DEFAULT 0;";
4419 int portIDColumnIndex = fuPorts->
column(
"fu_data_port.id");
4420 int triggersColumnIndex = fuPorts->
column(
"fu_data_port.triggers");
4421 int setsOpcodeColumnIndex = fuPorts->
column(
"fu_data_port.sets_opcode");
4422 int guardSupportColumnIndex = fuPorts->
column(
4423 "fu_data_port.guard_support");
4424 int widthColumnIndex = fuPorts->
column(
"fu_data_port.width");
4425 int operationColumnIndex = fuPorts->
column(
"operation.name");
4426 int bindingColumnIndex = fuPorts->
column(
"io_binding.io_number");
4444 std::map<int, std::string> portIDMap;
4452 const DataObject& triggersData = fuPorts->
data(triggersColumnIndex);
4454 setsOpcodeColumnIndex);
4455 const DataObject& guardData = fuPorts->
data(guardSupportColumnIndex);
4458 operationColumnIndex);
4459 const DataObject& bindingData = fuPorts->
data(bindingColumnIndex);
4464 string operationName = operationData.
stringValue();
4471 bool triggers = triggersData.
boolValue();
4472 bool setsOpcode = setsOpcodeData.
boolValue();
4476 if (widthData.
isNull()) {
4481 new FUPort(portName, width, fu, triggers, setsOpcode);
4483 std::pair<int, string>(idData.
integerValue(), portName));
4484 if (setsOpcode && !triggers)
4486 std::string(
"Created a suspicious port ") + portName +
4487 " which sets opcode but does not trigger");
4499 MapTools::valueForKey<string>(portIDMap, portID));
4530 int operationColumn = ioUsageData->
column(
"operation.name");
4531 int cycleColumn = ioUsageData->
column(
"io_usage.cycle");
4532 int ioColumn = ioUsageData->
column(
"io_usage.io_number");
4533 int actionColumn = ioUsageData->
column(
"io_usage.action");
4535 while (ioUsageData->
hasNext()) {
4536 ioUsageData->
next();
4537 const DataObject& operationData = ioUsageData->
data(operationColumn);
4542 string operationName = operationData.
stringValue();
4567 operationColumn = resUsageData->
column(
"operation.name");
4568 cycleColumn = resUsageData->
column(
"pipeline_resource_usage.cycle");
4569 int resourceColumn = resUsageData->
column(
"pipeline_resource.id");
4571 int resourceName(0);
4572 std::map<int, string> resourceMap;
4574 while (resUsageData->
hasNext()) {
4575 resUsageData->
next();
4579 const DataObject& resourceData = resUsageData->
data(resourceColumn);
4581 string operationName = operationData.
stringValue();
4590 std::pair<int, string>(
4595 MapTools::valueForKey<string>(
4596 resourceMap, resourceID), cycle, 1);
4599 delete resUsageData;
4600 resUsageData = NULL;
4627 std::string(
"query ") + queryString +
" threw something: " +
4638 int idColumn = implData->
column(
"fu_implementation.id");
4639 int nameColumn = implData->
column(
"fu_implementation.name");
4640 int opcodePortColumn = implData->
column(
4641 "fu_implementation.opcode_port");
4642 int clkPortColumn = implData->
column(
"fu_implementation.clk_port");
4643 int rstPortColumn = implData->
column(
"fu_implementation.rst_port");
4644 int glockPortColumn = implData->
column(
4645 "fu_implementation.glock_port");
4646 int glockReqPortColumn = implData->
column(
4647 "fu_implementation.glock_req_port");
4651 const DataObject& opcodePortData = implData->
data(opcodePortColumn);
4654 const DataObject& glockPortData = implData->
data(glockPortColumn);
4656 glockReqPortColumn);
4664 string glockReqPort = glockReqPortData.
stringValue();
4667 name, opcodePort, clkPort, rstPort, glockPort, glockReqPort);
4697 "SELECT cost_function_plugin.id AS id, "
4698 " cost_function_plugin.description AS description,"
4699 " cost_function_plugin.name AS name, "
4700 " cost_function_plugin.plugin_file_path AS plugin_file_path "
4701 "FROM cost_function_plugin, fu "
4703 " AND cost_function_plugin.id = fu.cost_function;");
4713 queryResult->
next();
4716 queryResult->
data(
"id");
4718 queryResult->
data(
"description");
4720 queryResult->
data(
"name");
4722 queryResult->
data(
"plugin_file_path");
4725 string description =
"";
4727 string pluginFilePath =
"";
4729 if (!pluginIdData.
isNull()) {
4734 pluginFilePath = pluginFilePathData.
stringValue();
4737 std::string(
"Something wrong with conversion: ") +
4745 pluginId, description, name, pluginFilePath,
4751 return costFunction;
4769 "SELECT cost_function_plugin.id AS id, "
4770 " cost_function_plugin.description AS description,"
4771 " cost_function_plugin.name AS name, "
4772 " cost_function_plugin.plugin_file_path AS plugin_file_path "
4773 "FROM cost_function_plugin, rf "
4775 " AND cost_function_plugin.id = rf.cost_function;");
4785 queryResult->
next();
4788 queryResult->
data(
"id");
4790 queryResult->
data(
"description");
4792 queryResult->
data(
"name");
4794 queryResult->
data(
"plugin_file_path");
4797 string description =
"";
4799 string pluginFilePath =
"";
4801 if (!pluginIdData.
isNull()) {
4806 pluginFilePath = pluginFilePathData.
stringValue();
4809 std::string(
"Something wrong with conversion: ") +
4817 pluginId, description, name, pluginFilePath,
4823 return costFunction;
4841 if(
hasColumn(
"rf_implementation",
"sac_param")) {
4856 if (implementationData->
hasNext()) {
4857 implementationData->
next();
4859 int idColumn = implementationData->
column(
"id");
4860 int nameColumn = implementationData->
column(
"name");
4861 int sizeParamColumn = implementationData->
column(
"size_param");
4862 int widthParamColumn = implementationData->
column(
"width_param");
4863 int sacParamColumn = implementationData->
column(
"sac_param");
4864 int clkPortColumn = implementationData->
column(
"clk_port");
4865 int rstPortColumn = implementationData->
column(
"rst_port");
4866 int glockPortColumn = implementationData->
column(
"glock_port");
4867 int guardPortColumn = implementationData->
column(
"guard_port");
4870 const DataObject& nameData = implementationData->
data(nameColumn);
4897 sizeParam, widthParam, guardPort, sacParam);
4906 delete implementationData;
4907 implementationData = NULL;
4925 const std::string& implementedPort)
const {
4935 int operationColumn = bindingData->
column(
"operation.name");
4936 int ioColumn = bindingData->
column(
"io_binding.io_number");
4941 string portName =
"";
4943 while (bindingData->
hasNext()) {
4944 bindingData->
next();
4945 const DataObject& operationData = bindingData->
data(operationColumn);
4947 string operationName = operationData.
stringValue();
4952 assert(portName ==
"" || portName == port->
name());
4953 portName = port->
name();
4973 RowID entryID)
const {
4981 int operationColumn = opcodeData->
column(
"operation.name");
4982 int opcodeColumn = opcodeData->
column(
"opcode_map.opcode");
4983 while (opcodeData->
hasNext()) {
5009 RowID entryID)
const {
5018 int portNameColumn = portData->
column(
"fu_port_map.name");
5019 int widthFormulaColumn = portData->
column(
"fu_port_map.width_formula");
5020 int loadPortColumn = portData->
column(
"fu_port_map.load_port");
5021 int guardPortColumn = portData->
column(
"fu_port_map.guard_port");
5027 widthFormulaColumn);
5029 const DataObject& guardPortData = portData->
data(guardPortColumn);
5032 string widthFormula = widthFormulaData.
stringValue();
5036 architecture, entryID, portName);
5038 portName, architecturePort, widthFormula, loadPort, guardPort,
5057 RowID entryID)
const {
5066 int extPortNameColumn = extPortData->
column(
"fu_external_port.name");
5067 int directionColumn = extPortData->
column(
5068 "fu_external_port.direction");
5069 int extPortWidthFormulaColumn = extPortData->
column(
5070 "fu_external_port.width_formula");
5071 int descriptionColumn = extPortData->
column(
5072 "fu_external_port.description");
5074 while (extPortData->
hasNext()) {
5075 extPortData->
next();
5081 extPortWidthFormulaColumn);
5086 string widthFormula = widthFormulaData.
stringValue();
5087 string description = descriptionData.
stringValue();
5112 "SELECT fu_implementation_parameter.name FROM "
5113 "fu_implementation_parameter, fu_external_port, "
5114 "fu_ext_port_parameter_dependency, fu_implementation "
5115 "WHERE fu_implementation.fu=" +
5117 " AND fu_external_port.fu_impl=fu_implementation.id AND "
5118 "fu_external_port.name=\"" + port.
name() +
5119 "\" AND fu_ext_port_parameter_dependency.port="
5120 "fu_external_port.id AND fu_implementation_parameter.id="
5121 "fu_ext_port_parameter_dependency.parameter;"));
5145 RowID entryID)
const {
5158 int extPortNameColumn = extPortData->
column(
"rf_external_port.name");
5159 int directionColumn = extPortData->
column(
5160 "rf_external_port.direction");
5161 int extPortWidthFormulaColumn = extPortData->
column(
5162 "rf_external_port.width_formula");
5163 int descriptionColumn = extPortData->
column(
5164 "rf_external_port.description");
5166 while (extPortData->
hasNext()) {
5167 extPortData->
next();
5173 extPortWidthFormulaColumn);
5178 string widthFormula = widthFormulaData.
stringValue();
5179 string description = descriptionData.
stringValue();
5208 "SELECT rf_implementation_parameter.name FROM "
5209 "rf_implementation_parameter, rf_external_port, "
5210 "rf_ext_port_parameter_dependency, rf_implementation "
5211 "WHERE rf_implementation.rf=" +
5213 " AND rf_external_port.rf_impl=rf_implementation.id AND "
5214 "rf_external_port.name=\"" + port.
name() +
5215 "\" AND rf_ext_port_parameter_dependency.port="
5216 "rf_external_port.id AND rf_implementation_parameter.id="
5217 "rf_ext_port_parameter_dependency.parameter;"));
5242 RowID entryID)
const {
5276 RowID entryID)
const {
5339 RowID entryID)
const {
5349 int fileColumn = sourceFileData->
column(
"block_source_file.file");
5350 int formatColumn = sourceFileData->
column(
"format.format");
5352 while (sourceFileData->
hasNext()) {
5353 sourceFileData->
next();
5364 delete sourceFileData;
5365 sourceFileData = NULL;
5379 RowID entryID)
const {
5391 int portNameColumn = portData->
column(
"name");
5392 int directionColumn = portData->
column(
"direction");
5393 int loadPortColumn = portData->
column(
"load_port");
5394 int opcodePortColumn = portData->
column(
"opcode_port");
5395 int opcodePortFormulaColumn = portData->
column(
5396 "opcode_port_width_formula");
5413 opcodePortFormulaColumn);
5445 RowID entryID)
const {
5454 int fileColumn = result->
column(
"block_source_file.file");
5455 int formatColumn = result->
column(
"format.format");
5483 "DELETE FROM cost_estimation_data "
5503 "INSERT INTO block_source_file(id,file,format) "
5505 "\",(SELECT id FROM format WHERE format=\"" +
5527 std::map<const FUPort*, const FUPort*> portMap;
5530 std::pair<const FUPort*, const FUPort*>(
5550 if (operation->
isBound(*port)) {
5551 int io = operation->
io(*port);
5553 if (samePort == NULL) {
5556 const FUPort* existingSamePort =
5557 MapTools::valueForKey<const FUPort*>(portMap, port);
5558 if (existingSamePort != NULL &&
5559 existingSamePort != samePort) {
5573 portMap.erase(port);
5575 std::pair<const FUPort*, const FUPort*>(port, samePort));
5582 for (
int cycle = 0; cycle < operation->
latency(); cycle++) {
5587 if (written1 != written2) {
5594 if (read1 != read2) {
5602 usage.
usage1.insert(elem);
5606 for (
int i = 0; i < arch.
architecture().pipelineElementCount();
5611 usage.
usage2.insert(elem);
5615 plineElementUsages.push_back(usage);
5636 for (
size_t i = 0; i < table.size(); i++) {
5637 std::set<const PipelineElement*> usedResources1 = table[i].usage1;
5640 std::set<size_t> illegalStages1;
5641 for (
size_t usageIndex = 0; usageIndex < table.size();
5643 if (usageIndex == i) {
5646 std::set<const PipelineElement*> resources =
5647 table[usageIndex].usage1;
5648 std::set<const PipelineElement*> intersect;
5650 if (!intersect.empty()) {
5651 illegalStages1.insert(usageIndex);
5656 std::set<const PipelineElement*> usedResources2 = table[i].usage2;
5657 std::set<size_t> illegalStages2;
5658 for (
size_t usageIndex = 0; usageIndex < table.size();
5660 if (usageIndex == i) {
5663 std::set<const PipelineElement*> resources =
5664 table[usageIndex].usage2;
5665 std::set<const PipelineElement*> intersect;
5667 if (!intersect.empty()) {
5668 illegalStages2.insert(usageIndex);
5672 std::set<size_t> difference;
5674 if (!difference.empty()) {
5693 "INSERT INTO format(id,format) VALUES(1,\"" +
5697 "INSERT INTO format(id,format) VALUES(2,\"" +
5764 }
else if (direction ==
HDB::OUT) {
5786 "WHERE fu.id=" + idString +
";";
5805 "WHERE rf.id=" + idString +
";";
5824 "WHERE bus.id=" + idString +
";";
5843 "WHERE socket.id=" + idString +
";";
5861 "FROM fu, fu_architecture "
5862 "WHERE fu.id=" + idString +
" AND"
5863 " fu_architecture.id = fu.architecture;";
5883 "SELECT fu_data_port.id AS 'fu_data_port.id',"
5884 " fu_data_port.triggers AS 'fu_data_port.triggers',"
5885 " fu_data_port.sets_opcode AS 'fu_data_port.sets_opcode',"
5886 " fu_data_port.guard_support AS 'fu_data_port.guard_support',"
5887 " fu_data_port.width AS 'fu_data_port.width',"
5888 " operation.name AS 'operation.name',"
5889 " io_binding.io_number AS 'io_binding.io_number' "
5890 "FROM fu_data_port, io_binding, operation "
5891 "WHERE fu_data_port.fu_arch=" + idString +
" AND"
5892 " io_binding.port=fu_data_port.id AND"
5893 " io_binding.operation=operation.id;";
5911 "SELECT operation.name AS 'operation.name',"
5912 " io_usage.cycle AS 'io_usage.cycle',"
5913 " io_usage.io_number AS 'io_usage.io_number',"
5914 " io_usage.action AS 'io_usage.action' "
5915 "FROM operation_pipeline, io_usage, operation "
5916 "WHERE operation_pipeline.fu_arch=" + idString +
" AND"
5917 " io_usage.pipeline=operation_pipeline.id AND"
5918 " operation.id=operation_pipeline.operation;";
5936 "SELECT operation.name AS 'operation.name',"
5937 " pipeline_resource_usage.cycle AS "
5938 " 'pipeline_resource_usage.cycle',"
5939 " pipeline_resource.id AS 'pipeline_resource.id' "
5940 "FROM pipeline_resource_usage, pipeline_resource, operation,"
5941 " operation_pipeline "
5942 "WHERE operation_pipeline.fu_arch=" + idString +
" AND"
5943 " pipeline_resource_usage.pipeline=operation_pipeline.id AND"
5944 " pipeline_resource.id = pipeline_resource_usage.resource AND"
5945 " operation.id=operation_pipeline.operation;";
5965 "SELECT fu_implementation.id AS 'fu_implementation.id',"
5966 " fu_implementation.name AS 'fu_implementation.name',"
5967 " fu_implementation.opcode_port AS "
5968 "'fu_implementation.opcode_port',"
5969 " fu_implementation.clk_port AS 'fu_implementation.clk_port',"
5970 " fu_implementation.rst_port AS 'fu_implementation.rst_port',"
5971 " fu_implementation.glock_port AS "
5972 " 'fu_implementation.glock_port',"
5973 " fu_implementation.glock_req_port AS "
5974 " 'fu_implementation.glock_req_port' "
5975 "FROM fu, fu_implementation "
5976 "WHERE fu.id=" + idString +
" AND"
5977 " fu_implementation.fu=fu.id;";
5994 "SELECT operation.name AS 'operation.name',"
5995 " opcode_map.opcode AS 'opcode_map.opcode' "
5996 "FROM fu, fu_implementation, operation, opcode_map "
5997 "WHERE fu.id=" + idString +
" AND"
5998 " fu_implementation.fu=fu.id AND"
5999 " opcode_map.fu_impl=fu_implementation.id AND"
6000 " operation.id=opcode_map.operation;";
6019 "SELECT fu_port_map.name AS 'fu_port_map.name',"
6020 " fu_port_map.width_formula AS 'fu_port_map.width_formula',"
6021 " fu_port_map.load_port AS 'fu_port_map.load_port',"
6022 " fu_port_map.guard_port AS 'fu_port_map.guard_port' "
6023 "FROM fu, fu_port_map, fu_implementation "
6024 "WHERE fu.id=" + idString +
" AND"
6025 " fu_implementation.fu=fu.id AND"
6026 " fu_port_map.fu_impl=fu_implementation.id;";
6046 "SELECT fu_external_port.name AS 'fu_external_port.name',"
6047 " fu_external_port.direction AS 'fu_external_port.direction',"
6048 " fu_external_port.width_formula AS "
6049 " 'fu_external_port.width_formula',"
6050 " fu_external_port.description AS "
6051 " 'fu_external_port.description' "
6052 "FROM fu, fu_implementation, fu_external_port "
6053 "WHERE fu.id=" + idString +
" AND"
6054 " fu_implementation.fu=fu.id AND"
6055 " fu_external_port.fu_impl=fu_implementation.id;";
6075 "SELECT rf_external_port.name AS 'rf_external_port.name',"
6076 " rf_external_port.direction AS 'rf_external_port.direction',"
6077 " rf_external_port.width_formula AS "
6078 " 'rf_external_port.width_formula',"
6079 " rf_external_port.description AS "
6080 " 'rf_external_port.description' "
6081 "FROM rf, rf_implementation, rf_external_port "
6082 "WHERE rf.id=" + idString +
" AND"
6083 " rf_implementation.rf=rf.id AND"
6084 " rf_external_port.rf_impl=rf_implementation.id;";
6102 "SELECT fu_implementation_parameter.name AS 'name',"
6103 " fu_implementation_parameter.type AS 'type',"
6104 " fu_implementation_parameter.value AS 'value' "
6105 "FROM fu_implementation, fu_implementation_parameter "
6106 "WHERE fu_implementation.fu=" + idString +
" AND"
6107 " fu_implementation_parameter.fu_impl=fu_implementation.id;";
6125 "SELECT rf_implementation_parameter.name AS 'name',"
6126 " rf_implementation_parameter.type AS 'type',"
6127 " rf_implementation_parameter.value AS 'value' "
6128 "FROM rf_implementation, rf_implementation_parameter "
6129 "WHERE rf_implementation.rf=" + idString +
" AND"
6130 " rf_implementation_parameter.rf_impl=rf_implementation.id;";
6148 const std::string& portName) {
6152 "SELECT operation.name AS 'operation.name',"
6153 " io_binding.io_number AS 'io_binding.io_number' "
6154 "FROM operation, io_binding, fu_port_map, fu_implementation "
6155 "WHERE fu_implementation.fu=" + idString +
" AND"
6156 " fu_port_map.fu_impl=fu_implementation.id AND"
6157 " fu_port_map.name='" + portName +
"' AND"
6158 " io_binding.port=fu_port_map.arch_port AND"
6159 " operation.id=io_binding.operation;";
6177 "SELECT block_source_file.file AS 'block_source_file.file',"
6178 " format.format AS 'format.format' "
6179 "FROM block_source_file, fu_source_file, fu_implementation, format "
6180 "WHERE fu_implementation.fu=" + idString +
" AND"
6181 " fu_source_file.fu_impl=fu_implementation.id AND"
6182 " block_source_file.id=fu_source_file.file AND"
6183 " format.id=block_source_file.format;";
6202 "FROM rf_architecture "
6203 "WHERE id=" + idString +
";";
6230 "FROM rf_implementation "
6231 "WHERE rf_implementation.rf=" + idString +
";";
6258 "FROM rf_implementation "
6259 "WHERE rf_implementation.rf=" + idString +
";";
6277 "SELECT rf_data_port.name AS 'name',"
6278 " rf_data_port.direction AS 'direction',"
6279 " rf_data_port.load_port AS 'load_port',"
6280 " rf_data_port.opcode_port AS 'opcode_port',"
6281 " rf_data_port.opcode_port_width_formula AS "
6282 " 'opcode_port_width_formula' "
6283 "FROM rf_data_port, rf_implementation "
6284 "WHERE rf_implementation.rf=" + idString +
" AND"
6285 " rf_data_port.rf_impl=rf_implementation.id;";
6303 "SELECT block_source_file.file AS 'block_source_file.file',"
6304 " format.format AS 'format.format' "
6305 "FROM block_source_file, format, rf_implementation, rf_source_file "
6306 "WHERE rf_implementation.rf=" + idString +
" AND"
6307 " rf_source_file.rf_impl=rf_implementation.id AND"
6308 " block_source_file.id=rf_source_file.file AND"
6309 " format.id=block_source_file.format;";
6327 std::string theQuery =
6329 "SELECT value, cost_estimation_data.name AS data_name, "
6330 " cost_function_plugin.id AS plugin_id, "
6331 " fu_reference, rf_reference, bus_reference, "
6332 " socket_reference "
6333 "FROM cost_estimation_data, cost_function_plugin "
6334 "WHERE cost_estimation_data.plugin_reference="
6335 " cost_function_plugin.id AND "
6336 " cost_estimation_data.id = ") +
6348 queryResult->
next();
6357 if (!queryResult->
data(
"fu_reference").
isNull()) {
6360 if (!queryResult->
data(
"rf_reference").
isNull()) {
6363 if (!queryResult->
data(
"bus_reference").
isNull()) {
6366 if (!queryResult->
data(
"socket_reference").
isNull()) {
6396 std::string theQuery =
6399 "FROM cost_estimation_data "
6400 "WHERE fu_reference = ") +
6411 std::set<RowID> ids;
6413 while (queryResult->
hasNext()) {
6414 queryResult->
next();
6437 std::string theQuery =
6440 "FROM cost_estimation_data "
6441 "WHERE rf_reference = ") +
6452 std::set<RowID> ids;
6454 while (queryResult->
hasNext()) {
6455 queryResult->
next();
6478 std::string theQuery =
6481 "FROM cost_estimation_data "
6482 "WHERE socket_reference = ") +
6493 std::set<RowID> ids;
6495 while (queryResult->
hasNext()) {
6496 queryResult->
next();
6519 std::string theQuery =
6522 "FROM cost_estimation_data "
6523 "WHERE bus_reference = ") +
6534 std::set<RowID> ids;
6536 while (queryResult->
hasNext()) {
6537 queryResult->
next();
6558 std::string theQuery =
6559 "SELECT id FROM cost_function_plugin";
6569 std::set<RowID> ids;
6571 while (queryResult->
hasNext()) {
6572 queryResult->
next();
6594 std::string theQuery =
6597 "FROM cost_estimation_data "
6598 "WHERE plugin_reference = ") +
6609 std::set<RowID> ids;
6611 while (queryResult->
hasNext()) {
6612 queryResult->
next();
6634 std::string pluginDataQuery =
6635 "SELECT id, description, name, plugin_file_path, type "
6636 " FROM cost_function_plugin WHERE id = ";
6653 std::string path = pluginData->
data(
"plugin_file_path").
stringValue();
6670 (boost::format(
"Illegal cost_function_plugin type %d.") %
6682 (boost::format(
"Cost function plugin with id %d not found.") %
6700 std::string(
"INSERT INTO cost_estimation_data"
6701 " (id, name, value, plugin_reference, "
6702 " fu_reference, rf_reference, "
6703 " bus_reference, socket_reference) VALUES (") +
6704 "NULL, '" + data.
name() +
"', '" +
6783 std::string query =
"";
6784 if (!compiledQuery) {
6793 if (compiledQuery) {
6794 result = compiledQuery;
6805 std::set<RowID> dataIDs;
6811 if (!compiledQuery) {
6814 compiledQuery->
reset();
6839 short int* queryHash,
6840 bool createBindableQuery)
const {
6845 bool firstMatch =
true;
6846 unsigned int count = 0;
6849 *query =
"SELECT id FROM cost_estimation_data WHERE ";
6857 if (compiledQuery) {
6864 *query += createBindableQuery ?
"?" : match.
name();
6874 if (compiledQuery) {
6879 if (!firstMatch) *query +=
" AND ";
6881 *query +=
"value='";
6882 *query += createBindableQuery ?
"?" : match.
name();
6892 if (compiledQuery) {
6897 if (!firstMatch) *query +=
" AND ";
6899 *query +=
"plugin_reference = ";
6900 *query += createBindableQuery ?
"?" :
6910 if (compiledQuery) {
6915 if (!firstMatch) *query +=
" AND ";
6917 *query +=
"fu_reference = ";
6918 *query += createBindableQuery ?
"?" :
6928 if (compiledQuery) {
6933 if (!firstMatch) *query +=
" AND ";
6935 *query +=
"rf_reference = ";
6936 *query += createBindableQuery ?
"?" :
6946 if (compiledQuery) {
6951 if (!firstMatch) *query +=
" AND ";
6953 *query +=
"bus_reference = ";
6954 *query += createBindableQuery ?
"?" :
6964 if (compiledQuery) {
6969 if (!firstMatch) *query +=
" AND ";
6971 *query +=
"socket_reference = ";
6972 *query += createBindableQuery ?
"?" :
7009 std::string(
"UPDATE cost_estimation_data SET ") +
7010 " name='" + data.
name() +
7019 query +=
", fu_reference=";
7022 query +=
", fu_reference=NULL";
7030 query +=
", rf_reference=";
7033 query +=
", rf_reference=NULL";
7041 query +=
", bus_reference=";
7044 query +=
", bus_reference=NULL";
7052 query +=
", socket_reference=";
7055 query +=
", socket_reference=NULL";
7058 query +=
" WHERE id=";
7082 if (plugin.
name() ==
"") {
7091 switch (plugin.
type()) {
7107 (boost::format(
"Illegal cost_function_plugin type %d.") %
7114 std::string(
"UPDATE cost_function_plugin SET ") +
7115 " name='" + plugin.
name() +
7118 "', type='" + type +
"'";
7120 query +=
" WHERE id=";
7137 std::list<std::string>
7143 std::string(
"SELECT * FROM block_source_file"));
7149 std::list<std::string> files;
7150 while (queryResult->
hasNext()) {
7151 queryResult->
next();
static std::string formatString(BlockImplementationFile::Format format)
virtual void rollback()=0
const string CQ_OPERATION_IMPLEMENTATION_VARIABLE
void addPortsAndBindingsToFUArchitecture(FUArchitecture &architecture, RowID id) const
void removeOperationImplementationResource(RowID id)
const string VERILOG_SIM_FORMAT
RowID rfReference() const
std::string clkPort() const
BlockImplementationFile & file(int index) const
void setName(const std::string &name)
std::string initialImplFileVerilog
const string CQ_OPERATION
std::string opcodePortWidthFormula() const
static void checkOperandBindings(const TTAMachine::FunctionUnit &fu, MachineValidatorResults &results)
const string CQ_RF_IMPL_ENTRY_INDEX
void createCostEstimatioDataIdsQuery(const CostEstimationData &match, std::string *query, RelationalDBQueryResult *compiledQuery=NULL, short int *queryHash=NULL, bool createBindableQuery=false) const
virtual FUArchitecture * fuArchitectureByID(RowID id) const
virtual RowID lastInsertRowID()=0
static std::string fuImplementationByIDQuery(RowID id)
const string VERILOG_FORMAT
RowID addCostFunctionPlugin(const CostFunctionPlugin &plugin) const
RowID addFUImplementation(const FUEntry &entry) const
const string CQ_RF_DATA_PORT
virtual int updateQuery(const std::string &queryString)=0
RowID addFUCostEstimationData(RowID fuID, const std::string &valueName, const std::string &value, RowID pluginID) const
CostFunctionPluginType
all supported cost function plugin types
const string CQ_PIPELINE_RESOURCE
const int DEFAULT_PORT_WIDTH
DataObjectList * busCostEstimationDataList(const std::string &valueName, RowID implementationId, const std::string &pluginName) const
virtual bool hasImplementation() const
static std::string fuExternalPortsByIDQuery(RowID id)
bool hasParameterizedWidth(const std::string &port) const
bool hasOpcode(const std::string &operation) const
static std::string rfImplementationDataPortsByIDQuery(RowID id)
bool hasSocketEntry(RowID id) const
static std::string rfSourceFilesByIDQuery(RowID id)
static std::string directionString(HDB::Direction direction)
virtual void removeFUEntry(RowID id) const
std::string description() const
virtual bool isOpcodeSetting() const
RelationalDBConnection * dbConnection_
Handle to the database connection.
static std::string busEntryByIDQuery(RowID id)
void setArchitecture(RFArchitecture *architecture)
static std::string rfImplementationByIDQuery2(RowID id)
IDF::MachineImplementation * implementation
the implementation definition of the estimated processor
virtual void bindPort(int operand, const FUPort &port)
virtual std::string stringValue() const
const string CQ_OPERATION_IMPLEMENTATION_RESOURCE_SOURCE_FILE
std::string initialImplFileVhdl
RowID addRFArchitecture(const RFArchitecture &architecture) const
std::set< RowID > costFunctionPluginIDs() const
const string CQ_FU_PORT_MAP
virtual const DataObject & data(std::size_t column) const =0
RowID addSocketEntry() const
void removeOperationImplementation(RowID id)
const string CQ_IO_BINDING
bool hasSocketReference() const
bool zeroRegister() const
std::set< RowID > costFunctionPluginDataIDs(RowID pluginID) const
bool setParameterDependency(const std::string ¶meter)
int implementationFileCount() const
std::vector< PipelineElementUsage > PipelineElementUsageTable
Format
Format of the file.
virtual void removeBusEntry(RowID id) const
RowID addFUArchitecture(const FUArchitecture &architecture) const
static const int UNKNOWN_INDEX
static std::string rfExternalPortsByIDQuery(RowID id)
const string IN_DIRECTION
TTAMachine::FunctionUnit & architecture() const
static std::string fuPortsAndBindingsByIDQuery(RowID id)
virtual void removeRFEntry(RowID id) const
std::string postOpImplFileVerilog
virtual void removeFUImplementation(RowID implementationID) const
Direction direction() const
@ COST_DECOMP
decompressor cost estimator
const std::string COST_PLUGIN_TYPE_ICDEC
RowID addRFCostEstimationData(RowID rfID, const std::string &valueName, const std::string &value, RowID pluginID) const
int RowID
Type definition of row ID in relational databases.
FUExternalPort & externalPort(int index) const
bool hasCostFunctionPluginByID(RowID id) const
void setFUReference(RowID fuEntryID)
void setRFReference(RowID rfEntryID)
void addOperationImplementation(const OperationImplementation &operation)
DataObjectList * socketCostEstimationDataList(const std::string &valueName, RowID implementationID, const std::string &pluginName) const
RowID addBusCostEstimationData(RowID busID, const std::string &valueName, const std::string &value, RowID pluginID) const
const string CQ_RF_IMPLEMENTATION
bool hasFUReference() const
OperationImplementationResource OperationImplementationResourceByID(RowID id) const
OperandSet writtenOperands(int cycle) const
bool hasParameterizedSize() const
DataObject socketCostEstimationData(const std::string &valueName, RowID socketID, const std::string &pluginName) const
const std::string COST_PLUGIN_TYPE_RF
const std::string & name() const
OperandSet readOperands(int cycle) const
std::string opcodePort() const
bool hasColumn(const std::string &table, const std::string &columnName) const
void addBlockImplementationFileToHDB(const BlockImplementationFile &file) const
virtual bool isTriggering() const
CostEstimationData costEstimationData(RowID id) const
const string CQ_RF_EXT_PORT_PARAMETER_DEPENDENCY
CostFunctionPlugin * costFunctionPluginByID(RowID pluginID) const
static std::string absolutePathOf(const std::string &pathName)
bool hasCostEstimationDataByID(RowID id) const
bool containsImplementationFile(const std::string &pathToFile) const
std::string postOpImplFileVhdl
void setValue(const DataObject &value)
static std::string toString(const T &source)
void unsetCostFunctionPluginForFU(RowID fuID) const
const string CQ_FU_DATA_PORT
virtual RelationalDBConnection & connect(const std::string &database, const std::string &login="", const std::string &password="", bool readOnly=false)
std::string hdbFile_
The HDB file to manager.
std::set< RowID > fuArchitectureIDsByOperationSet(const std::set< std::string > &operationNames) const
virtual void removeSocketEntry(RowID id) const
std::vector< Variable > verilogVariables
const string BIDIR_DIRECTION
static bool fileIsCreatable(const std::string fileName)
RowID rfEntryIDOfImplementation(RowID implID) const
std::string rstPort() const
DataObject busCostEstimationData(const std::string &valueName, RowID busID, const std::string &pluginName) const
bool containsOperation(const std::string &opName) const
DataObject rfCostEstimationData(const std::string &valueName, RowID implementationId, const std::string &pluginName) const
std::string glockReqPort() const
@ COST_FU
function unit cost estimator
std::vector< std::string > synFiles
#define assert(condition)
int parameterCount() const
bool hasBusEntry(RowID id) const
virtual FUPort * port(int operand) const
@ COST_ICDEC
interconnection network & decoder cost estimator
virtual void modifyCostEstimationData(RowID id, const CostEstimationData &data)
const string CQ_OPERATION_IMPLEMENTATION_RESOURCE
virtual int integerValue() const
const string CQ_OPERATION_PIPELINE
void addBlockImplementationFiles(FUImplementation &implementation, RowID entryID) const
CostFunctionPlugin * createCostFunctionOfFU(RowID id) const
RowID addSocketCostEstimationData(RowID socketID, const std::string &valueName, const std::string &value, RowID pluginID) const
void setCostFunction(CostFunctionPlugin *costFunction)
std::string resolveArchitecturePort(const FUArchitecture &architecture, RowID entryID, const std::string &implementedPort) const
const string CQ_OPERATION_IMPLEMENTATION_SOURCE_FILE
std::set< RowID > OperationImplementationResourceIDs() const
virtual void updateVersion(int version)=0
std::vector< Variable > verilogGlobalSignals
static void insertFileFormats(RelationalDBConnection &connection)
RowID busReference() const
void addResourceUse(const std::string &name, int start, int duration)
void unsetArchitectureForRF(RowID rfID) const
void setParameterizedWidth(const std::string &port)
int io(const FUPort &port) const
#define abortWithError(message)
bool hasGuardSupport(const std::string &port) const
virtual bool hasArchitecture() const
std::set< RowID > fuArchitectureIDs() const
const std::string & name() const
void setBusReference(RowID busEntryID)
void addOperationImplementationResource(const OperationImplementationResource &resource)
std::vector< std::string > simFormats
const string CQ_FU_EXTERNAL_PORT
int addBooleanColumn(const std::string &table, const std::string &newcolumn)
virtual PipelineElement * pipelineElement(int index) const
const string CQ_PIPELINE_RESOURCE_USAGE
bool canRemoveFUArchitecture(RowID archID) const
void setArchitectureForRF(RowID rfID, RowID archID) const
std::string implFileVerilog
virtual void bindString(unsigned int position, const std::string &value)
std::set< RowID > fuEntryIDs() const
std::vector< std::string > simFiles
static std::string resourceUsageDataByIDQuery(RowID id)
std::string parameterDependency(int index) const
bool hasFUEntry(RowID id) const
Direction
Direction of port.
virtual DataObject costEstimationDataValue(const std::string &valueName, const std::string &pluginName) const
@ BIDIR
Bidirectional port.
FUArchitecture & architecture() const
void addFUParametersToImplementation(FUImplementation &implementation, RowID entryID) const
static void createNew(const std::string &file)
virtual RFArchitecture * rfArchitectureByID(RowID id) const
virtual bool isNull() const
static std::string fuImplementationParametersByIDQuery(RowID id)
bool hasRFEntry(RowID id) const
bool isBound(const FUPort &port) const
const string CQ_FU_ARCHITECTURE
void addPortRead(int operand, int start, int duration)
static std::string fuEntryByIDQuery(RowID id)
void addRFExternalPortsToImplementation(RFImplementation &implementation, RowID entryID) const
std::set< RowID > socketEntryIDs() const
const string CQ_FU_IMPLEMENTATION_PARAMETER
std::string type
Type of the parameter.
std::set< RowID > fuEntriesByArchitecture(const TTAMachine::FunctionUnit &fu) const
std::set< RowID > rfEntriesByArchitecture(int readPorts, int writePorts, int bidirPorts, int maxReads, int maxWrites, int latency, bool guardSupport, int guardLatency=0, int width=0, int size=0, bool zeroRegister=false) const
virtual int operationCount() const
RowID fuEntryIDOfImplementation(RowID implID) const
bool hasParameterizedWidth() const
CostFunctionPlugin * createCostFunctionOfRF(RowID id) const
const string CQ_OPERATION_IMPLEMENTATION
virtual RelationalDBQueryResult * query(const std::string &queryString, bool init=true)=0
static void checkOperations(const TTAMachine::FunctionUnit &fu, MachineValidatorResults &results)
static std::string rfEntryByIDQuery(RowID id)
RowID socketReference() const
virtual bool hasOperation(const std::string &name) const
std::string loadPort() const
void setGuardSupport(const std::string &port)
std::string pathToFile() const
static std::string socketEntryByIDQuery(RowID id)
void setCostFunctionPluginForFU(RowID fuID, RowID pluginID) const
std::set< int > OperandSet
Set for operand indexes.
virtual int operationPortCount() const
bool containsRFArchitecture(RowID id) const
std::set< RowID > busCostEstimationDataIDs(RowID busID) const
const string CQ_RF_IMPLEMENTATION_PARAMETER
RowID addBusEntry() const
void setImplementation(RFImplementation *implementation)
const string CQ_RF_ARCHITECTURE
std::list< DataObject > DataObjectList
virtual void beginTransaction()=0
std::set< RowID > busEntryIDs() const
std::string errorMessage() const
virtual void close(const RelationalDBConnection &connection)
std::set< const TTAMachine::PipelineElement * > usage1
virtual int pipelineElementCount() const
std::vector< OperationImplementationResource > resources
void addRFParametersToImplementation(RFImplementation &implementation, RowID entryID) const
void addOperationPipelinesToFUArchitecture(FUArchitecture &architecture, RowID id) const
std::set< RowID > OperationImplementationIDs() const
std::vector< Variable > vhdlVariables
@ COST_RF
register file cost estimator
RowID rfArchitectureID(RowID rfEntryID) const
std::set< RowID > rfEntryIDs() const
RowID addRFImplementation(const RFImplementation &implementation, RowID rfEntryID)
std::string absBusDefFile
virtual bool hasOperationPort(const std::string &name) const
std::set< RowID > rfArchitectureIDs() const
bool hasGuardSupport() const
bool hasBusReference() const
bool fuEntryHasArchitecture(RowID id) const
std::string name
Name of the parameter.
virtual void removeCostFunctionPlugin(RowID pluginID) const
std::string fileName() const
const string CQ_FU_EXT_PORT_PARAMETER_DEPENDENCY
const string CQ_FU_IMPLEMENTATION
static std::string opcodesByIDQuery(RowID id)
int opcode(const std::string &operation) const
virtual std::set< RowID > costEstimationDataIDs(const CostEstimationData &match, bool useCompiledQueries=false, RelationalDBQueryResult *compiledQuery=NULL) const
const string OUT_DIRECTION
std::set< RowID > socketCostEstimationDataIDs(RowID socketID) const
SQLite * db_
Handle to the database.
std::string architecturePort() const
virtual void DDLQuery(const std::string &queryString)=0
RelationalDBConnection * getDBConnection() const
OperationImplementation OperationImplementationByID(RowID id) const
virtual bool tableExistsInDB(const std::string &tableName)=0
const string CQ_FU_IMPL_ENTRY_INDEX
const string CQ_FU_SOURCE_FILE
RowID fuReference() const
@ Verilogsim
Verilog simulation file.
static std::string fuSourceFilesByIDQuery(RowID id)
void setPluginID(RowID pluginID)
virtual int column(const std::string &name) const
static bool fileExists(const std::string fileName)
RowID addCostEstimationData(const CostEstimationData &data) const
virtual std::string name() const
std::string pluginFilePath() const
virtual void bindInt(unsigned int position, int value)
Parameter parameter(int index) const
virtual void removeCostEstimationData(RowID id) const
std::string opcodePort() const
const string CQ_COST_ESTIMATION_DATA
type: {'fu'|'rf'|'decomp'|'icdec'}
virtual FUImplementation * createImplementationOfFU(FUArchitecture &architecture, RowID id) const
static std::string rfImplementationParametersByIDQuery(RowID id)
std::set< RowID > rfCostEstimationDataIDs(RowID rfImplID) const
int architecturePortCount() const
const string CQ_RF_EXTERNAL_PORT
bool hasRFReference() const
int readPortCount() const
void setImplementation(FUImplementation *implementation)
virtual void removeRFImplementation(RowID implID) const
void unsetCostFunctionPluginForRF(RowID rfID) const
bool rfEntryHasArchitecture(RowID id) const
static std::string rfArchitectureByIDQuery(RowID id)
const std::string COST_PLUGIN_TYPE_DECOMP
ExecutionPipeline * pipeline() const
std::string value
Value of the parameter.
void setSocketReference(RowID socketEntryID)
void addOpcodesToImplementation(FUImplementation &implementation, RowID entryID) const
DataObject fuCostEstimationData(const std::string &valueName, RowID implementationId, const std::string &pluginName) const
static std::string fuPortBindingByNameQuery(RowID fuID, const std::string &portName)
std::set< const TTAMachine::PipelineElement * > usage2
void addPortWrite(int operand, int start, int duration)
const string CQ_OPCODE_MAP
std::string moduleName() const
virtual HWOperation * operation(const std::string &name) const
const string CQ_OPERATION_IMPLEMENTATION_RESOURCES
std::string description() const
void addFUExternalPortsToImplementation(FUImplementation &implementation, RowID entryID) const
std::set< RowID > fuCostEstimationDataIDs(RowID fuImplID) const
virtual FUPort * operationPort(const std::string &name) const
bool canRemoveRFArchitecture(RowID archID) const
int bidirPortCount() const
void setArchitecture(FUArchitecture *architecture)
virtual bool hasImplementation() const
const string CQ_RF_SOURCE_FILE
CostFunctionPluginType type() const
virtual bool boolValue() const
FUImplementation & implementation() const
virtual void removeFUArchitecture(RowID archID) const
std::string glockPort() const
const std::string COST_PLUGIN_TYPE_FU
Possible cost function plugin types.
std::vector< Variable > vhdlGlobalSignals
std::string guardPort() const
static bool fileIsReadable(const std::string fileName)
bool containsFUArchitecture(RowID id) const
const string VHDL_SIM_FORMAT
RowID fuArchitectureID(RowID fuEntryID) const
static std::string fuImplementationDataPortsByIDQuery(RowID id)
FUEntry * fuByEntryID(RowID id) const
std::list< std::string > blockSourceFile()
Direction direction() const
static BlockImplementationFile::Format fileFormat(const std::string &formatString)
virtual void modifyCostFunctionPlugin(RowID id, const CostFunctionPlugin &plugin)
FUPortImplementation & architecturePort(int index) const
std::string widthFormula() const
static std::string ioUsageDataByIDQuery(RowID id)
const string CQ_COST_FUNCTION_PLUGIN
virtual bool hasArchitecture() const
virtual void removeRFArchitecture(RowID archID) const
void unsetArchitectureForFU(RowID fuID) const
void setHDBFile(const std::string &file)
static std::string rfImplementationByIDQuery(RowID id)
void addDataPortsToImplementation(FUImplementation &implementation, FUArchitecture &architecture, RowID entryID) const
int externalPortCount() const
int parameterDependencyCount() const
static bool isMatchingArchitecture(const TTAMachine::FunctionUnit &fu, const FUArchitecture &arch)
std::vector< std::string > synFormats
virtual int width() const
int writePortCount() const
bool isResourceUsed(const std::string &name, int cycle) const
const string CQ_BLOCK_SOURCE_FILE
void setCostFunctionPluginForRF(RowID rfID, RowID pluginID) const
static bool areCompatiblePipelines(const PipelineElementUsageTable &table)
@ VHDLsim
VHDL simulation file.
RFEntry * rfByEntryID(RowID id) const
Error error(int index) const
std::string widthFormula() const
virtual RFImplementation * createImplementationOfRF(RowID id) const
const string CQ_FU_PORT_MAP_ARCH_INDEX
void setArchitectureForFU(RowID fuID, RowID archID) const
static std::string fuArchitectureByIDQuery(RowID id)