-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
136 lines (130 loc) · 5.23 KB
/
main.cpp
File metadata and controls
136 lines (130 loc) · 5.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#include <QtGui>
#include "common.h"
#include "mainWindow.h"
int main(int argc, char **argv)
{
QApplication app(argc, argv);
// register event types
CutePathSim::ComponentDockEvent::EventType = static_cast<QEvent::Type>(QEvent::registerEventType());
CutePathSim::MainWindow mw;
CutePathSim::mainWindow = &mw;
mw.show();
return app.exec();
}
/**
* \mainpage CutePathSim Documentation
* \section intro_section Introduction
* CutePathSim is a graphical, object oriented simulation of the data path in a digital system. This documentation breifly explains how digital systems are simulated in CutePathSim, and how these systems can be explored and modified using the CutePathSim GUI.
*
* \section basics_section Basics
* Upon starting CutePathSim for the first time, one is presented with a blank canvas. To open one of the example systems, navigate to "File" and then "Open...", and select the "reference_cpu.xml" file in the examples directory.
*
* \dot
* digraph cpu
* {
* instruction [label="Instruction\nFetcher"]
* control [label="Control\nUnit"]
* alu [label=ALU, shape=trapezium]
* registers [label=Registers, shape=record]
*
* instruction->control [style=bold]
* control->registers
* control->alu
* }
* \enddot
*
* \section structure_section System Structure
* The following are two graphs of the basic structure of CutePathSim, the first graph being the current structure, and the second graph the possible structure in the future. The Reference CPU (derived classes) at the bottom is modeled using the component graph interface (SystemC in the future), which is rendered by the GUI. The GUI also uses Graphviz to position nodes and edges in the graph.
* \dot
* digraph system
* {
* node [shape=record];
* gui [ label="Qt GUI" ]
* component [ label="Component Graph Interface" ]
* graphviz [ label=Graphviz ]
* cpu [ label="Reference CPU" ]
* gui->component
* gui->graphviz
* component->cpu
* }
* \enddot
*
* \dot
* digraph system
* {
* node [shape=record];
* gui [ label="Qt GUI" ]
* systemc [ label="SystemC Interface" ]
* graphviz [ label=Graphviz ]
* cpu [ label="Reference CPU" ]
* lua [ label="Lua Interface" ]
* gui->systemc
* gui->graphviz
* systemc->cpu
* systemc->lua
* lua->cpu
* }
* \enddot
*
* \section graph_layout_section Graph Layout Algorithm Flowchart
* This flowchart shows the steps used to layout the graph at runtime with Graphviz while keeping the main GUI thread running and the graph in an acceptable state. The algorithm has to be careful not to scale components or graphs too often or too soon, so it uses some queues and renders the graphs one at a time in a seperate thread.
* \dot
* digraph flow
* {
* start
* end
* is_thread [label="Layout thread\nrunning?", shape=diamond]
* start->is_thread
* is_thread->end [label="yes"]
* is_finished_thread [label="Thread recently\nfinished layout?", shape=diamond]
* is_thread->is_finished_thread [label="no"]
* is_queue [label="Graphs in\nqueue?", shape=diamond]
* is_finished_thread->is_queue [label="no"]
* apply_layout [label="Apply graph layout\nto GUI items", shape=record]
* is_finished_thread->apply_layout [label="yes"]
* resize_graph [label="Display graph and\nresize to parent", shape=record]
* apply_layout->is_component_queue
* is_component_queue [label = "Components in\nresize queue?", shape=diamond]
* is_component_queue->resize_graph [label="no"]
* resize_component [label = "Take component from\nqueue and resize\ncomponent", shape=record]
* is_component_queue->resize_component [label="yes"]
* resize_component->is_component_queue
* resize_graph->is_queue
* is_queue->end [label="no"]
* take_graph [label="Take graph from queue", shape=record]
* is_queue->take_graph [label="yes"]
* layout_graph_thread [label="Start layout graph in thread", shape=record]
* take_graph->layout_graph_thread
* layout_graph_thread->start_thread [style=dashed]
* layout_graph_thread->end
*
* start_thread [label="start thread"]
* end_thread [label="end thread"]
* layout_graph [label="Layout graph with Graphviz", shape=record]
* start_thread->layout_graph
* layout_graph->end_thread
* end_thread->is_finished_thread [style=dashed]
*
* start_change_graph [label="start change graph"]
* change_graph [label="Change a graph", shape=record]
* schedule_graph [label="Schedule a graph re-layout", shape=record]
* end_change_graph [label="end change graph"]
* start_change_graph->change_graph
* change_graph->schedule_graph
* schedule_graph->end_change_graph
* schedule_graph->is_queue [style=dashed]
*
* start_change_component [label="start change component"]
* change_component [label="Change a component", shape=record]
* schedule_component [label="Schedule a component resize", shape=record]
* schedule_graph2 [label="Schedule a graph re-layout", shape=record]
* end_change_component [label="end change component"]
* start_change_component->change_component
* change_component->schedule_component
* schedule_component->schedule_graph2
* schedule_graph2->end_change_component
* schedule_component->is_component_queue [style=dashed]
* schedule_graph2->is_queue [style=dashed]
* }
* \enddot
*/