Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simuDAtor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computer Engineering
simuDAtor
Commits
7bccecf1
Commit
7bccecf1
authored
9 months ago
by
Martin Högstedt
Browse files
Options
Downloads
Patches
Plain Diff
formatter
parent
d2b4cc01
No related branches found
No related tags found
No related merge requests found
Pipeline
#131686
passed
9 months ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/simudator/gui/gui.py
+25
-14
25 additions, 14 deletions
src/simudator/gui/gui.py
src/simudator/gui/pipeline.py
+2
-5
2 additions, 5 deletions
src/simudator/gui/pipeline.py
with
27 additions
and
19 deletions
src/simudator/gui/gui.py
+
25
−
14
View file @
7bccecf1
...
...
@@ -226,14 +226,18 @@ class GUI(QMainWindow):
self
.
breakpoint_action
.
triggered
.
connect
(
self
.
openBreakpointWindow
)
# Create 'update value' window button
self
.
update_value_action
=
QAction
(
"
Update values while running
"
,
self
,
checkable
=
True
)
self
.
update_value_action
=
QAction
(
"
Update values while running
"
,
self
,
checkable
=
True
)
self
.
update_value_action
.
setChecked
(
False
)
self
.
update_value_action
.
setStatusTip
(
"
Toggle value updates while running.
"
)
self
.
update_value_action
.
triggered
.
connect
(
self
.
toggle_value_update_on_run
)
# Create 'set delay' window button
self
.
set_delay_action
=
QAction
(
"
Set update delay
"
,
self
)
self
.
set_delay_action
.
setStatusTip
(
"
Sets the delay between each update when the cpu is running.
"
)
self
.
set_delay_action
.
setStatusTip
(
"
Sets the delay between each update when the cpu is running.
"
)
self
.
set_delay_action
.
triggered
.
connect
(
self
.
set_update_delay
)
# Create Tools menu for tool actions actions
...
...
@@ -256,7 +260,7 @@ class GUI(QMainWindow):
self
.
stop_action
.
triggered
.
connect
(
self
.
stopToolBarButtonClick
)
toolbar
.
addAction
(
self
.
stop_action
)
# Add Asm label
# Add Asm label
self
.
clock_cycle_label
=
QLabel
(
"
Clock cycle:
"
,
self
)
toolbar
.
addWidget
(
self
.
clock_cycle_label
)
...
...
@@ -303,7 +307,7 @@ class GUI(QMainWindow):
spacing
.
setFixedWidth
(
10
)
toolbar
.
addWidget
(
spacing
)
# Add Asm label
# Add Asm label
self
.
asm_label
=
QLabel
(
"
Assembler Instructions:
"
,
self
)
toolbar
.
addWidget
(
self
.
asm_label
)
...
...
@@ -370,7 +374,7 @@ class GUI(QMainWindow):
def
updateCpuClockCycle
(
self
)
->
None
:
"""
Update the clock cycle counter.
Update the clock cycle counter.
Used while the program is running to show the user nothing has crashed.
"""
...
...
@@ -392,7 +396,6 @@ class GUI(QMainWindow):
if
self
.
breakpoint_window
is
not
None
:
self
.
breakpoint_window
.
update
()
"""
@Slot is used to explicitly mark a python method as a Qt slot
and specify a C++ signature for it, which is used most commonly
...
...
@@ -422,7 +425,7 @@ class GUI(QMainWindow):
"""
Tries to change the value at adress to value given by user.
Does this through the dialog opened by
editModuleState
Dialog.
Does this through the dialog opened by
class MemoryContent
Dialog.
"""
try
:
parsed_adress
=
int
(
adress
,
16
)
...
...
@@ -503,7 +506,9 @@ class GUI(QMainWindow):
steps
=
self
.
jump_value_box
.
value
()
self
.
cpu_running
=
True
self
.
setDisabledWhenRunning
(
True
)
simulation_thread
=
RunThread
(
self
.
cpu
,
self
.
cpu_tick_signal
,
self
.
update_delay
,
False
,
False
,
steps
)
simulation_thread
=
RunThread
(
self
.
cpu
,
self
.
cpu_tick_signal
,
self
.
update_delay
,
False
,
False
,
steps
)
self
.
threadpool
.
start
(
simulation_thread
)
def
stepAsmToolBarButtonClick
(
self
):
...
...
@@ -518,7 +523,9 @@ class GUI(QMainWindow):
steps
=
self
.
asm_jump_value_box
.
value
()
self
.
cpu_running
=
True
self
.
setDisabledWhenRunning
(
True
)
simultaion_thread
=
RunThread
(
self
.
cpu
,
self
.
cpu_tick_signal
,
self
.
update_delay
,
False
,
True
,
steps
)
simultaion_thread
=
RunThread
(
self
.
cpu
,
self
.
cpu_tick_signal
,
self
.
update_delay
,
False
,
True
,
steps
)
self
.
threadpool
.
start
(
simultaion_thread
)
self
.
updateCpuListeners
()
...
...
@@ -550,8 +557,8 @@ class GUI(QMainWindow):
if
self
.
update_all_values
:
self
.
updateCpuListeners
()
# A signal of 0 steps signifies end of execution, i.e. the CPU has
# halted or run the specified amount of ticks
# A signal of 0 steps signifies end of execution, i.e. the CPU has
# halted or run the specified amount of ticks
# => Enable the relevant parts of the GUI again
if
steps
==
0
:
self
.
cpu_running
=
False
...
...
@@ -560,7 +567,9 @@ class GUI(QMainWindow):
# Inform user of reached break point
if
self
.
cpu
.
breakpoint_reached
:
self
.
messageBox
(
"
Reached breakpoint:
"
+
self
.
cpu
.
last_breakpoint
.
__str__
())
self
.
messageBox
(
"
Reached breakpoint:
"
+
self
.
cpu
.
last_breakpoint
.
__str__
()
)
# Inform user of halt
if
self
.
cpu
.
should_halt
():
...
...
@@ -836,13 +845,15 @@ class GUI(QMainWindow):
"""
Toggles whether all values or only clock cycle is being updated each tick.
"""
self
.
update_all_values
=
not
self
.
update_all_values
self
.
update_all_values
=
not
self
.
update_all_values
def
set_update_delay
(
self
):
"""
Sets the update delay for the visual updates while the cpu is running.
"""
delay
,
ok
=
QInputDialog
.
getDouble
(
self
,
"
Input Dialog
"
,
"
Enter a float value:
"
,
decimals
=
5
)
delay
,
ok
=
QInputDialog
.
getDouble
(
self
,
"
Input Dialog
"
,
"
Enter a float value:
"
,
decimals
=
5
)
if
ok
:
self
.
update_delay
=
delay
...
...
This diff is collapsed.
Click to expand it.
src/simudator/gui/pipeline.py
+
2
−
5
View file @
7bccecf1
from
qtpy.QtWidgets
import
QTableWidget
,
QTableWidgetItem
from
typing
import
Any
# TODO: Make the table unediatable
class
PipeLine
(
QTableWidget
):
"""
...
...
@@ -23,7 +24,6 @@ class PipeLine(QTableWidget):
self.set_item(3, 3, self.instructions[3])
"""
def
set_instruction
(
self
,
instructions
:
list
[
str
])
->
None
:
"""
Give the pipeline the current CPU instructions.
"""
self
.
instructions
=
instructions
...
...
@@ -43,7 +43,7 @@ class PipeLine(QTableWidget):
Depending on the CPU architecture the labels for each row
can change format. In a pipelined CPU we want to assign a clock cycle
to each instruction. In an ARM cpu we want the current
CPU clock cycle for the first instruciton, and something else for the
CPU clock cycle for the first instruciton, and something else for the
micro instrucitons.
"""
raise
NotImplemented
...
...
@@ -63,6 +63,3 @@ class PipeLine(QTableWidget):
item
=
QTableWidgetItem
(
text
)
self
.
setItem
(
row
,
col
,
item
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment