Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
litedram
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kestrel Collaboration
Kestrel LiteX
litedram
Commits
d4c5c7ce
Commit
d4c5c7ce
authored
Jan 04, 2021
by
Florent Kermarrec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
phy/gensdrphy: compute default cl from sys_clk_freq (similar what is already done on other PHYs).
parent
e683b48c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
6 deletions
+16
-6
litedram/common.py
litedram/common.py
+6
-2
litedram/phy/gensdrphy.py
litedram/phy/gensdrphy.py
+10
-4
No files found.
litedram/common.py
View file @
d4c5c7ce
...
...
@@ -28,7 +28,10 @@ burst_lengths = {
def
get_default_cl_cwl
(
memtype
,
tck
):
f_to_cl_cwl
=
OrderedDict
()
if
memtype
==
"DDR2"
:
if
memtype
==
"SDR"
:
f_to_cl_cwl
[
100e6
]
=
(
2
,
None
)
f_to_cl_cwl
[
133e6
]
=
(
3
,
None
)
elif
memtype
==
"DDR2"
:
f_to_cl_cwl
[
400e6
]
=
(
3
,
2
)
f_to_cl_cwl
[
533e6
]
=
(
4
,
3
)
f_to_cl_cwl
[
677e6
]
=
(
5
,
4
)
...
...
@@ -49,7 +52,8 @@ def get_default_cl_cwl(memtype, tck):
else
:
raise
ValueError
for
f
,
(
cl
,
cwl
)
in
f_to_cl_cwl
.
items
():
if
tck
>=
2
/
f
:
m
=
2
if
"DDR"
in
memtype
else
1
if
tck
>=
m
/
f
:
return
cl
,
cwl
raise
ValueError
...
...
litedram/phy/gensdrphy.py
View file @
d4c5c7ce
...
...
@@ -17,15 +17,17 @@ from litedram.phy.dfi import *
# Generic SDR PHY ----------------------------------------------------------------------------------
class
GENSDRPHY
(
Module
):
def
__init__
(
self
,
pads
,
cl
=
2
):
def
__init__
(
self
,
pads
,
sys_clk_freq
=
100e6
,
cl
=
None
):
pads
=
PHYPadsCombiner
(
pads
)
addressbits
=
len
(
pads
.
a
)
bankbits
=
len
(
pads
.
ba
)
nranks
=
1
if
not
hasattr
(
pads
,
"cs_n"
)
else
len
(
pads
.
cs_n
)
databits
=
len
(
pads
.
dq
)
assert
cl
in
[
2
,
3
]
assert
databits
%
8
==
0
# Parameters -------------------------------------------------------------------------------
cl
=
get_default_cl
(
memtype
=
"SDR"
,
tck
=
1
/
sys_clk_freq
)
if
cl
is
None
else
cl
# PHY settings -----------------------------------------------------------------------------
self
.
settings
=
PhySettings
(
phytype
=
"GENSDRPHY"
,
...
...
@@ -85,7 +87,7 @@ class GENSDRPHY(Module):
# Half-rate Generic SDR PHY ------------------------------------------------------------------------
class
HalfRateGENSDRPHY
(
Module
):
def
__init__
(
self
,
pads
,
cl
=
2
):
def
__init__
(
self
,
pads
,
sys_clk_freq
=
100e6
,
cl
=
None
):
pads
=
PHYPadsCombiner
(
pads
)
addressbits
=
len
(
pads
.
a
)
bankbits
=
len
(
pads
.
ba
)
...
...
@@ -93,8 +95,12 @@ class HalfRateGENSDRPHY(Module):
databits
=
len
(
pads
.
dq
)
nphases
=
2
# Parameters -------------------------------------------------------------------------------
cl
=
get_default_cl
(
memtype
=
"SDR"
,
tck
=
1
/
sys_clk_freq
)
if
cl
is
None
else
cl
# FullRate PHY -----------------------------------------------------------------------------
full_rate_phy
=
GENSDRPHY
(
pads
,
cl
)
full_rate_phy
=
GENSDRPHY
(
pads
,
2
*
sys_clk_freq
,
cl
)
self
.
submodules
+=
ClockDomainsRenamer
(
"sys2x"
)(
full_rate_phy
)
# Clocking ---------------------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment