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
bfe75042
Commit
bfe75042
authored
1 year ago
by
Elias Johansson
Browse files
Options
Downloads
Patches
Plain Diff
made very simple test processor for testing generall graphics modules
parent
ec21829d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/simudator/gui/module_graphics_item/mia/__init__.py
+5
-1
5 additions, 1 deletion
src/simudator/gui/module_graphics_item/mia/__init__.py
src/simudator/processor/simple/simple.py
+89
-0
89 additions, 0 deletions
src/simudator/processor/simple/simple.py
with
94 additions
and
1 deletion
src/simudator/gui/module_graphics_item/mia/__init__.py
+
5
−
1
View file @
bfe75042
...
...
@@ -10,6 +10,9 @@ from simudator.gui.module_graphics_item.mia.mia_memory_graphic import MemoryGrap
from
simudator.gui.module_graphics_item.mia.mia_micro_memory_graphic
import
(
MicroMemoryGraphicsItem
,
)
from
simudator.gui.module_graphics_item.mia.mia_register_graphic
import
(
RegisterGraphicsItem
,
)
from
simudator.gui.module_graphics_item.mia.pc_graphic
import
PcGraphicsItem
from
simudator.gui.module_graphics_item.mia.supc_graphic
import
SupcGraphicsItem
from
simudator.gui.module_graphics_item.mia.upc_graphic
import
uPcGraphicsItem
...
...
@@ -17,5 +20,6 @@ from simudator.gui.module_graphics_item.mia.upc_graphic import uPcGraphicsItem
__all__
=
[
"
MemoryGraphicsItem
"
,
"
MicroMemoryGraphicsItem
"
,
"
ArGraphicsItem
"
,
"
PcGraphicsItem
"
,
"
AsrGraphicsItem
"
,
"
HrGraphicsItem
"
,
"
SupcGraphicsItem
"
,
"
uPcGraphicsItem
"
,
"
FlagGraphicsItem
"
,
"
BusGraphicsItem
"
,
"
AluGraphicsItem
"
,
"
GrxGraphicsItem
"
,
"
IrGraphicsItem
"
"
BusGraphicsItem
"
,
"
AluGraphicsItem
"
,
"
GrxGraphicsItem
"
,
"
IrGraphicsItem
"
,
"
RegisterGraphicsItem
"
]
This diff is collapsed.
Click to expand it.
src/simudator/processor/simple/simple.py
0 → 100644
+
89
−
0
View file @
bfe75042
import
sys
from
PyQt5.QtWidgets
import
QApplication
from
simudator.cli.cli
import
CLI
from
simudator.core.modules
import
Memory
,
Register
from
simudator.core.processor
import
Processor
,
Signal
from
simudator.gui.gui
import
GUI
from
simudator.gui.module_graphics_item.mia
import
(
MemoryGraphicsItem
,
RegisterGraphicsItem
,
)
class
SIMPLE_CPU
(
Processor
):
"""
This cpu is made to test core modules and module graphics items for these modules.
"""
def
__init__
(
self
)
->
None
:
super
().
__init__
()
# Creating all signals
# Signals follow the naming convention 'to_from'
self
.
max_line_len
=
100
# Dummy values used when the values in the constructor is not needed
# unused = Signal(self)
# Needed since optional arguments need to be in the correct order
mem_input
=
Signal
(
self
,
"
mem_input
"
)
mem_output
=
Signal
(
self
,
"
mem_output
"
)
mem_control
=
Signal
(
self
,
"
mem_control
"
)
mem_adress
=
Signal
(
self
,
"
mem_adress
"
)
register_signal
=
Signal
(
self
,
"
empty
"
)
self
.
memory
=
Memory
(
mem_input
,
mem_output
,
mem_control
,
mem_adress
,
10
)
self
.
input_register
=
Register
(
register_signal
,
mem_input
,
name
=
"
Input Reg
"
)
self
.
output_register
=
Register
(
mem_output
,
register_signal
,
name
=
"
Output Reg
"
)
self
.
control_register
=
Register
(
mem_control
,
register_signal
,
name
=
"
Control Reg
"
)
self
.
adress_register
=
Register
(
mem_adress
,
register_signal
,
name
=
"
Adress Reg
"
)
ALLTHEMODULES
=
[
self
.
memory
,
self
.
input_register
,
self
.
output_register
,
self
.
control_register
,
self
.
adress_register
]
for
module
in
ALLTHEMODULES
:
self
.
add_module
(
module
)
self
.
lambdas
=
{}
def
launch_gui
(
self
):
app
=
QApplication
(
sys
.
argv
)
self
.
reset
()
gui
=
GUI
(
self
)
gui
.
addModuleGraphicsItem
(
MemoryGraphicsItem
(
self
.
memory
))
gui
.
addModuleGraphicsItem
(
RegisterGraphicsItem
(
self
.
input_register
))
gui
.
addModuleGraphicsItem
(
RegisterGraphicsItem
(
self
.
output_register
))
gui
.
addModuleGraphicsItem
(
RegisterGraphicsItem
(
self
.
control_register
))
gui
.
addModuleGraphicsItem
(
RegisterGraphicsItem
(
self
.
adress_register
))
gui
.
addAllSignals
()
gui
.
show
()
app
.
exec
()
def
launch_cli
(
self
):
cli
=
CLI
(
self
)
self
.
reset
()
cli
.
run
()
if
__name__
==
"
__main__
"
:
# this is bad terminal code, but who cares
cpu
=
SIMPLE_CPU
()
flag
=
None
try
:
flag
=
sys
.
argv
[
1
]
except
IndexError
:
pass
if
flag
in
(
"
gui
"
,
"
g
"
,
"
-gui
"
):
cpu
.
launch_gui
()
else
:
cpu
.
launch_cli
()
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