OpenASIP 2.2
Loading...
Searching...
No Matches
HDBToHtml.cc
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2009 Tampere University.
3
4 This file is part of TTA-Based Codesign Environment (TCE).
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24/**
25 * @file HDBToHtml.cc
26 *
27 * Implementation of HDBToHtml class.
28 *
29 * @author Veli-Pekka Jääskeläinen 2006 (vjaaskel-no.spam-cs.tut.fi)
30 * @author Vinogradov Viacheslav(added Verilog generating) 2012
31 * @note rating: red
32 */
33
34#include <time.h>
35
36#include "HDBToHtml.hh"
37
38#include "ContainerTools.hh"
39
40#include "FUEntry.hh"
41#include "FUArchitecture.hh"
42#include "FUImplementation.hh"
43#include "FunctionUnit.hh"
44#include "FUPort.hh"
45#include "HWOperation.hh"
46#include "ExecutionPipeline.hh"
47#include "PipelineElement.hh"
48#include "FUExternalPort.hh"
49#include "RFExternalPort.hh"
52#include "RFEntry.hh"
53#include "RFArchitecture.hh"
54#include "RFImplementation.hh"
56#include "HDBManager.hh"
57#include "CostEstimationData.hh"
58#include "DataObject.hh"
59#include "CostFunctionPlugin.hh"
60
61using namespace TTAMachine;
62using namespace HDB;
63using std::endl;
64
65
66const std::string HDBToHtml::FU_ENTRIES = "FU Entries";
67const std::string HDBToHtml::RF_ENTRIES = "RF Entries";
68const std::string HDBToHtml::RF_IU_ENTRIES = "RF/IU Entries";
69const std::string HDBToHtml::BUS_ENTRIES = "Bus Entries";
70const std::string HDBToHtml::SOCKET_ENTRIES = "Socket Entries";
71const std::string HDBToHtml::FU_ARCHITECTURES = "Function Units";
72const std::string HDBToHtml::RF_ARCHITECTURES = "Register Files";
73const std::string HDBToHtml::FU_IMPLEMENTATIONS = "FU Implementations";
74const std::string HDBToHtml::RF_IMPLEMENTATIONS = "RF Implementations";
75const std::string HDBToHtml::COST_PLUGINS = "Cost Function Plugins";
77 "Operation Implementations";
79 "Operation Implementation Resources";
80
81/**
82 * The Cosntructor.
83 *
84 * @param hdb HDB
85 */
87 hdb_(hdb) {
88}
89
90/**
91 * The Destructor.
92 */
95
96/**
97 * Generates a html page of a function unit entry->
98 *
99 * @param id ID of the FU entry in the HDB.
100 * @param stream Stream where the html is written to.
101 */
102void
103HDBToHtml::fuEntryToHtml(RowID id, std::ostream& stream) {
104
105 const HDB::FUEntry* entry = hdb_.fuByEntryID(id);
106
107 stream << "<html><body><small>" << endl;
108 stream << "<b>Function unit entry " << entry->id() << "</b><br>" << endl;
109
110 stream << "<table>" << endl;
111 stream << "<tr><td align=right><b>Architecture:</b></td><td>";
112 if (entry->hasArchitecture()) {
113 stream << "<a href=\"/" << FU_ARCHITECTURES << "/"
114 << entry->architecture().id() << "\">"
115 << entry->architecture().id() << "</a>"
116 << "</td></tr>" << endl;
117 } else {
118 stream << "-</td></tr>";
119 }
120
121 stream << "<tr><td align=right><b>Implementation:</b></td><td>";
122 if (entry->hasImplementation()) {
123 stream << "<a href=\"/" << FU_IMPLEMENTATIONS << "/"
124 << entry->implementation().id() << "\">"
125 << entry->implementation().moduleName()
126 << "</a></td></tr>" << endl;
127 } else {
128 stream << "-</td></tr>" << endl;
129 }
130
131 stream << "<tr><td align=right><b>Cost function plugin:</b></td><td>";
132 if (entry->hasCostFunction()) {
133 const CostFunctionPlugin& plugin = entry->costFunction();
134 stream << "<a href=\"/" << COST_PLUGINS << "/"
135 << plugin.id() << "\">"
136 << plugin.name()
137 << "</a></td></tr>" << endl;
138 } else {
139 stream << "-</td></tr>" << endl;
140 }
141
142 stream << "</table>";
143
144 // Cost estimation data
145 const std::set<RowID> costDataIDs = hdb_.fuCostEstimationDataIDs(id);
146 if (!costDataIDs.empty()) {
147 stream << "<b>Cost estimation data:</b>" << endl;
148 stream << "<table bgcolor=#bbbbbb>" << endl;
149 stream << "<tr><th>Name</th><th>Value</th>"
150 << "<th>Plugin</th></tr>" << endl;
151 } else {
152 stream << "No cost estimation data.<br>" << endl;
153 }
154 std::set<RowID>::const_iterator iter = costDataIDs.begin();
155 for (; iter != costDataIDs.end(); iter++) {
156 const CostEstimationData data = hdb_.costEstimationData(*iter);
157 stream << "<tr><td>" << data.name() << "</td>"
158 << "<td align=right>";
159 stream << data.value().stringValue();
160 stream << "</td><td align=center><a href=\"/" << COST_PLUGINS
161 << "/" << data.pluginID() << "\">"
162 << data.pluginID() << "</a></td></tr>" << endl;
163 }
164 stream << "</table>" << endl;
165 stream << "</small></body></html>" << endl;
166
167 delete entry;
168}
169
170/**
171 * Generates a html page of a register file entry.
172 *
173 * @param id ID of the register file entry.
174 * @param stream Stream where the html is written to.
175 */
176void
177HDBToHtml::rfEntryToHtml(RowID id, std::ostream& stream) {
178
179 const HDB::RFEntry* entry = hdb_.rfByEntryID(id);
180
181 stream << "<html><body><small>" << endl;
182 stream << "<b>Register file entry " << entry->id() << "</b><br>" << endl;
183
184 stream << "<table>" << endl;
185 stream << "<tr><td>Architecture:</td><td>";
186 if (entry->hasArchitecture()) {
187 stream << "<a href=\"/" << RF_ARCHITECTURES << "/"
188 << entry->architecture().id() << "\">"
189 << entry->architecture().id() << "</a>"
190 << "</td></tr>" << endl;
191 } else {
192 stream << "-</td></tr>";
193 }
194
195 stream << "<tr><td><b>Implementation:</b></td><td>";
196 if (entry->hasImplementation()) {
197 stream << "<td><a href=\"/" << RF_IMPLEMENTATIONS << "/"
198 << entry->implementation().id() << "\">"
199 << entry->implementation().moduleName() << "</a>"
200 << "</td></tr>" << endl;
201 } else {
202 stream << "-</td></tr>" << endl;
203 }
204
205 stream << "<tr><td align=right><b>Cost function plugin:</b></td><td>";
206 if (entry->hasCostFunction()) {
207 const CostFunctionPlugin& plugin = entry->costFunction();
208 stream << "<a href=\"/" << COST_PLUGINS << "/"
209 << plugin.id() << "\">"
210 << plugin.name()
211 << "</a></td></tr>" << endl;
212 } else {
213 stream << "-</td></tr>" << endl;
214 }
215 stream << "</table>";
216
217 // Cost estimation data
218 const std::set<RowID> costDataIDs = hdb_.rfCostEstimationDataIDs(id);
219 if (!costDataIDs.empty()) {
220 stream << "<b>Cost estimation data:</b>" << endl;
221 stream << "<table bgcolor=#bbbbbb>" << endl;
222 stream << "<tr><th>Name</th><th>Value</th>"
223 << "<th>Plugin</th></tr>" << endl;
224 } else {
225 stream << "No cost estimation data.<br>" << endl;
226 }
227 std::set<RowID>::const_iterator iter = costDataIDs.begin();
228 for (; iter != costDataIDs.end(); iter++) {
229 const CostEstimationData data = hdb_.costEstimationData(*iter);
230 stream << "<tr><td>" << data.name() << "</td>"
231 << "<td align=right>";
232 stream << data.value().stringValue();
233 stream << "</td><td align=center><a href=\"/" << COST_PLUGINS
234 << "/" << data.pluginID() << "\">"
235 << data.pluginID() << "</a></td></tr>" << endl;
236 }
237 stream << "</table>" << endl;
238 stream << "</small></body></html>" << endl;
239 delete entry;
240}
241
242
243/**
244 * Generates a html page of a bus entry.
245 *
246 * @param id ID of the bus entry.
247 * @param stream Stream where the html is written to.
248 */
249void
250HDBToHtml::busEntryToHtml(RowID id, std::ostream& stream) {
251
252 stream << "<html><body><small>" << endl;
253 stream << "<b>Bus entry " << id << "</b><br>" << endl;
254
255 stream << "<tr><td align=right><b>Cost estimation data:</b></td><td>";
256
257 // Cost estimation data
258 const std::set<RowID> costDataIDs = hdb_.busCostEstimationDataIDs(id);
259 if (!costDataIDs.empty()) {
260 stream << "<b>Cost estimation data:</b>" << endl;
261 stream << "<table bgcolor=#bbbbbb>" << endl;
262 stream << "<tr><th>Name</th><th>Value</th>"
263 << "<th>Plugin</th></tr>" << endl;
264 } else {
265 stream << "No cost estimation data.<br>" << endl;
266 }
267 std::set<RowID>::const_iterator iter = costDataIDs.begin();
268 for (; iter != costDataIDs.end(); iter++) {
269 const CostEstimationData data = hdb_.costEstimationData(*iter);
270 stream << "<tr><td>" << data.name() << "</td>"
271 << "<td align=right>";
272 stream << data.value().stringValue();
273 stream << "</td><td align=center><a href=\"/" << COST_PLUGINS
274 << "/" << data.pluginID() << "\">"
275 << data.pluginID() << "</a></td></tr>" << endl;
276 }
277 stream << "</table>" << endl;
278 stream << "</small></body></html>" << endl;
279}
280
281
282/**
283 * Generates a html page of a socket entry.
284 *
285 * @param id ID of the sovket entry.
286 * @param stream Stream where the html is written to.
287 */
288void
289HDBToHtml::socketEntryToHtml(RowID id, std::ostream& stream) {
290
291 stream << "<html><body><small>" << endl;
292 stream << "<b>Socket entry " << id << "</b><br>" << endl;
293
294 stream << "<tr><td align=right><b>Cost estimation data:</b></td><td>";
295
296 // Cost estimation data
297 const std::set<RowID> costDataIDs = hdb_.socketCostEstimationDataIDs(id);
298 if (!costDataIDs.empty()) {
299 stream << "<b>Cost estimation data:</b>" << endl;
300 stream << "<table bgcolor=#bbbbbb>" << endl;
301 stream << "<tr><th>Name</th><th>Value</th>"
302 << "<th>Plugin</th></tr>" << endl;
303 } else {
304 stream << "No cost estimation data.<br>" << endl;
305 }
306 std::set<RowID>::const_iterator iter = costDataIDs.begin();
307 for (; iter != costDataIDs.end(); iter++) {
308 const CostEstimationData data = hdb_.costEstimationData(*iter);
309 stream << "<tr><td>" << data.name() << "</td>"
310 << "<td align=right>";
311 stream << data.value().stringValue();
312 stream << "</td><td align=center><a href=\"/" << COST_PLUGINS
313 << "/" << data.pluginID() << "\">"
314 << data.pluginID() << "</a></td></tr>" << endl;
315 }
316 stream << "</table>" << endl;
317 stream << "</small></body></html>" << endl;
318}
319
320
321/**
322 * Generates a html page of a function unit architecture.
323 *
324 * @param id ID of the FU architecture.
325 * @param stream Stream where the html is written to.
326 */
327void
328HDBToHtml::fuArchToHtml(RowID id, std::ostream& stream) {
329
330 const FUArchitecture* arch = hdb_.fuArchitectureByID(id);
331 const FunctionUnit& fu = arch->architecture();
332
333 stream << "<html><body><small>" << endl;
334
335 //
336 // PORTS
337 //
338 stream << "<b>Ports:</b><br>" << endl;
339 stream << "<table bgcolor=#bbbbbb>" << endl;
340 stream << "<tr><th>Name</th><th>Width</th>"
341 << "<th>Triggering</th>"
342 << "<th>Opcode</th>"
343 << "<th>Guard</th></tr>"
344 << endl;
345
346 for (int i = 0; i < fu.portCount(); i++) {
347
348 const BaseFUPort& port = *fu.port(i);
349
350 stream << "<tr><td align=left>" << port.name() << "</td>";
351
352 if (arch->hasParameterizedWidth(port.name())) {
353 stream << "<td align=right>param</td>";
354 } else {
355 stream << "<td align=right>" << port.width() << "</td>";
356 }
357
358 if (port.isTriggering()) {
359 stream << "<td align=center><font color=#009900>yes</font></td>";
360 } else {
361 stream << "<td align=center><font color=#ff0000>no</font></td>";
362 }
363
364 if (port.isOpcodeSetting()) {
365 stream << "<td align=center><font color=#009900>yes</font></td>";
366 } else {
367 stream << "<td align=center><font color=#ff0000>no</font></td>";
368 }
369
370 if (arch->hasGuardSupport(port.name())) {
371 stream << "<td align=center><font color=#009900>yes</font></td>";
372 } else {
373 stream << "<td align=center><font color=#ff0000>no</font></td>";
374 }
375 stream << "</tr>" << endl;
376 }
377 stream << "</table><br><br>" << endl;
378
379 //
380 // OPERATIONS
381 //
382 stream << "<b>Operations:</b><br><br>" << endl;
383 for (int i = 0; i < fu.operationCount(); i++) {
384
385 const HWOperation& operation = *fu.operation(i);
386 const ExecutionPipeline& pipeline = *operation.pipeline();
387
388 stream << "<b>" << operation.name() << "</b><br>" << endl;
389 stream << "Latency: " << operation.latency() << endl;
390 stream << "<br>" << endl;
391 stream << "<table><tr><td valing=top>" << endl;
392 stream << "<table bgcolor=#bbbbbb><tr><th>operand</th><th>port</th>";
393 for (int cycle = 0; cycle < operation.latency(); cycle++) {
394 stream << "<th width=20>" << cycle << "</th>";
395 }
396 stream << "</tr>" << endl;
397
398 // Reads operands.
400 ExecutionPipeline::OperandSet::iterator iter = read.begin();
401 for (; iter != read.end(); iter++) {
402 stream << "<tr><td>" << *iter << "</td><td>"
403 << operation.port(*iter)->name() << "</td>";
404 for (int cycle = 0; cycle < operation.latency(); cycle++) {
406 pipeline.readOperands(cycle), *iter)) {
407 stream << "<td align=center><b>R</b></td>";
408 } else {
409 stream << "<td></td>";
410 }
411 }
412 stream << "</tr>" << endl;
413 }
414
415 // Written operands.
417 iter = written.begin();
418 for (; iter != written.end(); iter++) {
419 stream << "<tr><td>" << *iter << "</td><td>"
420 << operation.port(*iter)->name() << "</td>";
421 for (int cycle = 0; cycle < operation.latency(); cycle++) {
423 pipeline.writtenOperands(cycle), *iter)) {
424 stream << "<td align=center><b>W</b></td>";
425 } else {
426 stream << "<td></td>";
427 }
428 }
429 stream << "</tr>" << endl;
430 }
431 stream << "</table></td>" << endl;
432
433 stream << "<td valign=top><table bgcolor=#bbbbbb>"
434 << "<tr><th>resource</th>";
435 for (int cycle = 0; cycle < operation.latency(); cycle++) {
436 stream << "<th width=20>" << cycle << "</th>";
437 }
438 stream << "</tr>" << endl;
439
440 // Resources used.
441 for (int r = 0; r < fu.pipelineElementCount(); r++) {
442 const PipelineElement& res = *fu.pipelineElement(r);
443 stream << "<tr><td>" << res.name() << "</td>";
444 for (int cycle = 0; cycle < operation.latency(); cycle++) {
445 if (pipeline.isResourceUsed(res.name(), cycle)) {
446 stream << "<td align=center><b>X</b></td>";
447 } else {
448 stream << "<td></td>";
449 }
450 }
451 stream << "</tr>" << endl;
452 }
453
454 stream << "</table></td></tr></table><br><br>" << endl;
455 }
456 stream << "</small></body></html>" << endl;
457
458 delete arch;
459}
460
461
462/**
463 * Generates a html page of a register file architecture.
464 *
465 * @param id ID of the register file architecture.
466 * @param stream Stream where the html is written to.
467 */
468void
469HDBToHtml::rfArchToHtml(RowID id, std::ostream& stream) {
470
472
473 stream << "<html><body><small>" << endl;
474 stream << "<table>" << endl;
475
476 // Width
477 stream << "<tr><td align=right><b>Width:</b></td>";
478 if (arch->hasParameterizedWidth()) {
479 stream << "<td>param</td>";
480 } else {
481 stream << "<td align=center>" << arch->width() << "</td>";
482 }
483 stream << "</tr>" << endl;
484
485 // Size
486 stream << "<tr><td align=right><b>Size:</b></td>";
487 if (arch->hasParameterizedSize()) {
488 stream << "<td align=center>param</td>";
489 } else {
490 stream << "<td align=center>" << arch->size() << "</td>";
491 }
492 stream << "</tr>" << endl;
493
494 stream << "<tr><td align=right><b>Read ports:</b></td><td align=center>"
495 << arch->readPortCount() << "</td></tr>" << endl;
496
497 stream << "<tr><td align=right><b>Write ports:</b></td><td align=center>"
498 << arch->writePortCount() << "</td></tr>" << endl;
499
500 stream << "<tr><td align=right><b>Bidirectional ports:</b></td>"
501 << "<td align=center>" << arch->bidirPortCount() << "</td></tr>"
502 << endl;
503
504 stream << "<tr><td align=right><b>Max reads:</b></td><td align=center>"
505 << arch->maxReads() << "</td></tr>" << endl;
506
507 stream << "<tr><td align=right><b>Max Writes:</b></td><td align=center>"
508 << arch->maxWrites() << "</td></tr>" << endl;
509
510 stream << "<tr><td align=right><b>Latency:</b></td><td align=center>"
511 << arch->latency() << "</td></tr>" << endl;
512
513 stream << "<tr><td align=right><b>Guard support:</b></td>";
514 if (arch->hasGuardSupport()) {
515 stream << "<td align=center>yes</td></tr>";
516 stream << "<tr><td align=right><b>Guard Latency:</b></td>"
517 << "<td align=center>" << arch->guardLatency()
518 << "</td></tr>" << endl;
519 } else {
520 stream << "<td align=center>no</td></tr>";
521 }
522 stream << "<tr><td align=right><b>Zero Register:</b></td><td" <<
523 " align=center>" << arch->zeroRegister() << "</td></tr>" << endl;
524
525 stream << "</table></small><br>" << endl;
526 stream << "</body></html>" << endl;
527
528 delete arch;
529}
530
531
532/**
533 * Generates a html page of a function unit implementation.
534 *
535 * @param id ID of the fu implementation.
536 * @param stream Stream where the html is written to.
537 */
538void
539HDBToHtml::fuImplToHtml(RowID id, std::ostream& stream) {
540
542 const HDB::FUEntry* entry = hdb_.fuByEntryID(entryID);
543 const HDB::FUImplementation& impl = entry->implementation();
544
545 stream << "<html><body>" << endl;
546 stream << "<small><table>" << endl;
547
548 stream << "<tr><td align=right><b>Module name:</b></td><td align=left>"
549 << impl.moduleName() << "</td></tr>" << endl;
550
551 stream << "<tr><td align=right><b>Opcode port:</b></td><td align=left>"
552 << impl.opcodePort() << "</td></tr>" << endl;
553
554 stream << "<tr><td align=right><b>Clock port:</b></td><td align=left>"
555 << impl.clkPort() << "</td></tr>" << endl;
556
557 stream << "<tr><td align=right><b>Reset port:</b></td><td align=left>"
558 << impl.rstPort() << "</td></tr>" << endl;
559
560 stream << "<tr><td align=right><b>Global lock port:</b></td>"
561 << "<td align=left>"
562 << impl.glockPort() << "</td></tr>" << endl;
563
564 stream << "<tr><td align=right><b>Global lock req. port:</b></td>"
565 << "<td align=left>"
566 << impl.glockReqPort() << "</td></tr>" << endl;
567
568 stream << "</table><br><br>" << endl;
569
570 // Architecture ports.
571 if (impl.architecturePortCount() > 0) {
572 stream << "<b>Architecture ports:</b>" << endl;
573 stream << "<table bgcolor=#bbbbbb>" << endl;
574 stream << "<tr><th>Name</th>"
575 << "<th>Architecture port</th>"
576 << "<th>Load port</th>"
577 << "<th>Guard port</th>"
578 << "<th>Width formula</th></tr>" << endl;
579 } else {
580 stream << "No architecture ports.<br>" << endl;
581 }
582 for (int i = 0; i < impl.architecturePortCount(); i++) {
583
584 const HDB::FUPortImplementation& port = impl.architecturePort(i);
585 stream << "<tr><td>" << port.name() << "</td>"
586 << "<td>" << port.architecturePort() << "</td>"
587 << "<td>" << port.loadPort() << "</td>"
588 << "<td>" << port.guardPort() << "</td>"
589 << "</td><td>" << port.widthFormula() << "</td></td>" << endl;
590 }
591 stream << "</table><br><br>" << endl;
592
593
594 // Opcodes
595 if (impl.opcodeCount() > 0) {
596 stream << "<b>Opcodes:</b>" << endl;
597 stream << "<table bgcolor=#bbbbbb>" << endl;
598 stream << "<tr><th>Operation</th><th>Opcode</th></tr>" << endl;
599 } else {
600 stream << "No opcodes.<br>" << endl;
601 }
602 for (int i = 0; i < impl.opcodeCount(); i++) {
603 stream << "<tr><td>" << impl.opcodeOperation(i) << "</td>"
604 << "<td align=center>" << impl.opcode(impl.opcodeOperation(i))
605 << "</td></tr>" << endl;
606 }
607 stream << "</table><br><br>" << endl;
608
609 // External ports
610 if (impl.externalPortCount() > 0) {
611 stream << "<b>External ports:</b>" << endl;
612 stream << "<table bgcolor=#bbbbbb>" << endl;
613 stream << "<tr><th>Name</th><th>Direction</th><th>Width formula</th>"
614 << "<th>Parameter dependencies</th>"
615 << "<th>Description</th></tr>" << endl;
616 } else {
617 stream << "No external ports.<br>" << endl;
618 }
619 for (int i = 0; i < impl.externalPortCount(); i++) {
620
621 const HDB::FUExternalPort& port = impl.externalPort(i);
622 stream << "<tr><td>" << port.name() << "</td><td align=center>";
623 if (port.direction() == HDB::IN) {
624 stream << "in";
625 } else if (port.direction() == HDB::OUT) {
626 stream << "out";
627 } else if (port.direction() == HDB::BIDIR) {
628 stream << "bidir";
629 }
630 stream << "</td><td>" << port.widthFormula() << "</td>";
631 stream << "<td>";
632 for (int dep = 0; dep < port.parameterDependencyCount(); dep++) {
633 if (dep > 0) {
634 stream << ", ";
635 }
636 stream << port.parameterDependency(dep);
637 }
638 stream << "</td><td>" << port.description() << "</td></tr>" << endl;
639 }
640 stream << "</table><br><br>" << endl;
641
642
643
644 // Parameters
645 if (impl.parameterCount() > 0) {
646 stream << "<b>Parameters:</b>" << endl;
647 stream << "<table bgcolor=#bbbbbb>" << endl;
648 stream << "<tr><th>Name</th><th>Type</th><th>Value</th></tr>" << endl;
649 } else {
650 stream << "No parameters.<br>" << endl;
651 }
652 for (int i = 0; i < impl.parameterCount(); i++) {
653
654 const HDB::FUImplementation::Parameter& parameter = impl.parameter(i);
655 stream << "<tr><td>" << parameter.name << "</td>"
656 << "<td align=center>" << parameter.type << "</td>"
657 << "<td>" << parameter.value << "</td></tr>" << endl;
658 }
659 stream << "</table><br><br>" << endl;
660
661
662 // Implementation files
663 if (impl.implementationFileCount() > 0) {
664 stream << "<b>Implementation files:</b>" << endl;
665 stream << "<table bgcolor=#bbbbbb>" << endl;
666 stream << "<tr><th>Path</th><th>Format</th></tr>" << endl;
667 } else {
668 stream << "No implementation files.<br>" << endl;
669 }
670 for (int i = 0; i < impl.implementationFileCount(); i++) {
671 const HDB::BlockImplementationFile& file = impl.file(i);
672 stream << "<tr><td>" << file.pathToFile() << "</td>"
673 << "<td align=center>";
675 stream << "VHDL";
676 }else
678 stream << "Verilog";
679 }
680
681 stream << "</td></tr>" << endl;
682 }
683 stream << "</table><br><br>" << endl;
684
685
686 // Cost estimation data
687 const std::set<RowID> costDataIDs = hdb_.fuCostEstimationDataIDs(entryID);
688 if (!costDataIDs.empty()) {
689 stream << "<b>Cost estimation data:</b>" << endl;
690 stream << "<table bgcolor=#bbbbbb>" << endl;
691 stream << "<tr><th>Name</th><th>Value</th>"
692 << "<th>Plugin</th></tr>" << endl;
693 } else {
694 stream << "No cost estimation data.<br>" << endl;
695 }
696 std::set<RowID>::const_iterator iter = costDataIDs.begin();
697 for (; iter != costDataIDs.end(); iter++) {
698 const CostEstimationData data = hdb_.costEstimationData(*iter);
699 stream << "<tr><td>" << data.name() << "</td>"
700 << "<td align=right>";
701 stream << data.value().stringValue();
702 stream << "</td><td align=center><a href=\"/" << COST_PLUGINS
703 << "/" << data.pluginID() << "\">"
704 << data.pluginID() << "</a></td></tr>" << endl;
705 }
706 stream << "</table>" << endl;
707 stream << "</small></body></html>" << endl;
708
709
710 delete entry;
711}
712
713/**
714 * Generates a html page of a register file implementation.
715 *
716 * @param id ID of the RF implementation.
717 * @param stream Stream where the html is written to.
718 */
719void
720HDBToHtml::rfImplToHtml(RowID id, std::ostream& stream) {
721
723 const RFEntry* entry = hdb_.rfByEntryID(entryID);
724 const RFImplementation& impl = entry->implementation();
725
726 stream << "<html><body>" << endl;
727 stream << "<small><table>" << endl;
728
729 stream << "<tr><td align=right><b>Module name:</b></td><td align=center>"
730 << impl.moduleName() << "</td></tr>" << endl;
731
732 stream << "<tr><td align=right><b>Clock port:</b></td><td align=center>"
733 << impl.clkPort() << "</td></tr>" << endl;
734
735 stream << "<tr><td align=right><b>Reset port:</b></td><td align=center>"
736 << impl.rstPort() << "</td></tr>" << endl;
737
738 stream << "<tr><td align=right><b>Global lock port:</b></td>"
739 << "<td align=center>"
740 << impl.glockPort() << "</td></tr>" << endl;
741
742 stream << "<tr><td align=right><b>Guard port:</b></td>"
743 << "<td align=center>"
744 << impl.guardPort() << "</td></tr>" << endl;
745
746 stream << "<tr><td align=right><b>Size parameter:</b></td>"
747 << "<td align=center>" << impl.sizeParameter() << "</td></tr>"
748 << endl;
749
750 stream << "<tr><td align=right><b>Width parameter:</b></td>"
751 << "<td align=center>" << impl.widthParameter() << "</td></tr>"
752 << endl;
753
754 std::string sac_flag(impl.separateAddressCycleParameter() ?
755 "true" : "false");
756 stream << "<tr><td align=right><b>Separate address cycle:</b></td>"
757 << "<td align=center>"
758 << sac_flag << "</td></tr>" << endl;
759
760 stream << "</table><br><br>" << endl;
761
762
763 // Ports
764 if (impl.portCount() > 0) {
765 stream << "<b>Ports:</b>" << endl;
766 stream << "<table bgcolor=#bbbbbb>" << endl;
767 stream << "<tr><th>Name</th>"
768 << "<th>Direction</th>"
769 << "<th>Load port</th>"
770 << "<th>Opcode port</th>"
771 << "<th>Opcode port width formula</th></tr>" << endl;
772 } else {
773 stream << "No ports.<br>" << endl;
774 }
775 for (int i = 0; i < impl.portCount(); i++) {
776
777 const HDB::RFPortImplementation& port = impl.port(i);
778 stream << "<tr><td>" << port.name() << "</td><td align=center>";
779 if (port.direction() == HDB::IN) {
780 stream << "in";
781 } else if (port.direction() == HDB::OUT) {
782 stream << "out";
783 } else if (port.direction() == HDB::BIDIR) {
784 stream << "bidir";
785 }
786 stream << "</td><td>" << port.loadPort() << "</td>"
787 << "<td>" << port.opcodePort() << "</td>"
788 << "</td><td>" << port.opcodePortWidthFormula()
789 << "</td></td>" << endl;
790 }
791 stream << "</table><br><br>" << endl;
792
793 // External ports
794 if (impl.externalPortCount() > 0) {
795 stream << "<b>External ports:</b>" << endl;
796 stream << "<table bgcolor=#bbbbbb>" << endl;
797 stream << "<tr><th>Name</th><th>Direction</th><th>Width formula</th>"
798 << "<th>Parameter dependencies</th>"
799 << "<th>Description</th></tr>" << endl;
800 } else {
801 stream << "No external ports.<br>" << endl;
802 }
803 for (int i = 0; i < impl.externalPortCount(); i++) {
804
805 const HDB::RFExternalPort& port = impl.externalPort(i);
806 stream << "<tr><td>" << port.name() << "</td><td align=center>";
807 if (port.direction() == HDB::IN) {
808 stream << "in";
809 } else if (port.direction() == HDB::OUT) {
810 stream << "out";
811 } else if (port.direction() == HDB::BIDIR) {
812 stream << "bidir";
813 }
814 stream << "</td><td>" << port.widthFormula() << "</td>";
815 stream << "<td>";
816 for (int dep = 0; dep < port.parameterDependencyCount(); dep++) {
817 if (dep > 0) {
818 stream << ", ";
819 }
820 stream << port.parameterDependency(dep);
821 }
822 stream << "</td><td>" << port.description() << "</td></tr>" << endl;
823 }
824 stream << "</table><br><br>" << endl;
825
826 // Parameters
827 if (impl.parameterCount() > 0) {
828 stream << "<b>Parameters:</b>" << endl;
829 stream << "<table bgcolor=#bbbbbb>" << endl;
830 stream << "<tr><th>Name</th><th>Type</th><th>Value</th></tr>" << endl;
831 } else {
832 stream << "No parameters.<br>" << endl;
833 }
834 for (int i = 0; i < impl.parameterCount(); i++) {
835
836 const HDB::RFImplementation::Parameter& parameter = impl.parameter(i);
837 stream << "<tr><td>" << parameter.name << "</td>"
838 << "<td align=center>" << parameter.type << "</td>"
839 << "<td>" << parameter.value << "</td></tr>" << endl;
840 }
841 stream << "</table><br><br>" << endl;
842
843 // Implementation files
844 if (impl.implementationFileCount() > 0) {
845 stream << "<b>Implementation files:</b>" << endl;
846 stream << "<table bgcolor=#bbbbbb>" << endl;
847 stream << "<tr><th>Path</th><th>Format</th></tr>" << endl;
848 } else {
849 stream << "No implementation files.<br>" << endl;
850 }
851
852 for (int i = 0; i < impl.implementationFileCount(); i++) {
853 const HDB::BlockImplementationFile& file = impl.file(i);
854 stream << "<tr><td>" << file.pathToFile() << "</td>"
855 << "<td align=center>";
857 stream << "VHDL";
858 }else
860 stream << "Verilog";
861 }
862
863 stream << "</td></tr>" << endl;
864 }
865 stream << "</table><br><br>" << endl;
866
867 // Cost estimation data
868 const std::set<RowID> costDataIDs = hdb_.rfCostEstimationDataIDs(entryID);
869 if (!costDataIDs.empty()) {
870 stream << "<b>Cost estimation data:</b>" << endl;
871 stream << "<table bgcolor=#bbbbbb>" << endl;
872 stream << "<tr><th>Name</th><th>Value</th>"
873 << "<th>Plugin</th></tr>" << endl;
874 } else {
875 stream << "No cost estimation data.<br>" << endl;
876 }
877 std::set<RowID>::const_iterator iter = costDataIDs.begin();
878 for (; iter != costDataIDs.end(); iter++) {
879 const CostEstimationData data = hdb_.costEstimationData(*iter);
880 stream << "<tr><td>" << data.name() << "</td>"
881 << "<td align=right>";
882 stream << data.value().stringValue();
883 stream << "</td><td align=center><a href=\"/" << COST_PLUGINS
884 << "/" << data.pluginID() << "\">"
885 << data.pluginID() << "</a></td></tr>" << endl;
886 }
887 stream << "</table>" << endl;
888 stream << "</small></body></html>" << endl;
889
890 delete entry;
891}
892
893/**
894 * Generates html page of a cost function plugin information.
895 *
896 * @param id Row id of the cost estimation plugin.
897 * @param strem Stream where the html is written to.
898 */
899void
901
903
904 stream << "<html><body><small>" << endl;
905 stream << "<table bgcolor=#bbbbbb>"<< endl;
906
907 // Plugin name.
908 stream << "<tr><td align=right>Name:</td><td>" << plugin->name()
909 << "</td></tr>" << endl;
910
911 // Plugin type.
912 stream << "<tr><td align=right>Type:</td><td>";
913 if (plugin->type() == CostFunctionPlugin::COST_FU) {
914 stream << "Function unit cost estimator.";
915 } else if (plugin->type() == CostFunctionPlugin::COST_RF) {
916 stream << "Register file cost estimator.";
917 } else if (plugin->type() == CostFunctionPlugin::COST_DECOMP) {
918 stream << "Decompressor cost estimator.";
919 } else if (plugin->type() == CostFunctionPlugin::COST_ICDEC) {
920 stream << "Interconnection network & decoder cost estimator.";
921 } else {
922 stream << "unknown";
923 }
924 stream << "</td></tr>" << endl;
925
926 // Plugin file path.
927 stream << "<tr><td align=right>File path:</td><td>"
928 << plugin->pluginFilePath() << "</td></tr>" << endl;
929
930 // Plugin description.
931 stream << "<tr><td align=right>Description:</td><td>"
932 << plugin->description() << "</td></tr>" << endl;
933
934 stream << "</table><br><br>"<< endl;
935
936
937 // Cost estiamtion data
938 stream << "<b>Cost estimation data:</b>" << endl;
939 stream << "<table bgcolor=#bbbbbb>"<< endl;
940 stream << "<tr><th>Entry type</th><th>Entry ID</th>"
941 << "<th>Key</th><th>Value</th></tr>" << endl;
942
943 const std::set<RowID> dataIDs = hdb_.costFunctionPluginDataIDs(id);
944 std::set<RowID>::const_iterator iter = dataIDs.begin();
945 for (; iter != dataIDs.end(); iter++) {
947 stream << "<tr>";
948 if (data.hasFUReference()) {
949 // Function unit reference.
950 stream << "<td>FU</td><td><a href=\"/" << FU_ENTRIES << "/"
951 << data.fuReference() << "\">"
952 << data.fuReference() << "</a>";
953 stream << "</td>";
954 } else if (data.hasRFReference()) {
955 // Register file entry reference.
956 stream << "<td>RF</td><td><a href=\"/" << RF_ENTRIES << "/"
957 << data.rfReference() << "\">"
958 << data.rfReference() << "</a>";
959 stream << "</td>";
960 } else if (data.hasBusReference()) {
961 // Bus entry reference.
962 stream << "<td>Bus</td><td>"
963 << data.busReference() << "</a>";
964 stream << "</td>";
965 } else if (data.hasSocketReference()) {
966 // Socket entry reference.
967 stream << "<td>Socket</td><td>"
968 << data.socketReference() << "</a>";
969 stream << "</td>";
970 } else {
971 stream << "<td>-</td><td>-</td>";
972 }
973
974 stream << "<td>" << data.name() << "</td><td>"
975 << data.value().stringValue() << "</td></tr>" << endl;
976
977 }
978 stream << "</table>"<< endl;
979 stream << "</small></body></html>" << endl;
980
981 delete plugin;
982}
983
984
985void
988
989 stream << "<html><body>";
990 stream << "<b>Operation Implementation</b><br/>";
991 stream << "operation : " << op.name << "<br/>";
992 stream << "implementation (VHDL) : " << op.implFileVhdl << "<br/>";
993 stream << "implementation (Verilog) : " << op.implFileVerilog << "<br/>";
994 for(const auto& r : op.resources) {
995 stream << "resource : " << r.name
996 << " * " << r.count
997 << "<br/>";
998 }
999 stream << "</body></html>\n";
1000}
1001
1002void
1006
1007 stream << "<html><body>";
1008 stream << "<b>Operation Implementation Resource</b><br/>";
1009 stream << "name : " << res.name << "<br/>";
1010 for (const auto& sim : res.simFiles) {
1011 stream << "simulation file : " << sim << "<br/>";
1012 }
1013 for (const auto& syn : res.synFiles) {
1014 stream << "synthesis file : " << syn << "<br/>";
1015 }
1016 stream << "</body></html>";
1017}
int RowID
Type definition of row ID in relational databases.
Definition DBTypes.hh:37
static bool containsValue(const ContainerType &aContainer, const ElementType &aKey)
DataObject value() const
bool hasBusReference() const
bool hasFUReference() const
std::string name() const
RowID socketReference() const
bool hasSocketReference() const
bool hasRFReference() const
virtual std::string stringValue() const
void costFunctionPluginToHtml(RowID id, std::ostream &stream)
Definition HDBToHtml.cc:900
static const std::string OPERATION_IMPLEMENTATIONS
Definition HDBToHtml.hh:75
static const std::string RF_IMPLEMENTATIONS
Definition HDBToHtml.hh:73
void socketEntryToHtml(RowID id, std::ostream &stream)
Definition HDBToHtml.cc:289
static const std::string RF_IU_ENTRIES
Definition HDBToHtml.hh:67
void busEntryToHtml(RowID id, std::ostream &stream)
Definition HDBToHtml.cc:250
void fuImplToHtml(RowID id, std::ostream &stream)
Definition HDBToHtml.cc:539
void OperationImplementationResourceToHtml(RowID id, std::ostream &stream)
void fuArchToHtml(RowID id, std::ostream &stream)
Definition HDBToHtml.cc:328
static const std::string COST_PLUGINS
Definition HDBToHtml.hh:74
HDBToHtml(const HDB::HDBManager &hdb)
Definition HDBToHtml.cc:86
const HDB::HDBManager & hdb_
HDB to create html from.
Definition HDBToHtml.hh:80
static const std::string FU_ENTRIES
Definition HDBToHtml.hh:65
static const std::string FU_ARCHITECTURES
Definition HDBToHtml.hh:70
void fuEntryToHtml(RowID id, std::ostream &stream)
Definition HDBToHtml.cc:103
static const std::string RF_ARCHITECTURES
Definition HDBToHtml.hh:71
void OperationImplementationToHtml(RowID id, std::ostream &stream)
Definition HDBToHtml.cc:986
void rfArchToHtml(RowID id, std::ostream &stream)
Definition HDBToHtml.cc:469
virtual ~HDBToHtml()
Definition HDBToHtml.cc:93
static const std::string SOCKET_ENTRIES
Definition HDBToHtml.hh:69
static const std::string RF_ENTRIES
Definition HDBToHtml.hh:66
void rfEntryToHtml(RowID id, std::ostream &stream)
Definition HDBToHtml.cc:177
static const std::string OPERATION_IMPLEMENTATION_RESOURCES
Definition HDBToHtml.hh:76
static const std::string FU_IMPLEMENTATIONS
Definition HDBToHtml.hh:72
static const std::string BUS_ENTRIES
Definition HDBToHtml.hh:68
void rfImplToHtml(RowID id, std::ostream &stream)
Definition HDBToHtml.cc:720
@ COST_RF
register file cost estimator
@ COST_ICDEC
interconnection network & decoder cost estimator
@ COST_FU
function unit cost estimator
@ COST_DECOMP
decompressor cost estimator
CostFunctionPluginType type() const
std::string description() const
std::string pluginFilePath() const
std::string widthFormula() const
std::string parameterDependency(int index) const
int parameterDependencyCount() const
std::string name() const
std::string description() const
Direction direction() const
bool hasGuardSupport(const std::string &port) const
bool hasParameterizedWidth(const std::string &port) const
TTAMachine::FunctionUnit & architecture() const
FUImplementation & implementation() const
Definition FUEntry.cc:86
virtual bool hasImplementation() const
Definition FUEntry.cc:74
FUArchitecture & architecture() const
Definition FUEntry.cc:129
virtual bool hasArchitecture() const
Definition FUEntry.cc:117
FUPortImplementation & architecturePort(int index) const
Parameter parameter(int index) const
std::string glockReqPort() const
std::string opcodeOperation(int index) const
FUExternalPort & externalPort(int index) const
std::string opcodePort() const
int opcode(const std::string &operation) const
std::string architecturePort() const
bool hasCostFunction() const
Definition HDBEntry.cc:99
CostFunctionPlugin & costFunction() const
Definition HDBEntry.cc:111
RowID id() const
Definition HDBEntry.cc:85
std::set< RowID > socketCostEstimationDataIDs(RowID socketID) const
std::set< RowID > busCostEstimationDataIDs(RowID busID) const
FUEntry * fuByEntryID(RowID id) const
CostFunctionPlugin * costFunctionPluginByID(RowID pluginID) const
OperationImplementationResource OperationImplementationResourceByID(RowID id) const
std::set< RowID > costFunctionPluginDataIDs(RowID pluginID) const
virtual RFArchitecture * rfArchitectureByID(RowID id) const
OperationImplementation OperationImplementationByID(RowID id) const
CostEstimationData costEstimationData(RowID id) const
std::set< RowID > fuCostEstimationDataIDs(RowID fuImplID) const
std::set< RowID > rfCostEstimationDataIDs(RowID rfImplID) const
RowID fuEntryIDOfImplementation(RowID implID) const
RowID rfEntryIDOfImplementation(RowID implID) const
virtual FUArchitecture * fuArchitectureByID(RowID id) const
RFEntry * rfByEntryID(RowID id) const
BlockImplementationFile & file(int index) const
std::string loadPort() const
bool hasGuardSupport() const
bool hasParameterizedWidth() const
bool zeroRegister() const
bool hasParameterizedSize() const
virtual bool hasImplementation() const
Definition RFEntry.cc:74
RFArchitecture & architecture() const
Definition RFEntry.cc:145
virtual bool hasArchitecture() const
Definition RFEntry.cc:117
RFImplementation & implementation() const
Definition RFEntry.cc:102
RFExternalPort & externalPort(int index) const
RFPortImplementation & port(int index) const
bool separateAddressCycleParameter() const
std::string sizeParameter() const
std::string widthParameter() const
std::string guardPort() const
Parameter parameter(int index) const
std::string opcodePortWidthFormula() const
virtual int width() const
virtual bool isOpcodeSetting() const =0
virtual bool isTriggering() const =0
OperandSet writtenOperands(int cycle) const
OperandSet readOperands(int cycle) const
std::set< int > OperandSet
Set for operand indexes.
bool isResourceUsed(const std::string &name, int cycle) const
virtual int pipelineElementCount() const
virtual HWOperation * operation(const std::string &name) const
virtual int operationCount() const
virtual PipelineElement * pipelineElement(int index) const
virtual BaseFUPort * port(const std::string &name) const
ExecutionPipeline * pipeline() const
virtual FUPort * port(int operand) const
const std::string & name() const
const std::string & name() const
virtual std::string name() const
Definition Port.cc:141
virtual int portCount() const
Definition Unit.cc:135
@ OUT
Output port.
Definition HDBTypes.hh:42
@ BIDIR
Bidirectional port.
Definition HDBTypes.hh:43
@ IN
Input port.
Definition HDBTypes.hh:41
std::vector< OperationImplementationResource > resources
std::string value
Value of the parameter.
Definition HDBTypes.hh:49
std::string type
Type of the parameter.
Definition HDBTypes.hh:48
std::string name
Name of the parameter.
Definition HDBTypes.hh:47