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
8a4bdc26
Commit
8a4bdc26
authored
Sep 19, 2017
by
Raimundas Bastys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x393_testbench_spi.tf modified: all sensor registers checked to write-read
parent
19845e09
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
7 deletions
+25
-7
x393_testbench_spi.tf
x393_testbench_spi.tf
+25
-7
No files found.
x393_testbench_spi.tf
View file @
8a4bdc26
...
@@ -225,16 +225,36 @@ module x393_testbench_spi #(
...
@@ -225,16 +225,36 @@ module x393_testbench_spi #(
end
end
endtask
endtask
task all_regs_spi;
task all_regs_spi;
//task destroy original registers values
integer i;
integer i;
reg [6:0] adresas;
reg [6:0] adresas;
reg ok;
begin
begin
ok = 1;
adresas = 0;
adresas = 0;
for (i=0; i<128; i=i+1) begin
for (i=0; i<128; i=i+1) begin
read_spi(adresas);
read_spi(adresas);
$
display("SPI %d reg - %d =====", addr, reg_data);
$
display("SPI %d reg - %d =====", addr, reg_data);
adresas = adresas + 1;
adresas = adresas + 1;
end
end
adresas = 0;
for (i=0; i<128; i=i+1) begin
write_spi(adresas,adresas[6:0] + 8'
h80
);
adresas
=
adresas
+
1
;
end
adresas
=
0
;
for
(
i
=
0
;
i
<
128
;
i
=
i
+
1
)
begin
read_spi
(
adresas
);
if
(
addr
[
6
:
0
]
+
8
'h80 != reg_data[7:0])
ok = 0;
adresas = adresas + 1;
end
$
display("");
if ( ok == 0)
$
display("SPI registers self write-read - ERROR ===== original registers values destroyed");
else
$
display("SPI registers self write-read - OK ===== original registers values destroyed");
$
display("");
end
end
endtask
endtask
...
@@ -265,11 +285,9 @@ module x393_testbench_spi #(
...
@@ -265,11 +285,9 @@ module x393_testbench_spi #(
@(
posedge
CLK
)
;
@(
posedge
CLK
)
;
RST_CLEAN
=
0
;
RST_CLEAN
=
0
;
@(
posedge
CLK
)
;
@(
posedge
CLK
)
;
all_regs_spi
;
$display
(
"original SPI registers:"
);
write_spi
(
0
,
8
'h55);
$display
(
""
);
read_spi(0);
all_regs_spi
;
//task destroy original registers values
$
display("===================");
$
display("SPI %d reg - 0x%x =====", addr, reg_data);
#15000;
#15000;
$display
(
"normal finish testbench"
);
$display
(
"normal finish testbench"
);
...
@@ -279,7 +297,7 @@ module x393_testbench_spi #(
...
@@ -279,7 +297,7 @@ module x393_testbench_spi #(
// protect from never end
// protect from never end
initial
begin
initial
begin
#
16
0000;
#
200
0000;
$display
(
"finish testbench (before end)"
);
$display
(
"finish testbench (before end)"
);
$finish
;
$finish
;
...
...
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