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
a850f778
Commit
a850f778
authored
10 months ago
by
Martin Högstedt
Browse files
Options
Downloads
Patches
Plain Diff
stepping over asm instructions now works
parent
af4a5d7b
No related branches found
No related tags found
1 merge request
!13
We know have asm instructions, can step forward and backward between clock cycle and asm instructions
Pipeline
#131557
failed
10 months ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/simudator/gui/gui.py
+4
-5
4 additions, 5 deletions
src/simudator/gui/gui.py
src/simudator/gui/run_continuously_thread.py
+29
-15
29 additions, 15 deletions
src/simudator/gui/run_continuously_thread.py
with
33 additions
and
20 deletions
src/simudator/gui/gui.py
+
4
−
5
View file @
a850f778
...
...
@@ -310,14 +310,14 @@ class GUI(QMainWindow):
backward_arrow_icon
=
self
.
style
().
standardIcon
(
QStyle
.
SP_MediaSeekBackward
)
self
.
undo_asm_action
=
QAction
(
backward_arrow_icon
,
"
Undo Asm
"
,
self
)
self
.
undo_asm_action
.
setStatusTip
(
"
Undo the last assembler instruction
"
)
self
.
undo_asm_action
.
triggered
.
connect
(
self
.
undoToolBarButtonClick
)
self
.
undo_asm_action
.
triggered
.
connect
(
self
.
undo
Asm
ToolBarButtonClick
)
toolbar
.
addAction
(
self
.
undo_asm_action
)
# Add step button on toolbar
forward_arrow_icon
=
self
.
style
().
standardIcon
(
QStyle
.
SP_MediaSeekForward
)
self
.
step_asm_action
=
QAction
(
forward_arrow_icon
,
"
Step Asm
"
,
self
)
self
.
step_asm_action
.
setStatusTip
(
"
Run one assembler instruction
"
)
self
.
step_asm_action
.
triggered
.
connect
(
self
.
stepToolBarButtonClick
)
self
.
step_asm_action
.
triggered
.
connect
(
self
.
step
Asm
ToolBarButtonClick
)
toolbar
.
addAction
(
self
.
step_asm_action
)
# Add box for jump value
...
...
@@ -502,7 +502,7 @@ 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
,
steps
)
simulation_thread
=
RunThread
(
self
.
cpu
,
self
.
cpu_tick_signal
,
self
.
update_delay
,
False
,
False
,
steps
)
self
.
threadpool
.
start
(
simulation_thread
)
def
stepAsmToolBarButtonClick
(
self
):
...
...
@@ -517,8 +517,7 @@ class GUI(QMainWindow):
steps
=
self
.
asm_jump_value_box
.
value
()
self
.
cpu_running
=
True
self
.
setDisabledWhenRunning
(
True
)
self
.
cpu
.
unstop
()
simultaion_thread
=
RunThread
(
self
.
cpu
,
self
.
halted_signal
,
False
,
steps
)
simultaion_thread
=
RunThread
(
self
.
cpu
,
self
.
cpu_tick_signal
,
self
.
update_delay
,
False
,
True
,
steps
)
self
.
threadpool
.
start
(
simultaion_thread
)
self
.
updateCpuListeners
()
...
...
This diff is collapsed.
Click to expand it.
src/simudator/gui/run_continuously_thread.py
+
29
−
15
View file @
a850f778
...
...
@@ -8,40 +8,54 @@ class RunThread(QRunnable):
a seperate thread. This allows the user to interact with the GUI while the
simulation is running.
After each
cpu
tick, this thread will emit to its given QT signal so that
After each
CPU
tick, this thread will emit to its given QT signal so that
the GUI can update itself and possibly inform the user of when the execution
has halted.
"""
def
__init__
(
self
,
cpu
,
signal
,
delay
:
float
,
run_continuously
=
True
,
steps
=
0
):
def
__init__
(
self
,
cpu
,
signal
,
delay
:
float
,
run_continuously
=
True
,
is_asm_instruciton
=
False
,
steps
=
0
):
super
().
__init__
()
self
.
cpu
=
cpu
self
.
signal
=
signal
self
.
run_continuously
=
run_continuously
self
.
steps
=
steps
self
.
delay
=
delay
self
.
is_asm_instruciton
=
is_asm_instruciton
def
run
(
self
):
if
self
.
run_continuously
:
self
.
cpu
.
unstop
()
while
not
self
.
cpu
.
is_stopped
:
self
.
cpu
.
do_tick
()
self
.
signal
.
emit
(
1
)
time
.
sleep
(
self
.
delay
)
if
self
.
is_asm_instruciton
:
else
:
for
_
in
range
(
self
.
steps
):
while
self
.
steps
>
0
:
self
.
cpu
.
do_tick
()
# We only care about asm instructions
if
self
.
cpu
.
is_new_instruction
():
self
.
steps
-=
1
self
.
signal
.
emit
(
1
)
time
.
sleep
(
self
.
delay
)
if
self
.
cpu
.
is_stopped
:
break
# Signal end of execution as having run 0 ticks
self
.
signal
.
emit
(
0
)
def
run_asm
(
self
):
self
.
cpu
.
run_asm
(
self
.
steps
)
else
:
if
self
.
run_continuously
:
self
.
cpu
.
unstop
()
while
not
self
.
cpu
.
is_stopped
:
self
.
cpu
.
do_tick
()
self
.
signal
.
emit
(
1
)
time
.
sleep
(
self
.
delay
)
else
:
for
_
in
range
(
self
.
steps
):
self
.
cpu
.
do_tick
()
self
.
signal
.
emit
(
1
)
time
.
sleep
(
self
.
delay
)
if
self
.
cpu
.
is_stopped
:
break
# Signal end of execution as having run 0 ticks
self
.
signal
.
emit
(
0
)
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