-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.qml
190 lines (180 loc) · 4.71 KB
/
main.qml
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
import QtQuick 2.11
import QtQuick.Window 2.11
import QtQuick.Extras 1.4
import QtQuick.Controls 1.6
import QtQuick.Dialogs 1.2
import Qt.labs.settings 1.0
ApplicationWindow {
visible: true
width: 640
height: 480
maximumWidth: width
maximumHeight: height
title: qsTr("uRiscSim")
menuBar: MenuBar {
Menu {
title: "File"
MenuItem {
text: "Load Flash"
onTriggered: {
loadFlashDialog.visible = true
}
}
MenuItem {
text: "Exit"
onTriggered: Qt.quit()
}
}
}
TextArea {
x: 50
y: 100
id: serialOutput
readOnly: true
text: riscvCore.serialString
}
Text {
anchors.left: gpioOutputRect.left
anchors.bottom: gpioOutputRect.top
id: gpioOutputRectLabel
text: qsTr("GPIO - Output")
}
Rectangle {
id: gpioOutputRect
anchors.top: serialOutput.top
anchors.left: serialOutput.right
anchors.leftMargin: 33
width: 266
height: 60
color: "transparent"
border.width: 2
Row {
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
spacing: 20
StatusIndicator {
id: si1
active: (riscvCore.gpo & 0x1) != 0
}
StatusIndicator {
id: si2
active: (riscvCore.gpo & 0x2) != 0
}
StatusIndicator {
id: si3
active: (riscvCore.gpo & 0x4) != 0
}
StatusIndicator {
id: si4
active: (riscvCore.gpo & 0x8) != 0
}
}
}
Text {
anchors.left: gpioInputRect.left
anchors.bottom: gpioInputRect.top
id: gpioInputRectLabel
text: qsTr("GPIO - Input")
}
Rectangle {
id: gpioInputRect
anchors.top: gpioOutputRect.bottom
anchors.left: gpioOutputRect.left
anchors.topMargin: 33
width: 266
height: 60
color: "transparent"
border.width: 2
Row {
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
spacing: 10
ToggleButton {
id: tb1
height: 55
width: height
onClicked:
{
riscvCore.gpiChanged(0, checked)
}
}
ToggleButton {
id: tb2
height: 55
width: height
onClicked:
{
riscvCore.gpiChanged(1, checked)
}
}
ToggleButton {
id: tb3
height: 55
width: height
onClicked:
{
riscvCore.gpiChanged(2, checked)
}
}
ToggleButton {
id: tb4
height: 55
width: height
onClicked:
{
riscvCore.gpiChanged(3, checked)
}
}
}
}
Rectangle {
id: controllsRect
height: 60
width : 266
color: "transparent"
anchors.top: serialOutput.bottom
anchors.left: serialOutput.left
anchors.topMargin: 50
Column {
spacing: 20
Row {
Button {
id: playBtn
text: riscvCore.rpString
onClicked: riscvCore.runPauseCore()
}
Button {
id: pauseBtn
text: "Stop"
onClicked: riscvCore.stopCore()
}
Button {
id: resetBtn
text: "Reset"
onClicked: riscvCore.resetCore()
}
}
Row {
spacing: 10
Text {
anchors.verticalCenter: pcVal.verticalCenter
text: "PC: "
}
TextField {
id: pcVal
readOnly: true
text: "0x" + riscvCore.pc.toString(16)
}
}
}
}
FileDialog {
id: loadFlashDialog
title: "Choose Flash to Load"
folder: shortcuts.home
onAccepted: {
console.log("Load Rom")
riscvCore.loadRom(fileUrl);
}
}
}