Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
HDL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RTSD
HDL
Commits
ca2319ff
Commit
ca2319ff
authored
9 years ago
by
Pepping
Browse files
Options
Downloads
Patches
Plain Diff
Renamed component to entity
parent
0e430707
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/oneclick/prestudy/components/components.py
+68
-16
68 additions, 16 deletions
tools/oneclick/prestudy/components/components.py
with
68 additions
and
16 deletions
tools/oneclick/prestudy/components/components.py
+
68
−
16
View file @
ca2319ff
...
@@ -7,6 +7,7 @@ import sys
...
@@ -7,6 +7,7 @@ import sys
import
os
import
os
import
os.path
import
os.path
import
shutil
import
shutil
import
mmm_config
# FIXME - We have a weird discrepancy here:
# FIXME - We have a weird discrepancy here:
# - user can connect components to components
# - user can connect components to components
...
@@ -148,7 +149,7 @@ class Port(object):
...
@@ -148,7 +149,7 @@ class Port(object):
self
.
pipe_end
=
src_end
self
.
pipe_end
=
src_end
other
.
pipe_end
=
snk_end
other
.
pipe_end
=
snk_end
return
Connection
(
(
self
.
compon
ent_name
,
self
.
name
),
(
other
.
compon
ent_name
,
other
.
name
)
)
return
Connection
(
(
self
.
ent
ity
_name
,
self
.
name
),
(
other
.
ent
ity
_name
,
other
.
name
)
)
def
send
(
self
,
item
):
def
send
(
self
,
item
):
self
.
pipe_end
.
send
(
item
)
self
.
pipe_end
.
send
(
item
)
...
@@ -162,16 +163,16 @@ class Port(object):
...
@@ -162,16 +163,16 @@ class Port(object):
class
Connection
():
class
Connection
():
def
__init__
(
self
,
src
,
snk
):
def
__init__
(
self
,
src
,
snk
):
self
.
src_
compon
ent_name
=
src
[
0
]
self
.
src_ent
ity
_name
=
src
[
0
]
self
.
src_port_name
=
src
[
1
]
self
.
src_port_name
=
src
[
1
]
self
.
snk_
compon
ent_name
=
snk
[
0
]
self
.
snk_ent
ity
_name
=
snk
[
0
]
self
.
snk_port_name
=
snk
[
1
]
self
.
snk_port_name
=
snk
[
1
]
self
.
vhdl_assignment_left
=
self
.
snk_
compon
ent_name
+
'
_
'
+
self
.
snk_port_name
self
.
vhdl_assignment_left
=
self
.
snk_ent
ity
_name
+
'
_
'
+
self
.
snk_port_name
self
.
vhdl_assignment_right
=
self
.
src_
compon
ent_name
+
'
_
'
+
self
.
src_port_name
self
.
vhdl_assignment_right
=
self
.
src_ent
ity
_name
+
'
_
'
+
self
.
src_port_name
self
.
vhdl_assignment_operator
=
'
<=
'
self
.
vhdl_assignment_operator
=
'
<=
'
self
.
vhdl_assignment
=
self
.
vhdl_assignment_left
+
'
'
+
self
.
vhdl_assignment_operator
+
'
'
+
self
.
vhdl_assignment_right
+
'
;
\n
'
self
.
vhdl_assignment
=
self
.
vhdl_assignment_left
+
'
'
+
self
.
vhdl_assignment_operator
+
'
'
+
self
.
vhdl_assignment_right
+
'
;
\n
'
class
Component
(
mp
.
Process
):
class
Entity
(
mp
.
Process
):
s_port_start
=
"
PORT (
\n
"
s_port_start
=
"
PORT (
\n
"
s_port_map_start
=
"
PORT MAP(
\n
"
s_port_map_start
=
"
PORT MAP(
\n
"
s_generic_start
=
"
GENERIC (
\n
"
s_generic_start
=
"
GENERIC (
\n
"
...
@@ -194,6 +195,8 @@ class Component(mp.Process):
...
@@ -194,6 +195,8 @@ class Component(mp.Process):
self
.
longestGenericName
=
1
self
.
longestGenericName
=
1
self
.
longestGenericType
=
1
self
.
longestGenericType
=
1
# print components
if
components
:
if
components
:
self
.
architecture
=
Architecture
(
'
arch_
'
+
self
.
name
,
components
,
connections
)
self
.
architecture
=
Architecture
(
'
arch_
'
+
self
.
name
,
components
,
connections
)
...
@@ -433,7 +436,7 @@ class Component(mp.Process):
...
@@ -433,7 +436,7 @@ class Component(mp.Process):
elif
i
.
type
==
"
STD_LOGIC_VECTOR(0 DOWNTO 0)
"
:
elif
i
.
type
==
"
STD_LOGIC_VECTOR(0 DOWNTO 0)
"
:
i
.
type
=
"
STD_LOGIC
"
i
.
type
=
"
STD_LOGIC
"
def
start_
component
s
(
self
):
def
start_
entitie
s
(
self
):
if
self
.
components
==
[]:
if
self
.
components
==
[]:
# This is not a composite component but a base component, start this instance itself
# This is not a composite component but a base component, start this instance itself
self
.
start
()
self
.
start
()
...
@@ -441,9 +444,9 @@ class Component(mp.Process):
...
@@ -441,9 +444,9 @@ class Component(mp.Process):
# This is a composite component, start the internal instances
# This is a composite component, start the internal instances
for
component
in
self
.
components
:
for
component
in
self
.
components
:
print
'
Starting
'
,
component
print
'
Starting
'
,
component
component
.
start_
component
s
()
component
.
start_
entitie
s
()
def
terminate_
component
s
(
self
):
def
terminate_
entitie
s
(
self
):
if
self
.
components
==
[]:
if
self
.
components
==
[]:
# This is not a composite component but a base component, terminate this instance itself
# This is not a composite component but a base component, terminate this instance itself
self
.
terminate
()
self
.
terminate
()
...
@@ -451,12 +454,12 @@ class Component(mp.Process):
...
@@ -451,12 +454,12 @@ class Component(mp.Process):
# This is a composite component, terminate the internal instances
# This is a composite component, terminate the internal instances
for
component
in
self
.
components
:
for
component
in
self
.
components
:
print
'
Terminating
'
,
component
print
'
Terminating
'
,
component
component
.
terminate_
component
s
()
component
.
terminate_
entitie
s
()
def
run_time
(
self
,
time_sec
):
def
run_time
(
self
,
time_sec
):
self
.
start_
component
s
()
self
.
start_
entitie
s
()
time
.
sleep
(
time_sec
)
time
.
sleep
(
time_sec
)
self
.
terminate_
component
s
()
self
.
terminate_
entitie
s
()
def
get_vhdl_instance
(
self
):
def
get_vhdl_instance
(
self
):
...
@@ -528,19 +531,24 @@ class Architecture(object):
...
@@ -528,19 +531,24 @@ class Architecture(object):
self
.
components
=
components
self
.
components
=
components
self
.
connections
=
connections
self
.
connections
=
connections
self
.
temp_connections
=
[]
self
.
temp_connections
=
[]
self
.
mm_regs
=
[]
self
.
constants
=
[]
self
.
constants
=
[]
self
.
signals
=
[]
self
.
signals
=
[]
self
.
components
=
[]
self
.
longestConstantName
=
0
self
.
longestConstantName
=
0
self
.
longestConstantType
=
0
self
.
longestConstantType
=
0
self
.
longestSignalName
=
0
self
.
longestSignalName
=
0
self
.
longestSignalType
=
0
self
.
longestSignalType
=
0
def
generate
(
self
,
target_vhdl_file
=
None
):
def
generate
(
self
,
target_vhdl_file
=
None
):
print
"
Generate
"
if
self
.
components
!=
[]:
# Sub-components determine the contents of this generated file (e.g. top level)
if
self
.
components
!=
[]:
# Sub-components determine the contents of this generated file (e.g. top level)
target_vhdl_file
=
open
(
self
.
vhdl_file_name
,
"
w
"
)
# target_vhdl_file = open(self.vhdl_file_name, "w")
for
component
in
self
.
components
:
for
registerSpan
in
component
.
mm_regs
:
self
.
mm_regs
.
append
(
registerSpan
)
def
add_constant
(
self
,
name
,
type
,
value
=
""
):
def
add_constant
(
self
,
name
,
type
,
value
=
""
):
newConstant
=
Constant
(
name
,
type
,
value
)
newConstant
=
Constant
(
name
,
type
,
value
)
...
@@ -608,3 +616,47 @@ class Architecture(object):
...
@@ -608,3 +616,47 @@ class Architecture(object):
signalTypes
.
append
(
self
.
signals
[
i
].
type
)
signalTypes
.
append
(
self
.
signals
[
i
].
type
)
self
.
longestSignalType
=
len
(
max
(
signalTypes
,
key
=
len
))
self
.
longestSignalType
=
len
(
max
(
signalTypes
,
key
=
len
))
class
MmmEntity
(
Entity
):
def
__init__
(
self
,
name
,
slave_components
,
synth_master
=
'
QSYS
'
):
Entity
.
__init__
(
self
,
name
)
self
.
slave_components
=
slave_components
self
.
synth_master
=
'
QSYS
'
self
.
mmmconfig
=
mmm_config
.
MmmConfig
(
mmmLibraryName
=
name
)
# Create mmm_conf dictionary based on included slave components.
if
self
.
slave_components
!=
[]:
# Sub-components determine the contents of this generated file (e.g. top level)
for
component
in
self
.
slave_components
:
for
registerSpan
in
component
.
mm_regs
:
self
.
mmmconfig
.
add_peripheral
(
registerSpan
)
for
registerSpan
in
self
.
mmmconfig
.
peripherals
:
print
registerSpan
# Add default generics
self
.
add_generic
(
"
g_sim
"
,
"
BOOLEAN
"
,
"
FALSE
"
)
self
.
add_generic
(
"
g_sim_unb_nr
"
,
"
NATURAL
"
,
"
0
"
)
self
.
add_generic
(
"
g_sim_node_nr
"
,
"
NATURAL
"
,
"
0
"
)
# Add input clks
if
"
mm_clk
"
in
self
.
mmmconfig
.
input_clks
:
self
.
add_port
(
"
mm_clk
"
,
"
IN
"
,
"
STD_LOGIC
"
,
"
\'
1
\'
"
)
self
.
add_port
(
"
mm_rst
"
,
"
IN
"
,
"
STD_LOGIC
"
,
"
\'
1
\'
"
)
# Add UNB1 board peripherals
for
s
in
self
.
mmmconfig
.
peripherals
:
# Extra signals for ethernet peripheral
if
(
s
[
0
]
==
"
eth1g_ram
"
):
#self.add_port("eth1g_tse_clk", "OUT", "STD_LOGIC")
self
.
add_port
(
"
eth1g_mm_rst
"
,
"
OUT
"
,
"
STD_LOGIC
"
)
self
.
add_port
(
"
eth1g_reg_interrupt
"
,
"
IN
"
,
"
STD_LOGIC
"
)
# Extra signal for Watchdog interface
if
(
s
[
0
]
==
"
reg_wdi
"
):
self
.
add_port
(
"
pout_wdi
"
,
"
OUT
"
,
"
STD_LOGIC
"
,
"
\'
1
\'
"
)
self
.
add_port
(
s
[
0
]
+
"
_mosi
"
,
"
OUT
"
,
"
t_mem_mosi
"
)
self
.
add_port
(
s
[
0
]
+
"
_miso
"
,
"
IN
"
,
"
t_mem_miso
"
,
"
c_mem_miso_rst
"
)
print
self
.
make_instantiation_string
()
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