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
5657a565
Commit
5657a565
authored
1 year ago
by
Martin Högstedt
Browse files
Options
Downloads
Patches
Plain Diff
added comments and small changes
parent
1a649721
No related branches found
No related tags found
Loading
Pipeline
#101040
passed
1 year ago
Stage: test
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/simudator/gui/breakpoint_window.py
+1
-1
1 addition, 1 deletion
src/simudator/gui/breakpoint_window.py
src/simudator/gui/cpu_graphics_scene.py
+11
-0
11 additions, 0 deletions
src/simudator/gui/cpu_graphics_scene.py
src/simudator/gui/gui.py
+22
-2
22 additions, 2 deletions
src/simudator/gui/gui.py
with
34 additions
and
3 deletions
src/simudator/gui/breakpoint_window.py
+
1
−
1
View file @
5657a565
...
@@ -69,7 +69,7 @@ class BreakpointWindow(QWidget):
...
@@ -69,7 +69,7 @@ class BreakpointWindow(QWidget):
"""
"""
Removes all list items from the breakpoint list.
Removes all list items from the breakpoint list.
"""
"""
for
row
in
range
(
self
.
breakpoint_list
.
count
()):
for
_
in
range
(
self
.
breakpoint_list
.
count
()):
self
.
breakpoint_list
.
takeItem
(
0
)
self
.
breakpoint_list
.
takeItem
(
0
)
def
toggleEnabledClicked
(
self
)
->
None
:
def
toggleEnabledClicked
(
self
)
->
None
:
...
...
This diff is collapsed.
Click to expand it.
src/simudator/gui/cpu_graphics_scene.py
+
11
−
0
View file @
5657a565
...
@@ -37,6 +37,11 @@ class CpuGraphicsScene(QGraphicsScene):
...
@@ -37,6 +37,11 @@ class CpuGraphicsScene(QGraphicsScene):
self
.
placeModuleGraphicsItemDefault
(
graphics_item
)
self
.
placeModuleGraphicsItemDefault
(
graphics_item
)
def
placeModuleGraphicsItemDefault
(
self
,
graphics_item
:
ModuleGraphicsItem
)
->
None
:
def
placeModuleGraphicsItemDefault
(
self
,
graphics_item
:
ModuleGraphicsItem
)
->
None
:
"""
Places a module graphics items at a position where the x value
is equal to the y value. Used to place all graphics items in a
diagonal.
"""
placement
=
len
(
self
.
module_graphics_items
)
*
self
.
MODULE_SPACEING
placement
=
len
(
self
.
module_graphics_items
)
*
self
.
MODULE_SPACEING
graphics_item
.
setPos
(
placement
,
placement
)
graphics_item
.
setPos
(
placement
,
placement
)
self
.
addItem
(
graphics_item
)
self
.
addItem
(
graphics_item
)
...
@@ -46,6 +51,9 @@ class CpuGraphicsScene(QGraphicsScene):
...
@@ -46,6 +51,9 @@ class CpuGraphicsScene(QGraphicsScene):
pos_x
:
int
,
pos_x
:
int
,
pos_y
:
int
pos_y
:
int
)
->
None
:
)
->
None
:
"""
Changes the postions of an existing modules graphics item.
"""
graphics_item
.
setPos
(
pos_x
*
self
.
MODULE_SPACEING
,
graphics_item
.
setPos
(
pos_x
*
self
.
MODULE_SPACEING
,
pos_y
*
self
.
MODULE_SPACEING
)
pos_y
*
self
.
MODULE_SPACEING
)
...
@@ -101,6 +109,9 @@ class CpuGraphicsScene(QGraphicsScene):
...
@@ -101,6 +109,9 @@ class CpuGraphicsScene(QGraphicsScene):
super
().
mousePressEvent
(
event
)
super
().
mousePressEvent
(
event
)
def
load_layout_from_file
(
self
,
file_path
:
str
)
->
None
:
def
load_layout_from_file
(
self
,
file_path
:
str
)
->
None
:
"""
Loads a layout for a processor from a saved filed.
"""
file
=
open
(
file_path
)
file
=
open
(
file_path
)
graphics_item_name
=
None
graphics_item_name
=
None
...
...
This diff is collapsed.
Click to expand it.
src/simudator/gui/gui.py
+
22
−
2
View file @
5657a565
...
@@ -370,6 +370,10 @@ class GUI(QMainWindow):
...
@@ -370,6 +370,10 @@ class GUI(QMainWindow):
"""
"""
@pyqtSlot
(
str
,
str
,
str
)
@pyqtSlot
(
str
,
str
,
str
)
def
editModuleState
(
self
,
module_name
,
state
,
value
)
->
None
:
def
editModuleState
(
self
,
module_name
,
state
,
value
)
->
None
:
"""
Tries to change the value of module to value given by user
through the dialog opened by editModuleStateDialog.
"""
try
:
try
:
parsed_value
=
ast
.
literal_eval
(
value
)
parsed_value
=
ast
.
literal_eval
(
value
)
except
SyntaxError
as
e
:
except
SyntaxError
as
e
:
...
@@ -383,6 +387,10 @@ class GUI(QMainWindow):
...
@@ -383,6 +387,10 @@ class GUI(QMainWindow):
@pyqtSlot
(
str
,
str
,
str
)
@pyqtSlot
(
str
,
str
,
str
)
def
editMemoryContent
(
self
,
module_name
:
str
,
adress
:
str
,
value
:
str
)
->
None
:
def
editMemoryContent
(
self
,
module_name
:
str
,
adress
:
str
,
value
:
str
)
->
None
:
"""
Tries to change the value at adress to value given by user
through the dialog opened by editModuleStateDialog.
"""
try
:
try
:
parsed_adress
=
int
(
adress
,
16
)
parsed_adress
=
int
(
adress
,
16
)
parsed_value
=
ast
.
literal_eval
(
value
)
parsed_value
=
ast
.
literal_eval
(
value
)
...
@@ -402,6 +410,10 @@ class GUI(QMainWindow):
...
@@ -402,6 +410,10 @@ class GUI(QMainWindow):
@pyqtSlot
(
str
,
str
,
str
)
@pyqtSlot
(
str
,
str
,
str
)
def
addStateBreakpoint
(
self
,
module_name
:
str
,
state
:
str
,
value
:
str
)
->
None
:
def
addStateBreakpoint
(
self
,
module_name
:
str
,
state
:
str
,
value
:
str
)
->
None
:
"""
Tries to add a breakpoint to the module through the dialog
opened by stateBreakpointDialog.
"""
try
:
try
:
parsed_value
=
ast
.
literal_eval
(
value
)
parsed_value
=
ast
.
literal_eval
(
value
)
self
.
cpu
.
add_state_breakpoint
(
module_name
,
state
,
parsed_value
)
self
.
cpu
.
add_state_breakpoint
(
module_name
,
state
,
parsed_value
)
...
@@ -411,6 +423,10 @@ class GUI(QMainWindow):
...
@@ -411,6 +423,10 @@ class GUI(QMainWindow):
@pyqtSlot
(
str
,
str
)
@pyqtSlot
(
str
,
str
)
def
addLambdaBreakpoint
(
self
,
lambda_name
,
kwargs_str
)
->
None
:
def
addLambdaBreakpoint
(
self
,
lambda_name
,
kwargs_str
)
->
None
:
"""
Tries to add a breakpoint to the module through the dialog
opened by lambdaBreakpointDialog.
"""
try
:
try
:
lambda_kwargs
=
{}
lambda_kwargs
=
{}
for
kwarg
in
kwargs_str
.
split
(
'
'
):
for
kwarg
in
kwargs_str
.
split
(
'
'
):
...
@@ -423,6 +439,10 @@ class GUI(QMainWindow):
...
@@ -423,6 +439,10 @@ class GUI(QMainWindow):
@pyqtSlot
(
str
,
str
,
str
)
@pyqtSlot
(
str
,
str
,
str
)
def
addMemoryBreakpoint
(
self
,
module_name
:
str
,
adress
:
str
,
value
:
str
)
->
None
:
def
addMemoryBreakpoint
(
self
,
module_name
:
str
,
adress
:
str
,
value
:
str
)
->
None
:
"""
Tries to add a breakpoint to the module through the dialog
opened by memoryBreakpointDialog.
"""
try
:
try
:
parsed_adress
=
int
(
adress
,
16
)
parsed_adress
=
int
(
adress
,
16
)
parsed_value
=
ast
.
literal_eval
(
value
)
parsed_value
=
ast
.
literal_eval
(
value
)
...
@@ -600,8 +620,8 @@ class GUI(QMainWindow):
...
@@ -600,8 +620,8 @@ class GUI(QMainWindow):
def
saveLayoutToolBarButtonClick
(
self
)
->
None
:
def
saveLayoutToolBarButtonClick
(
self
)
->
None
:
"""
"""
Saves the layout of all the modules in a
human readable
Saves the layout of all the modules in a
(somewhat)
(and edit
able
)
format.
human read
able format.
Erases the previous content of the file before saving
Erases the previous content of the file before saving
the data.
the data.
"""
"""
...
...
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