Commit 8a4bdc26 authored by Raimundas Bastys's avatar Raimundas Bastys

x393_testbench_spi.tf modified: all sensor registers checked to write-read

parent 19845e09
...@@ -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
#160000; #2000000;
$display("finish testbench (before end)"); $display("finish testbench (before end)");
$finish; $finish;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment