Line 30... |
Line 30... |
reg [31:0] read_data;
|
reg [31:0] read_data;
|
begin
|
begin
|
|
|
@(posedge tb_top.app_clk)
|
@(posedge tb_top.app_clk)
|
tb_top.cpu_write(`ADDR_SPACE_SPI,'h4,{datain,24'h0});
|
tb_top.cpu_write(`ADDR_SPACE_SPI,'h4,{datain,24'h0});
|
tb_top.cpu_write(`ADDR_SPACE_SPI,'h0,{1'b1,6'h0,
|
tb_top.cpu_write(`ADDR_SPACE_SPI,'h0,{1'b1,1'h0,
|
spi_chip_no[1:0],
|
spi_chip_no[1:0],
|
2'b0, // Write Operatopm
|
2'b0, // Write Operatopm
|
2'b0, // Single Transfer
|
2'b0, // Single Transfer
|
6'h10, // sck clock period
|
8'h10, // sck clock period
|
5'h2, // cs setup/hold period
|
8'h2, // cs setup/hold period
|
8'h40 }); // cs bit information
|
8'h40 }); // cs bit information
|
|
|
tb_top.cpu_read(`ADDR_SPACE_SPI,'h0,read_data);
|
tb_top.cpu_read(`ADDR_SPACE_SPI,'h0,read_data);
|
while(read_data[31]) begin
|
while(read_data[31]) begin
|
@(posedge tb_top.app_clk) ;
|
@(posedge tb_top.app_clk) ;
|
Line 54... |
Line 54... |
input [7:0] cs_byte;
|
input [7:0] cs_byte;
|
reg [31:0] read_data;
|
reg [31:0] read_data;
|
begin
|
begin
|
@(posedge tb_top.app_clk)
|
@(posedge tb_top.app_clk)
|
tb_top.cpu_write(`ADDR_SPACE_SPI,'h4,{cmd});
|
tb_top.cpu_write(`ADDR_SPACE_SPI,'h4,{cmd});
|
tb_top.cpu_write(`ADDR_SPACE_SPI,'h0,{1'b1,6'h0,
|
tb_top.cpu_write(`ADDR_SPACE_SPI,'h0,{1'b1,1'h0,
|
spi_chip_no[1:0],
|
spi_chip_no[1:0],
|
2'b0, // Write Operatopm
|
2'b0, // Write Operatopm
|
2'h3, // 4 Transfer
|
2'h3, // 4 Transfer
|
6'h10, // sck clock period
|
8'h10, // sck clock period
|
5'h2, // cs setup/hold period
|
8'h2, // cs setup/hold period
|
cs_byte[7:0] }); // cs bit information
|
cs_byte[7:0] }); // cs bit information
|
|
|
tb_top.cpu_read(`ADDR_SPACE_SPI,'h0,read_data);
|
tb_top.cpu_read(`ADDR_SPACE_SPI,'h0,read_data);
|
while(read_data[31]) begin
|
while(read_data[31]) begin
|
@(posedge tb_top.app_clk) ;
|
@(posedge tb_top.app_clk) ;
|
Line 79... |
Line 79... |
input [7:0] cs_byte;
|
input [7:0] cs_byte;
|
reg [31:0] read_data;
|
reg [31:0] read_data;
|
begin
|
begin
|
|
|
@(posedge tb_top.app_clk)
|
@(posedge tb_top.app_clk)
|
tb_top.cpu_write(`ADDR_SPACE_SPI,'h0,{1'b1,6'h0,
|
tb_top.cpu_write(`ADDR_SPACE_SPI,'h0,{1'b1,1'h0,
|
spi_chip_no[1:0],
|
spi_chip_no[1:0],
|
2'b1, // Read Operatopm
|
2'b1, // Read Operatopm
|
2'h3, // 4 Transfer
|
2'h3, // 4 Transfer
|
6'h10, // sck clock period
|
8'h10, // sck clock period
|
5'h2, // cs setup/hold period
|
8'h2, // cs setup/hold period
|
cs_byte[7:0] }); // cs bit information
|
cs_byte[7:0] }); // cs bit information
|
|
|
tb_top.cpu_read(`ADDR_SPACE_SPI,'h0,read_data);
|
tb_top.cpu_read(`ADDR_SPACE_SPI,'h0,read_data);
|
|
|
while(read_data[31]) begin
|
while(read_data[31]) begin
|
Line 108... |
Line 108... |
reg [31:0] read_data;
|
reg [31:0] read_data;
|
begin
|
begin
|
|
|
@(posedge tb_top.app_clk) ;
|
@(posedge tb_top.app_clk) ;
|
tb_top.cpu_write(`ADDR_SPACE_SPI,'h4,{8'hD8,address[23:0]});
|
tb_top.cpu_write(`ADDR_SPACE_SPI,'h4,{8'hD8,address[23:0]});
|
tb_top.cpu_write(`ADDR_SPACE_SPI,'h0,{1'b1,6'h0,
|
tb_top.cpu_write(`ADDR_SPACE_SPI,'h0,{1'b1,1'h0,
|
spi_chip_no[1:0],
|
spi_chip_no[1:0],
|
2'b0, // Write Operatopm
|
2'b0, // Write Operatopm
|
2'h3, // 4 Transfer
|
2'h3, // 4 Transfer
|
6'h10, // sck clock period
|
8'h10, // sck clock period
|
5'h2, // cs setup/hold period
|
8'h2, // cs setup/hold period
|
8'h1 }); // cs bit information
|
8'h1 }); // cs bit information
|
|
|
tb_top.cpu_read(`ADDR_SPACE_SPI,'h0,read_data);
|
tb_top.cpu_read(`ADDR_SPACE_SPI,'h0,read_data);
|
|
|
$display("%t : %m : Sending Sector Errase for Address : %x",$time,address);
|
$display("%t : %m : Sending Sector Errase for Address : %x",$time,address);
|
Line 229... |
Line 229... |
|
|
exit_flag = 1;
|
exit_flag = 1;
|
while(exit_flag == 1) begin
|
while(exit_flag == 1) begin
|
|
|
tb_top.cpu_write(`ADDR_SPACE_SPI,'h4,{8'h05,24'h0});
|
tb_top.cpu_write(`ADDR_SPACE_SPI,'h4,{8'h05,24'h0});
|
tb_top.cpu_write(`ADDR_SPACE_SPI,'h0,{1'b1,6'h0,
|
tb_top.cpu_write(`ADDR_SPACE_SPI,'h0,{1'b1,1'h0,
|
spi_chip_no[1:0],
|
spi_chip_no[1:0],
|
2'b0, // Write Operation
|
2'b0, // Write Operation
|
2'b0, // 1 Transfer
|
2'b0, // 1 Transfer
|
6'h10, // sck clock period
|
8'h10, // sck clock period
|
5'h2, // cs setup/hold period
|
8'h2, // cs setup/hold period
|
8'h0 }); // cs bit information
|
8'h0 }); // cs bit information
|
|
|
|
|
tb_top.cpu_read(`ADDR_SPACE_SPI,'h0,read_data);
|
tb_top.cpu_read(`ADDR_SPACE_SPI,'h0,read_data);
|
while(read_data[31]) begin
|
while(read_data[31]) begin
|
Line 247... |
Line 247... |
end
|
end
|
|
|
// Send Status Request Cmd
|
// Send Status Request Cmd
|
|
|
|
|
tb_top.cpu_write(`ADDR_SPACE_SPI,'h0,{1'b1,6'h0,
|
tb_top.cpu_write(`ADDR_SPACE_SPI,'h0,{1'b1,1'h0,
|
spi_chip_no[1:0],
|
spi_chip_no[1:0],
|
2'b1, // Read Operation
|
2'b1, // Read Operation
|
2'b0, // 1 Transfer
|
2'b0, // 1 Transfer
|
6'h10, // sck clock period
|
8'h10, // sck clock period
|
5'h2, // cs setup/hold period
|
8'h2, // cs setup/hold period
|
8'h40 }); // cs bit information
|
8'h40 }); // cs bit information
|
|
|
|
|
tb_top.cpu_read(`ADDR_SPACE_SPI,'h0,read_data);
|
tb_top.cpu_read(`ADDR_SPACE_SPI,'h0,read_data);
|
while(read_data[31]) begin
|
while(read_data[31]) begin
|