Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
x393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
x393
Commits
6989d804
Commit
6989d804
authored
Mar 25, 2015
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
working on DQS+DQ inpute delays adjustment
parent
4f1a1c28
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
434 additions
and
16 deletions
+434
-16
x393_mcntrl_adjust.py
py393/x393_mcntrl_adjust.py
+369
-4
x393_mcntrl_timing.py
py393/x393_mcntrl_timing.py
+4
-2
x393_pio_sequences.py
py393/x393_pio_sequences.py
+61
-10
No files found.
py393/x393_mcntrl_adjust.py
View file @
6989d804
This diff is collapsed.
Click to expand it.
py393/x393_mcntrl_timing.py
View file @
6989d804
...
@@ -178,12 +178,14 @@ class X393McntrlTiming(object):
...
@@ -178,12 +178,14 @@ class X393McntrlTiming(object):
self
.
axi_set_phase
()
self
.
axi_set_phase
()
def
axi_set_dq_idelay
(
self
,
# sets same delay to all dq idelay
def
axi_set_dq_idelay
(
self
,
# sets same delay to all dq idelay
delay
=
None
):
# input [7:0] delay;
delay
=
None
,
# input [7:0] delay;
quiet
=
1
):
"""
"""
Set all DQ input delays to the same value
Set all DQ input delays to the same value
<delay> 8-bit (5+3) delay value to use or a tuple/list with a pair for (lane0, lane1)
<delay> 8-bit (5+3) delay value to use or a tuple/list with a pair for (lane0, lane1)
Each of the two elements in the delay tuple/list may be a a common integer or a list/tuple itself
Each of the two elements in the delay tuple/list may be a a common integer or a list/tuple itself
if delay is None will restore default values
if delay is None will restore default values
<quiet> reduce output
"""
"""
# print("====axi_set_dq_idelay %s"%str(delay))
# print("====axi_set_dq_idelay %s"%str(delay))
...
@@ -194,7 +196,7 @@ class X393McntrlTiming(object):
...
@@ -194,7 +196,7 @@ class X393McntrlTiming(object):
delay
[
1
]
.
append
(
vrlg
.
get_default_field
(
"DLY_LANE1_IDELAY"
,
i
))
delay
[
1
]
.
append
(
vrlg
.
get_default_field
(
"DLY_LANE1_IDELAY"
,
i
))
if
isinstance
(
delay
,(
int
,
long
)):
if
isinstance
(
delay
,(
int
,
long
)):
delay
=
(
delay
,
delay
)
delay
=
(
delay
,
delay
)
if
self
.
DEBUG_MODE
>
1
:
if
quiet
<
2
:
print
(
"SET DQ IDELAY="
+
hexMultiple
(
delay
))
# hexMultiple
print
(
"SET DQ IDELAY="
+
hexMultiple
(
delay
))
# hexMultiple
self
.
axi_set_multiple_delays
(
vrlg
.
LD_DLY_LANE0_IDELAY
,
0
,
8
,
delay
[
0
],
"DLY_LANE0_IDELAY"
)
self
.
axi_set_multiple_delays
(
vrlg
.
LD_DLY_LANE0_IDELAY
,
0
,
8
,
delay
[
0
],
"DLY_LANE0_IDELAY"
)
self
.
axi_set_multiple_delays
(
vrlg
.
LD_DLY_LANE1_IDELAY
,
0
,
8
,
delay
[
1
],
"DLY_LANE1_IDELAY"
)
self
.
axi_set_multiple_delays
(
vrlg
.
LD_DLY_LANE1_IDELAY
,
0
,
8
,
delay
[
1
],
"DLY_LANE1_IDELAY"
)
...
...
py393/x393_pio_sequences.py
View file @
6989d804
...
@@ -611,11 +611,13 @@ class X393PIOSequences(object):
...
@@ -611,11 +611,13 @@ class X393PIOSequences(object):
# Set MR3, read nrep*8 words, save to buffer (port0). No ACTIVATE/PRECHARGE are needed/allowed
# Set MR3, read nrep*8 words, save to buffer (port0). No ACTIVATE/PRECHARGE are needed/allowed
def
set_read_pattern
(
self
,
def
set_read_pattern
(
self
,
nrep
,
# input integer nrep;
nrep
,
# input integer nrep;
sel
=
1
,
# 0 - early, 1 - late read command (shift by a SDCLK period)
verbose
=
0
):
verbose
=
0
):
"""
"""
Setup read pattern sequence at parameter defined address in the sequencer memory
Setup read pattern sequence at parameter defined address in the sequencer memory
<nrep> number of times pattern burst is read
<nrep> number of times pattern burst is read
<sel> 0 - early, 1 - late read command (shift by a SDCLK period)
<verbose> print data being written (default: False)
<verbose> print data being written (default: False)
"""
"""
...
@@ -639,43 +641,43 @@ class X393PIOSequences(object):
...
@@ -639,43 +641,43 @@ class X393PIOSequences(object):
# first read
# first read
#@ read
#@ read
# addr bank RCW ODT CKE SEL DQEN DQSEN DQSTGL DCI B_WR B_RD NOP, B_RST
# addr bank RCW ODT CKE SEL DQEN DQSEN DQSTGL DCI B_WR B_RD NOP, B_RST
data
=
self
.
func_encode_cmd
(
0
,
0
,
2
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
1
,
0
,
0
,
0
)
data
=
self
.
func_encode_cmd
(
0
,
0
,
2
,
0
,
0
,
sel
,
0
,
0
,
0
,
1
,
1
,
0
,
0
,
0
)
self
.
x393_mem
.
axi_write_single_w
(
cmd_addr
,
data
,
verbose
)
self
.
x393_mem
.
axi_write_single_w
(
cmd_addr
,
data
,
verbose
)
cmd_addr
+=
1
cmd_addr
+=
1
# nop (combine with previous?)
# nop (combine with previous?)
# skip done bank ODT CKE SEL DQEN DQSEN DQSTGL DCI B_WR B_RD B_RST
# skip done bank ODT CKE SEL DQEN DQSEN DQSTGL DCI B_WR B_RD B_RST
data
=
self
.
func_encode_skip
(
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
1
,
0
,
0
)
data
=
self
.
func_encode_skip
(
0
,
0
,
0
,
0
,
0
,
sel
,
0
,
0
,
0
,
1
,
1
,
0
,
0
)
self
.
x393_mem
.
axi_write_single_w
(
cmd_addr
,
data
,
verbose
)
self
.
x393_mem
.
axi_write_single_w
(
cmd_addr
,
data
,
verbose
)
cmd_addr
+=
1
cmd_addr
+=
1
#repeat remaining reads
#repeat remaining reads
# for (i = 1; i < nrep; i = i + 1) begin
# for (i = 1; i < nrep; i = i + 1) begin
for
_
in
range
(
1
,
nrep
):
for
_
in
range
(
1
,
nrep
):
# addr bank RCW ODT CKE SEL DQEN DQSEN DQSTGL DCI B_WR B_RD NOP, B_RST
# addr bank RCW ODT CKE SEL DQEN DQSEN DQSTGL DCI B_WR B_RD NOP, B_RST
data
=
self
.
func_encode_cmd
(
0
,
0
,
2
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
1
,
0
,
1
,
0
)
data
=
self
.
func_encode_cmd
(
0
,
0
,
2
,
0
,
0
,
sel
,
0
,
0
,
0
,
1
,
1
,
0
,
1
,
0
)
self
.
x393_mem
.
axi_write_single_w
(
cmd_addr
,
data
,
verbose
)
self
.
x393_mem
.
axi_write_single_w
(
cmd_addr
,
data
,
verbose
)
cmd_addr
+=
1
cmd_addr
+=
1
# nop - all 3 below are the same? - just repeat?
# nop - all 3 below are the same? - just repeat?
# skip done bank ODT CKE SEL DQEN DQSEN DQSTGL DCI B_WR B_RD B_RST
# skip done bank ODT CKE SEL DQEN DQSEN DQSTGL DCI B_WR B_RD B_RST
data
=
self
.
func_encode_skip
(
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
)
data
=
self
.
func_encode_skip
(
0
,
0
,
0
,
0
,
0
,
sel
,
0
,
0
,
0
,
1
,
0
,
0
,
0
)
self
.
x393_mem
.
axi_write_single_w
(
cmd_addr
,
data
,
verbose
)
self
.
x393_mem
.
axi_write_single_w
(
cmd_addr
,
data
,
verbose
)
cmd_addr
+=
1
cmd_addr
+=
1
# nop
# nop
# skip done bank ODT CKE SEL DQEN DQSEN DQSTGL DCI B_WR B_RD B_RST
# skip done bank ODT CKE SEL DQEN DQSEN DQSTGL DCI B_WR B_RD B_RST
data
=
self
.
func_encode_skip
(
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
)
data
=
self
.
func_encode_skip
(
0
,
0
,
0
,
0
,
0
,
sel
,
0
,
0
,
0
,
1
,
0
,
0
,
0
)
self
.
x393_mem
.
axi_write_single_w
(
cmd_addr
,
data
,
verbose
)
self
.
x393_mem
.
axi_write_single_w
(
cmd_addr
,
data
,
verbose
)
cmd_addr
+=
1
cmd_addr
+=
1
# nop
# nop
# skip done bank ODT CKE SEL DQEN DQSEN DQSTGL DCI B_WR B_RD B_RST
# skip done bank ODT CKE SEL DQEN DQSEN DQSTGL DCI B_WR B_RD B_RST
data
=
self
.
func_encode_skip
(
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
)
data
=
self
.
func_encode_skip
(
0
,
0
,
0
,
0
,
0
,
sel
,
0
,
0
,
0
,
1
,
0
,
0
,
0
)
self
.
x393_mem
.
axi_write_single_w
(
cmd_addr
,
data
,
verbose
)
self
.
x393_mem
.
axi_write_single_w
(
cmd_addr
,
data
,
verbose
)
cmd_addr
+=
1
cmd_addr
+=
1
# nop, no write buffer - next page
# nop, no write buffer - next page
# skip done bank ODT CKE SEL DQEN DQSEN DQSTGL DCI B_WR B_RD B_RST
# skip done bank ODT CKE SEL DQEN DQSEN DQSTGL DCI B_WR B_RD B_RST
data
=
self
.
func_encode_skip
(
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
1
)
data
=
self
.
func_encode_skip
(
0
,
0
,
0
,
0
,
0
,
sel
,
0
,
0
,
0
,
1
,
0
,
0
,
1
)
self
.
x393_mem
.
axi_write_single_w
(
cmd_addr
,
data
,
verbose
)
self
.
x393_mem
.
axi_write_single_w
(
cmd_addr
,
data
,
verbose
)
cmd_addr
+=
1
cmd_addr
+=
1
# skip done bank ODT CKE SEL DQEN DQSEN DQSTGL DCI B_WR B_RD B_RST
# skip done bank ODT CKE SEL DQEN DQSEN DQSTGL DCI B_WR B_RD B_RST
data
=
self
.
func_encode_skip
(
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
)
data
=
self
.
func_encode_skip
(
1
,
0
,
0
,
0
,
0
,
sel
,
0
,
0
,
0
,
1
,
0
,
0
,
0
)
self
.
x393_mem
.
axi_write_single_w
(
cmd_addr
,
data
,
verbose
)
self
.
x393_mem
.
axi_write_single_w
(
cmd_addr
,
data
,
verbose
)
cmd_addr
+=
1
cmd_addr
+=
1
# Turn off read pattern mode
# Turn off read pattern mode
...
@@ -995,6 +997,55 @@ class X393PIOSequences(object):
...
@@ -995,6 +997,55 @@ class X393PIOSequences(object):
print
(
"WLEV lanes ratios:
%
f
%
f, non 0x00/0x01 bytes:
%
f"
%
(
rslt
[
0
],
rslt
[
1
],
rslt
[
2
]))
print
(
"WLEV lanes ratios:
%
f
%
f, non 0x00/0x01 bytes:
%
f"
%
(
rslt
[
0
],
rslt
[
1
],
rslt
[
2
]))
return
rslt
return
rslt
def
read_levelling
(
self
,
nrep
,
sel
=
1
,
# 0 - early, 1 - late read command (shift by a SDCLK period), -1 - use current sequence
quiet
=
1
):
"""
Read and process data in 'read patter' mode
refresh may be off, delays: cmda_edelay, dq_idelay, dqs_idelauy should be set
<nrep> number of times pattern burst is read (8-bursts), actually will be read nrep+3, nut the first/last will be discarded
<sel> 0 - early, 1 - late read command (shift by a SDCLK period)
"""
if
sel
>=
0
:
self
.
set_read_pattern
(
nrep
+
3
,
sel
)
# do not use first/last pair of the 32 bit words
buf
=
self
.
read_pattern
((
4
*
(
nrep
+
1
)
+
2
),
# num,
(
0
,
1
)[
quiet
<
1
],
# show_rslt,
1
)
# Wait for operation to complete
buf
=
buf
[
4
:]
# discard first 4*32-bit words
if
quiet
<
1
:
hbuf
=
[]
for
dd
in
buf
:
hbuf
.
append
(
hex
(
dd
))
print
(
hbuf
)
# with "good" data each word in buf should be 0xff00ff00
for
d
in
buf
:
if
d
!=
0xffffffff
:
break
else
:
# Maybe it is not needed with correct cmda_odelay ?
if
quiet
<
3
:
print
(
"Got a block of bad data during read pattern"
)
return
None
data
=
[
0
]
*
32
# for each bit - even, then for all - odd
for
w
in
range
(
4
*
nrep
):
lane
=
w
%
2
for
wb
in
range
(
32
):
g
=
(
wb
/
8
)
%
2
b
=
wb
%
8
+
lane
*
8
+
16
*
g
if
(
buf
[
w
+
2
]
&
(
1
<<
wb
)
!=
0
):
data
[
b
]
+=
1
scale
=
1.0
/
(
4
*
nrep
)
for
i
in
range
(
32
):
data
[
i
]
*=
scale
if
quiet
<
2
:
for
i
in
range
(
32
):
print
(
"
%.2
f"
%
data
[
i
],
end
=
" "
)
print
()
return
data
def
restart_ddr3
(
self
,
def
restart_ddr3
(
self
,
wait_complete
=
True
,
wait_complete
=
True
,
quiet
=
1
):
quiet
=
1
):
...
...
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