Line 35... |
Line 35... |
//// ////
|
//// ////
|
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
|
|
// CVS Log
|
// CVS Log
|
//
|
//
|
// $Id: tests.v,v 1.5 2001-11-13 00:45:19 rudi Exp $
|
// $Id: tests.v,v 1.6 2001-11-29 02:17:36 rudi Exp $
|
//
|
//
|
// $Date: 2001-11-13 00:45:19 $
|
// $Date: 2001-11-29 02:17:36 $
|
// $Revision: 1.5 $
|
// $Revision: 1.6 $
|
// $Author: rudi $
|
// $Author: rudi $
|
// $Locker: $
|
// $Locker: $
|
// $State: Exp $
|
// $State: Exp $
|
//
|
//
|
// Change History:
|
// Change History:
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
|
// Revision 1.5 2001/11/13 00:45:19 rudi
|
|
//
|
|
// Just minor test bench update, syncing all the files.
|
|
//
|
// Revision 1.4 2001/11/11 01:52:03 rudi
|
// Revision 1.4 2001/11/11 01:52:03 rudi
|
//
|
//
|
// Minor fixes to testbench ...
|
// Minor fixes to testbench ...
|
//
|
//
|
// Revision 1.3 2001/09/02 02:29:43 rudi
|
// Revision 1.3 2001/09/02 02:29:43 rudi
|
Line 228... |
Line 232... |
2: del_max = 4;
|
2: del_max = 4;
|
endcase
|
endcase
|
|
|
size = 4;
|
size = 4;
|
del = 1;
|
del = 1;
|
mode = 0;
|
mode = 2;
|
write = 0;
|
write = 0;
|
//force sdram0.Debug = 1;
|
//force sdram0.Debug = 1;
|
|
|
for(mode=0;mode<10;mode=mode+1)
|
for(mode=0;mode<10;mode=mode+1)
|
begin
|
begin
|
Line 378... |
Line 382... |
endcase
|
endcase
|
|
|
case(quick)
|
case(quick)
|
0: del_max = 16;
|
0: del_max = 16;
|
1: del_max = 8;
|
1: del_max = 8;
|
2: del_max = 4;
|
2: del_max = 6;
|
endcase
|
endcase
|
|
|
size = 4;
|
size = 4;
|
del = 1;
|
del = 0;
|
mode = 9;
|
mode = 2;
|
write = 0;
|
write = 0;
|
//force sdram0.Debug = 1;
|
//force sdram0.Debug = 1;
|
|
|
for(mode=0;mode<10;mode=mode+1)
|
for(mode=0;mode<10;mode=mode+1)
|
begin
|
begin
|
Line 529... |
Line 533... |
endcase
|
endcase
|
|
|
case(quick)
|
case(quick)
|
0: del_max = 16;
|
0: del_max = 16;
|
1: del_max = 8;
|
1: del_max = 8;
|
2: del_max = 4;
|
2: del_max = 6;
|
endcase
|
endcase
|
|
|
size = 1;
|
size = 1;
|
del = 0;
|
del = 2;
|
mode = 19;
|
mode = 16;
|
read = 1;
|
read = 1;
|
//force sdram0.Debug = 1;
|
//force sdram0.Debug = 1;
|
|
|
for(mode=0;mode<20;mode=mode+1)
|
for(mode=0;mode<20;mode=mode+1)
|
begin
|
begin
|
Line 582... |
Line 586... |
for(del=0;del<del_max;del=del+1)
|
for(del=0;del<del_max;del=del+1)
|
for(size=sz_inc;size<sz_max;size=size+sz_inc)
|
for(size=sz_inc;size<sz_max;size=size+sz_inc)
|
begin
|
begin
|
m0.mem_fill;
|
m0.mem_fill;
|
|
|
if(verbose) $display("Mode: %b, Size: %0d, Delay: %0d", mode, size, del);
|
if(verbose) $display("Mode: %b, Size: %0d, Delay: %0d (%t)", mode, size, del, $time);
|
|
|
m0.wb_wr_mult(`MEM_BASE + 0, 4'hf, del, size);
|
m0.wb_wr_mult(`MEM_BASE + 0, 4'hf, del, size);
|
if(read) m0.wb_rd_mult(`MEM_BASE + 0, 4'hf, del, size);
|
if(read) m0.wb_rd_mult(`MEM_BASE + 0, 4'hf, del, size);
|
|
|
m0.wb_wr_mult(`MEM_BASE + size*1*4, 4'hf, del, size);
|
m0.wb_wr_mult(`MEM_BASE + size*1*4, 4'hf, del, size);
|
Line 1338... |
Line 1342... |
for(bas=0;bas<2;bas=bas+1)
|
for(bas=0;bas<2;bas=bas+1)
|
begin
|
begin
|
m0.wb_wr1(`REG_BASE + `CSC0, 4'hf, 32'h0000_0421 | (bas[0]<<9));
|
m0.wb_wr1(`REG_BASE + `CSC0, 4'hf, 32'h0000_0421 | (bas[0]<<9));
|
|
|
size = 2;
|
size = 2;
|
del = 0;
|
del = 3;
|
mode = 8;
|
mode = 0;
|
write = 1;
|
write = 1;
|
//force sdram0.Debug = 1;
|
//force sdram0.Debug = 1;
|
|
|
for(mode=0;mode<10;mode=mode+1)
|
for(mode=0;mode<10;mode=mode+1)
|
begin
|
begin
|
Line 1386... |
Line 1390... |
begin
|
begin
|
m0.mem_fill;
|
m0.mem_fill;
|
if(verbose) $display("BAS: %0d, Mode: %b, Size: %0d, Delay: %0d",
|
if(verbose) $display("BAS: %0d, Mode: %b, Size: %0d, Delay: %0d",
|
bas, mode, size, del);
|
bas, mode, size, del);
|
|
|
|
//$display("Accessing Bank 0");
|
if(write)
|
if(write)
|
m0.wb_wr_mult(`MEM_BASE + (page_size*0*4) + size*0*4, 4'hf, del, size);
|
m0.wb_wr_mult(`MEM_BASE + (page_size*0*4) + size*0*4, 4'hf, del, size);
|
m0.wb_rd_mult(`MEM_BASE + (page_size*0*4) + size*0*4, 4'hf, del, size);
|
m0.wb_rd_mult(`MEM_BASE + (page_size*0*4) + size*0*4, 4'hf, del, size);
|
if(write)
|
if(write)
|
m0.wb_wr_mult(`MEM_BASE + (page_size*0*4) + size*1*4, 4'hf, del, size);
|
m0.wb_wr_mult(`MEM_BASE + (page_size*0*4) + size*1*4, 4'hf, del, size);
|
m0.wb_rd_mult(`MEM_BASE + (page_size*0*4) + size*1*4, 4'hf, del, size);
|
m0.wb_rd_mult(`MEM_BASE + (page_size*0*4) + size*1*4, 4'hf, del, size);
|
|
|
|
//$display("Accessing Bank 1");
|
if(write)
|
if(write)
|
m0.wb_wr_mult(`MEM_BASE + (page_size*1*4) + size*2*4, 4'hf, del, size);
|
m0.wb_wr_mult(`MEM_BASE + (page_size*1*4) + size*2*4, 4'hf, del, size);
|
m0.wb_rd_mult(`MEM_BASE + (page_size*1*4) + size*2*4, 4'hf, del, size);
|
m0.wb_rd_mult(`MEM_BASE + (page_size*1*4) + size*2*4, 4'hf, del, size);
|
if(write)
|
if(write)
|
m0.wb_wr_mult(`MEM_BASE + (page_size*1*4) + size*3*4, 4'hf, del, size);
|
m0.wb_wr_mult(`MEM_BASE + (page_size*1*4) + size*3*4, 4'hf, del, size);
|
m0.wb_rd_mult(`MEM_BASE + (page_size*1*4) + size*3*4, 4'hf, del, size);
|
m0.wb_rd_mult(`MEM_BASE + (page_size*1*4) + size*3*4, 4'hf, del, size);
|
|
|
|
//$display("Accessing Bank 2");
|
if(write)
|
if(write)
|
m0.wb_wr_mult(`MEM_BASE + (page_size*2*4) + size*4*4, 4'hf, del, size);
|
m0.wb_wr_mult(`MEM_BASE + (page_size*2*4) + size*4*4, 4'hf, del, size);
|
m0.wb_rd_mult(`MEM_BASE + (page_size*2*4) + size*4*4, 4'hf, del, size);
|
m0.wb_rd_mult(`MEM_BASE + (page_size*2*4) + size*4*4, 4'hf, del, size);
|
if(write)
|
if(write)
|
m0.wb_wr_mult(`MEM_BASE + (page_size*2*4) + size*5*4, 4'hf, del, size);
|
m0.wb_wr_mult(`MEM_BASE + (page_size*2*4) + size*5*4, 4'hf, del, size);
|
m0.wb_rd_mult(`MEM_BASE + (page_size*2*4) + size*5*4, 4'hf, del, size);
|
m0.wb_rd_mult(`MEM_BASE + (page_size*2*4) + size*5*4, 4'hf, del, size);
|
|
|
|
//$display("Accessing Bank 3");
|
if(write)
|
if(write)
|
m0.wb_wr_mult(`MEM_BASE + (page_size*3*4) + size*6*4, 4'hf, del, size);
|
m0.wb_wr_mult(`MEM_BASE + (page_size*3*4) + size*6*4, 4'hf, del, size);
|
m0.wb_rd_mult(`MEM_BASE + (page_size*3*4) + size*6*4, 4'hf, del, size);
|
m0.wb_rd_mult(`MEM_BASE + (page_size*3*4) + size*6*4, 4'hf, del, size);
|
if(write)
|
if(write)
|
m0.wb_wr_mult(`MEM_BASE + (page_size*3*4) + size*7*4, 4'hf, del, size);
|
m0.wb_wr_mult(`MEM_BASE + (page_size*3*4) + size*7*4, 4'hf, del, size);
|
Line 1510... |
Line 1518... |
endcase
|
endcase
|
|
|
case(quick)
|
case(quick)
|
0: del_max = 16;
|
0: del_max = 16;
|
1: del_max = 8;
|
1: del_max = 8;
|
2: del_max = 4;
|
2: del_max = 8;
|
endcase
|
endcase
|
|
|
size = 1;
|
size = 1;
|
del = 0;
|
del = 3;
|
mode = 8;
|
mode = 4;
|
read = 1;
|
read = 1;
|
|
|
for(mode=0;mode<20;mode=mode+1)
|
for(mode=0;mode<20;mode=mode+1)
|
begin
|
begin
|
|
|
Line 1718... |
Line 1726... |
m0.wb_wr1(`REG_BASE + `CSC1, 4'hf, 32'h0020_0021 | (bas[0]<<9));
|
m0.wb_wr1(`REG_BASE + `CSC1, 4'hf, 32'h0020_0021 | (bas[0]<<9));
|
m0.wb_wr1(`REG_BASE + `CSC2, 4'hf, 32'h0040_0421 | (bas[0]<<9));
|
m0.wb_wr1(`REG_BASE + `CSC2, 4'hf, 32'h0040_0421 | (bas[0]<<9));
|
|
|
size = 2;
|
size = 2;
|
del = 0;
|
del = 0;
|
mode = 8;
|
mode = 4;
|
write = 1;
|
write = 1;
|
if(0)
|
if(0)
|
begin
|
begin
|
force sdram0.Debug = 1;
|
force sdram0.Debug = 1;
|
force sdram1.Debug = 1;
|
force sdram1.Debug = 1;
|
Line 2032... |
Line 2040... |
1: del_max = 8;
|
1: del_max = 8;
|
2: del_max = 8;
|
2: del_max = 8;
|
endcase
|
endcase
|
|
|
size = 5;
|
size = 5;
|
del = 1;
|
del = 0;
|
mode = 6;
|
mode = 0;
|
read = 1;
|
read = 1;
|
|
|
if(0)
|
if(0)
|
begin
|
begin
|
force sdram0.Debug = 1;
|
force sdram0.Debug = 1;
|
Line 2236... |
Line 2244... |
endtask
|
endtask
|
|
|
`endif
|
`endif
|
|
|
|
|
|
task rmw_cross1;
|
|
input quick;
|
|
|
|
integer quick;
|
|
integer x,s,n,m,adr;
|
|
integer del, size;
|
|
reg [7:0] mode, a_mode;
|
|
reg [2:0] bs;
|
|
integer sz_inc;
|
|
integer sz_max, del_max;
|
|
integer read;
|
|
reg [2:0] bas;
|
|
reg [31:0] data, exp;
|
|
integer page_size;
|
|
integer cycle;
|
|
|
|
begin
|
|
$display("\n\n");
|
|
$display("*****************************************************");
|
|
$display("*** RMW CS Cross Test 1 ... ***");
|
|
$display("*****************************************************\n");
|
|
|
|
page_size = 256; // 64 mbit x 32 SDRAM
|
|
|
|
m0.wb_wr1(`REG_BASE + `CSR, 4'hf, 32'h6030_0300);
|
|
m0.wb_wr1(`REG_BASE + `BA_MASK, 4'hf, 32'h0000_00f0);
|
|
|
|
m0.wb_wr1(`REG_BASE + `TMS3, 4'hf, 32'hffff_f40c);
|
|
|
|
m0.wb_wr1(`REG_BASE + `TMS0, 4'hf, {
|
|
4'd0, // RESERVED [31:28]
|
|
4'd7, // Trfc [27:24]
|
|
4'd2, // Trp [23:20]
|
|
3'd2, // Trcd [19:17]
|
|
2'd1, // Twr [16:15]
|
|
5'd0, // RESERVED [14:10]
|
|
1'd0, // Wr. Burst Len (1=Single)
|
|
2'd0, // Op Mode
|
|
3'd2, // CL
|
|
1'b0, // Burst Type (0=Seq;1=Inter)
|
|
3'd3 // Burst Length
|
|
});
|
|
|
|
m0.wb_wr1(`REG_BASE + `CSC0, 4'hf, 32'h0000_0821);
|
|
|
|
case(quick)
|
|
0: sz_max = 32;
|
|
1: sz_max = 16;
|
|
2: sz_max = 8;
|
|
endcase
|
|
|
|
case(quick)
|
|
0: del_max = 16;
|
|
1: del_max = 8;
|
|
2: del_max = 4;
|
|
endcase
|
|
|
|
size = 16;
|
|
del = 0;
|
|
mode = 4;
|
|
a_mode = 0;
|
|
read = 1;
|
|
write = 1;
|
|
cycle = 1;
|
|
|
|
for(cycle=0;cycle<7;cycle = cycle + 1)
|
|
for(mode=0;mode<19;mode=mode+1)
|
|
for(a_mode=0;a_mode<3;a_mode=a_mode+1)
|
|
begin
|
|
|
|
repeat(1) @(posedge clk);
|
|
|
|
sdram0.mem_fill(1024);
|
|
|
|
case(mode[4:2])
|
|
0: bs = 0;
|
|
1: bs = 1;
|
|
2: bs = 2;
|
|
3: bs = 3;
|
|
4: bs = 7;
|
|
endcase
|
|
|
|
case(mode[4:2])
|
|
0: sz_inc = 1;
|
|
1: sz_inc = 2;
|
|
2: sz_inc = 4;
|
|
3: sz_inc = 8;
|
|
4: sz_inc = 1;
|
|
endcase
|
|
|
|
|
|
m0.wb_wr1(`REG_BASE + `TMS0, 4'hf, {
|
|
4'd0, // RESERVED [31:28]
|
|
4'd7, // Trfc [27:24]
|
|
4'd2, // Trp [23:20]
|
|
3'd2, // Trcd [19:17]
|
|
2'd1, // Twr [16:15]
|
|
5'd0, // RESERVED [14:10]
|
|
1'd0+mode[1], // Wr. Burst Len (1=Single)
|
|
2'd0, // Op Mode
|
|
3'd2+mode[0], // CL
|
|
1'b0, // Burst Type (0=Seq;1=Inter)
|
|
3'd0+bs // Burst Length
|
|
});
|
|
|
|
case(a_mode)
|
|
0: m0.wb_wr1(`REG_BASE + `CSC3, 4'hf, 32'h0060_0025); // 32 bit bus
|
|
1: m0.wb_wr1(`REG_BASE + `CSC3, 4'hf, 32'h0060_0005); // 8 bit bus
|
|
2: m0.wb_wr1(`REG_BASE + `CSC3, 4'hf, 32'h0060_0015); // 16 bit bus
|
|
endcase
|
|
|
|
repeat(10) @(posedge clk);
|
|
if(!verbose) $display("Mode: %b", mode);
|
|
|
|
for(del=0;del<del_max;del=del+1)
|
|
for(size=sz_inc;size<sz_max;size=size+sz_inc)
|
|
begin
|
|
m0.mem_fill;
|
|
for(n=0;n<1024;n=n+1)
|
|
m0.wr_mem[n] = {n[15:0],n[15:0]};
|
|
|
|
if(verbose) $display("Mode: %0d, A_mode: %0d, Size: %0d, Delay: %0d, Cyc. Delay: %0d", mode, a_mode, size, del, cycle);
|
|
|
|
repeat(cycle) @(posedge clk);
|
|
m0.wb_rmw2(`MEM_BASE3 + size*0*4,
|
|
`MEM_BASE + (page_size*0*4) + size*0*4, 4'hf, del, size, size);
|
|
|
|
repeat(cycle) @(posedge clk);
|
|
m0.wb_rmw2(`MEM_BASE3 + size*1*4,
|
|
`MEM_BASE + (page_size*0*4) + size*1*4, 4'hf, del, size, size);
|
|
|
|
repeat(cycle) @(posedge clk);
|
|
m0.wb_rmw2(`MEM_BASE3 + size*2*4,
|
|
`MEM_BASE + (page_size*1*4) + size*2*4, 4'hf, del, size, size);
|
|
|
|
repeat(cycle) @(posedge clk);
|
|
m0.wb_rmw2(`MEM_BASE3 + size*3*4,
|
|
`MEM_BASE + (page_size*1*4) + size*3*4, 4'hf, del, size, size);
|
|
|
|
repeat(cycle) @(posedge clk);
|
|
m0.wb_rmw2(`MEM_BASE3 + size*4*4,
|
|
`MEM_BASE + (page_size*2*4) + size*4*4, 4'hf, del, size, size);
|
|
|
|
repeat(cycle) @(posedge clk);
|
|
m0.wb_rmw2(`MEM_BASE3 + size*5*4,
|
|
`MEM_BASE + (page_size*2*4) + size*5*4, 4'hf, del, size, size);
|
|
|
|
repeat(cycle) @(posedge clk);
|
|
m0.wb_rmw2(`MEM_BASE3 + size*6*4,
|
|
`MEM_BASE + (page_size*3*4) + size*6*4, 4'hf, del, size, size);
|
|
|
|
repeat(cycle) @(posedge clk);
|
|
m0.wb_rmw2(`MEM_BASE3 + size*7*4,
|
|
`MEM_BASE + (page_size*3*4) + size*7*4, 4'hf, del, size, size);
|
|
|
|
|
|
repeat(10) @(posedge clk);
|
|
|
|
x = 0;
|
|
for(n=0;n<(size*8);n=n+1)
|
|
begin
|
|
|
|
case(a_mode)
|
|
0: data = {16'hxxxx, n[15:0]};
|
|
1:
|
|
begin
|
|
data[31:24] = x[7:0]+3;
|
|
data[23:16] = x[7:0]+2;
|
|
data[15:08] = x[7:0]+1;
|
|
data[07:00] = x[7:0]+0;
|
|
end
|
|
2: begin
|
|
data[31:16] = x[15:0]+1;
|
|
data[15:00] = x[15:0]+0;
|
|
end
|
|
endcase
|
|
|
|
case(a_mode)
|
|
0: x = x + 1;
|
|
1: x = x + 4;
|
|
2: x = x + 2;
|
|
endcase
|
|
|
|
exp = m0.rd_mem[n];
|
|
if(a_mode==0) exp[31:16] = data[31:16];
|
|
|
|
if(data !== exp)
|
|
begin
|
|
$display("ERROR: RD[%0d] Mismatch: Expected: %x, Got: %x (%0t)",
|
|
n, data, exp, $time);
|
|
error_cnt = error_cnt + 1;
|
|
end
|
|
|
|
end
|
|
|
|
for(m=0;m<4;m=m+1)
|
|
for(n=0;n<size*2;n=n+1)
|
|
begin
|
|
|
|
case(m)
|
|
0: data = sdram0.Bank0[n];
|
|
1: data = sdram0.Bank1[n+1*size*2];
|
|
2: data = sdram0.Bank2[n+2*size*2];
|
|
3: data = sdram0.Bank3[n+3*size*2];
|
|
endcase
|
|
|
|
if((data !== m0.wr_mem[(m*size*2)+n]) | (|data === 1'bx) |
|
|
(|m0.wr_mem[(m*size*2)+n] === 1'bx) )
|
|
begin
|
|
$display("ERROR: WR Data[%0d] Mismatch: Expected: %x, Got: %x (%0t)",
|
|
(m*size*2)+n, data, m0.wr_mem[(m*size*2)+n], $time);
|
|
error_cnt = error_cnt + 1;
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
|
/*
|
|
m0.mem_fill;
|
|
for(n=0;n<1024;n=n+1)
|
|
m0.wr_mem[n] = 32'hffff_ffff;
|
|
|
|
if(verbose) $display("Mode: %0d, Size: %0d, Delay: %0d", mode, size, del);
|
|
|
|
if(write) m0.wb_wr_mult(`MEM_BASE3 + size*0*4, 4'hf, del, size);
|
|
if(read) m0.wb_rd_mult(`MEM_BASE3 + size*0*4, 4'hf, del, size);
|
|
|
|
if(write) m0.wb_wr_mult(`MEM_BASE3 + size*1*4, 4'hf, del, size);
|
|
if(read) m0.wb_rd_mult(`MEM_BASE3 + size*1*4, 4'hf, del, size);
|
|
|
|
if(write) m0.wb_wr_mult(`MEM_BASE3 + size*2*4, 4'hf, del, size);
|
|
if(read) m0.wb_rd_mult(`MEM_BASE3 + size*2*4, 4'hf, del, size);
|
|
|
|
if(write) m0.wb_wr_mult(`MEM_BASE3 + size*3*4, 4'hf, del, size);
|
|
if(read) m0.wb_rd_mult(`MEM_BASE3 + size*3*4, 4'hf, del, size);
|
|
|
|
repeat(10) @(posedge clk);
|
|
|
|
x = 0;
|
|
for(n=0;n<(size*4);n=n+1)
|
|
begin
|
|
|
|
case(mode)
|
|
0: data = {16'hxxxx, n[15:0]};
|
|
1:
|
|
begin
|
|
data[31:24] = x[7:0]+3;
|
|
data[23:16] = x[7:0]+2;
|
|
data[15:08] = x[7:0]+1;
|
|
data[07:00] = x[7:0]+0;
|
|
end
|
|
2: begin
|
|
data[31:16] = x[15:0]+1;
|
|
data[15:00] = x[15:0]+0;
|
|
end
|
|
endcase
|
|
|
|
case(mode)
|
|
0: x = x + 1;
|
|
1: x = x + 4;
|
|
2: x = x + 2;
|
|
endcase
|
|
|
|
exp = m0.rd_mem[n];
|
|
if(mode==0) exp[31:16] = data[31:16];
|
|
|
|
if(data !== exp)
|
|
begin
|
|
$display("ERROR: Data[%0d] Mismatch: Expected: %x, Got: %x (%0t)",
|
|
n, data, exp, $time);
|
|
error_cnt = error_cnt + 1;
|
|
end
|
|
|
|
end
|
|
*/
|
|
|
|
end
|
|
|
|
end
|
|
|
|
show_errors;
|
|
$display("*****************************************************");
|
|
$display("*** Test DONE ... ***");
|
|
$display("*****************************************************\n\n");
|
|
|
|
end
|
|
endtask
|
|
|
|
|
task asc_rdwr1;
|
task asc_rdwr1;
|
input quick;
|
input quick;
|
|
|
integer quick;
|
integer quick;
|
integer x,s,n,m,adr;
|
integer x,s,n,m,adr;
|
Line 2259... |
Line 2557... |
$display("*****************************************************\n");
|
$display("*****************************************************\n");
|
|
|
m0.wb_wr1(`REG_BASE + `CSR, 4'hf, 32'h6030_0300);
|
m0.wb_wr1(`REG_BASE + `CSR, 4'hf, 32'h6030_0300);
|
m0.wb_wr1(`REG_BASE + `BA_MASK, 4'hf, 32'h0000_00f0);
|
m0.wb_wr1(`REG_BASE + `BA_MASK, 4'hf, 32'h0000_00f0);
|
|
|
m0.wb_wr1(`REG_BASE + `TMS3, 4'hf, 32'hffff_f40a);
|
m0.wb_wr1(`REG_BASE + `TMS3, 4'hf, 32'hffff_f40b);
|
|
|
case(quick)
|
case(quick)
|
0: sz_max = 32;
|
0: sz_max = 32;
|
1: sz_max = 32;
|
1: sz_max = 32;
|
2: sz_max = 16;
|
2: sz_max = 16;
|
Line 2274... |
Line 2572... |
1: del_max = 8;
|
1: del_max = 8;
|
2: del_max = 4;
|
2: del_max = 4;
|
endcase
|
endcase
|
|
|
size = 16;
|
size = 16;
|
del = 4;
|
del = 0;
|
mode = 0;
|
mode = 0;
|
read = 1;
|
read = 1;
|
write = 1;
|
write = 1;
|
|
|
|
|
Line 2295... |
Line 2593... |
endcase
|
endcase
|
|
|
repeat(10) @(posedge clk);
|
repeat(10) @(posedge clk);
|
if(!verbose) $display("Mode: %b", mode);
|
if(!verbose) $display("Mode: %b", mode);
|
|
|
//for(del=0;del<del_max;del=del+1)
|
for(del=0;del<del_max;del=del+1)
|
//for(size=1;size<sz_max;size=size+1)
|
for(size=1;size<sz_max;size=size+1)
|
begin
|
begin
|
m0.mem_fill;
|
m0.mem_fill;
|
for(n=0;n<1024;n=n+1)
|
for(n=0;n<1024;n=n+1)
|
m0.wr_mem[n] = 32'hffff_ffff;
|
m0.wr_mem[n] = 32'hffff_ffff;
|
|
|
Line 2828... |
Line 3126... |
$display("*****************************************************\n");
|
$display("*****************************************************\n");
|
|
|
m0.wb_wr1(`REG_BASE + `CSR, 4'hf, 32'h6030_0300);
|
m0.wb_wr1(`REG_BASE + `CSR, 4'hf, 32'h6030_0300);
|
m0.wb_wr1(`REG_BASE + `BA_MASK, 4'hf, 32'h0000_00f0);
|
m0.wb_wr1(`REG_BASE + `BA_MASK, 4'hf, 32'h0000_00f0);
|
|
|
m0.wb_wr1(`REG_BASE + `TMS5, 4'hf, 32'hf03f_4104);
|
m0.wb_wr1(`REG_BASE + `TMS5, 4'hf, 32'hf03f_4105);
|
m0.wb_wr1(`REG_BASE + `CSC5, 4'hf, 32'h00a0_0027);
|
m0.wb_wr1(`REG_BASE + `CSC5, 4'hf, 32'h00a0_0027);
|
|
|
|
|
case(quick)
|
case(quick)
|
0: sz_max = 32;
|
0: sz_max = 32;
|
Line 2953... |
Line 3251... |
1: del_max = 8;
|
1: del_max = 8;
|
2: del_max = 4;
|
2: del_max = 4;
|
endcase
|
endcase
|
|
|
size = 4;
|
size = 4;
|
del = 4;
|
del = 1;
|
mode = 0;
|
mode = 0;
|
read = 1;
|
read = 1;
|
//force sdram0.Debug = 1;
|
//force sdram0.Debug = 1;
|
|
|
for(mode=0;mode<20;mode=mode+1)
|
for(mode=0;mode<20;mode=mode+1)
|
begin
|
begin
|
sdram0.mem_fill(1024);
|
//sdram0.mem_fill(1024);
|
|
fill_mem(1024);
|
|
|
case(mode[4:2])
|
case(mode[4:2])
|
0: bs = 0;
|
0: bs = 0;
|
1: bs = 1;
|
1: bs = 1;
|
2: bs = 2;
|
2: bs = 2;
|
Line 3150... |
Line 3449... |
integer page_size;
|
integer page_size;
|
reg [31:0] mem0[0:1024];
|
reg [31:0] mem0[0:1024];
|
reg [31:0] mem1[0:1024];
|
reg [31:0] mem1[0:1024];
|
reg [31:0] mem2[0:1024];
|
reg [31:0] mem2[0:1024];
|
reg [31:0] mem3[0:1024];
|
reg [31:0] mem3[0:1024];
|
|
integer cycle;
|
|
|
begin
|
begin
|
|
|
$display("\n\n");
|
$display("\n\n");
|
$display("*****************************************************");
|
$display("*****************************************************");
|
Line 3163... |
Line 3463... |
|
|
page_size = 256; // 64 mbit x 32 SDRAM
|
page_size = 256; // 64 mbit x 32 SDRAM
|
|
|
case(quick)
|
case(quick)
|
0: sz_max = 32;
|
0: sz_max = 32;
|
1: sz_max = 32;
|
1: sz_max = 16;
|
2: sz_max = 16;
|
2: sz_max = 16;
|
endcase
|
endcase
|
|
|
case(quick)
|
case(quick)
|
0: del_max = 16;
|
0: del_max = 16;
|
1: del_max = 8;
|
1: del_max = 8;
|
2: del_max = 4;
|
2: del_max = 8;
|
endcase
|
endcase
|
|
|
m0.wb_wr1(`REG_BASE + `CSR, 4'hf, 32'h6030_0300);
|
m0.wb_wr1(`REG_BASE + `CSR, 4'hf, 32'h6030_0300);
|
m0.wb_wr1(`REG_BASE + `BA_MASK, 4'hf, 32'h0000_00f0);
|
m0.wb_wr1(`REG_BASE + `BA_MASK, 4'hf, 32'h0000_00f0);
|
|
|
Line 3191... |
Line 3491... |
1'b0, // Burst Type (0=Seq;1=Inter)
|
1'b0, // Burst Type (0=Seq;1=Inter)
|
3'd3 // Burst Length
|
3'd3 // Burst Length
|
});
|
});
|
|
|
kro = 1;
|
kro = 1;
|
|
cycle=3;
|
|
for(cycle=0;cycle<8;cycle=cycle+1)
|
for(kro=0;kro<2;kro=kro+1) // Don't Need this for this test
|
for(kro=0;kro<2;kro=kro+1) // Don't Need this for this test
|
begin
|
begin
|
m0.wb_wr1(`REG_BASE + `CSC0, 4'hf, 32'h0000_0821 | (kro[0]<<10));
|
m0.wb_wr1(`REG_BASE + `CSC0, 4'hf, 32'h0000_0821 | (kro[0]<<10));
|
|
|
size = 2;
|
size = 2;
|
del = 0;
|
del = 5;
|
mode = 8;
|
mode = 2;
|
|
|
//force sdram0.Debug = 1;
|
//force sdram0.Debug = 1;
|
|
|
for(mode=0;mode<10;mode=mode+1)
|
for(mode=0;mode<10;mode=mode+1)
|
begin
|
begin
|
Line 3236... |
Line 3538... |
3'd0+bs // Burst Length
|
3'd0+bs // Burst Length
|
});
|
});
|
|
|
repeat(50) @(posedge clk);
|
repeat(50) @(posedge clk);
|
|
|
if(!verbose) $display("KRO: %0d, Mode: %b", kro, mode);
|
if(!verbose) $display("KRO: %0d, Mode: %b, Cyc. Delay: %0d", kro, mode, cycle);
|
|
|
for(del=0;del<del_max;del=del+1)
|
for(del=0;del<del_max;del=del+1)
|
for(size=sz_inc;size<sz_max;size=size+sz_inc)
|
for(size=sz_inc;size<sz_max;size=size+sz_inc)
|
begin
|
begin
|
m0.mem_fill;
|
m0.mem_fill;
|
Line 3252... |
Line 3554... |
1: mem1[n] = sdram0.Bank1[n+1*size*2];
|
1: mem1[n] = sdram0.Bank1[n+1*size*2];
|
2: mem2[n] = sdram0.Bank2[n+2*size*2];
|
2: mem2[n] = sdram0.Bank2[n+2*size*2];
|
3: mem3[n] = sdram0.Bank3[n+3*size*2];
|
3: mem3[n] = sdram0.Bank3[n+3*size*2];
|
endcase
|
endcase
|
|
|
if(verbose) $display("KRO: %0d, Mode: %b, Size: %0d, Delay: %0d",
|
if(verbose) $display("KRO: %0d, Mode: %b, Size: %0d, Delay: %0d, Cyc. Delay: %0d (%t)",
|
kro, mode, size, del);
|
kro, mode, size, del, cycle, $time);
|
|
|
|
repeat(cycle) @(posedge clk);
|
m0.wb_rmw(`MEM_BASE + (page_size*0*4) + size*0*4, 4'hf, del, size, size);
|
m0.wb_rmw(`MEM_BASE + (page_size*0*4) + size*0*4, 4'hf, del, size, size);
|
|
repeat(cycle) @(posedge clk);
|
m0.wb_rmw(`MEM_BASE + (page_size*0*4) + size*1*4, 4'hf, del, size, size);
|
m0.wb_rmw(`MEM_BASE + (page_size*0*4) + size*1*4, 4'hf, del, size, size);
|
|
|
|
repeat(cycle) @(posedge clk);
|
m0.wb_rmw(`MEM_BASE + (page_size*1*4) + size*2*4, 4'hf, del, size, size);
|
m0.wb_rmw(`MEM_BASE + (page_size*1*4) + size*2*4, 4'hf, del, size, size);
|
|
repeat(cycle) @(posedge clk);
|
m0.wb_rmw(`MEM_BASE + (page_size*1*4) + size*3*4, 4'hf, del, size, size);
|
m0.wb_rmw(`MEM_BASE + (page_size*1*4) + size*3*4, 4'hf, del, size, size);
|
|
|
|
repeat(cycle) @(posedge clk);
|
m0.wb_rmw(`MEM_BASE + (page_size*2*4) + size*4*4, 4'hf, del, size, size);
|
m0.wb_rmw(`MEM_BASE + (page_size*2*4) + size*4*4, 4'hf, del, size, size);
|
|
repeat(cycle) @(posedge clk);
|
m0.wb_rmw(`MEM_BASE + (page_size*2*4) + size*5*4, 4'hf, del, size, size);
|
m0.wb_rmw(`MEM_BASE + (page_size*2*4) + size*5*4, 4'hf, del, size, size);
|
|
|
|
repeat(cycle) @(posedge clk);
|
m0.wb_rmw(`MEM_BASE + (page_size*3*4) + size*6*4, 4'hf, del, size, size);
|
m0.wb_rmw(`MEM_BASE + (page_size*3*4) + size*6*4, 4'hf, del, size, size);
|
|
repeat(cycle) @(posedge clk);
|
m0.wb_rmw(`MEM_BASE + (page_size*3*4) + size*7*4, 4'hf, del, size, size);
|
m0.wb_rmw(`MEM_BASE + (page_size*3*4) + size*7*4, 4'hf, del, size, size);
|
|
|
|
repeat(cycle) @(posedge clk);
|
for(m=0;m<4;m=m+1)
|
for(m=0;m<4;m=m+1)
|
for(n=0;n<(size*2);n=n+1)
|
for(n=0;n<(size*2);n=n+1)
|
begin
|
begin
|
|
|
case(m)
|
case(m)
|
Line 3337... |
Line 3648... |
integer sz_inc;
|
integer sz_inc;
|
integer sz_max, del_max;
|
integer sz_max, del_max;
|
reg [2:0] kro;
|
reg [2:0] kro;
|
reg [31:0] data, data1;
|
reg [31:0] data, data1;
|
integer page_size;
|
integer page_size;
|
|
integer cycle;
|
|
|
begin
|
begin
|
|
|
$display("\n\n");
|
$display("\n\n");
|
$display("*****************************************************");
|
$display("*****************************************************");
|
Line 3350... |
Line 3662... |
|
|
page_size = 256; // 64 mbit x 32 SDRAM
|
page_size = 256; // 64 mbit x 32 SDRAM
|
|
|
case(quick)
|
case(quick)
|
0: sz_max = 32;
|
0: sz_max = 32;
|
1: sz_max = 32;
|
1: sz_max = 16;
|
2: sz_max = 16;
|
2: sz_max = 10;
|
endcase
|
endcase
|
|
|
case(quick)
|
case(quick)
|
0: del_max = 16;
|
0: del_max = 16;
|
1: del_max = 8;
|
1: del_max = 8;
|
2: del_max = 4;
|
2: del_max = 8;
|
endcase
|
endcase
|
|
|
m0.wb_wr1(`REG_BASE + `CSR, 4'hf, 32'h6030_0300);
|
m0.wb_wr1(`REG_BASE + `CSR, 4'hf, 32'h6030_0300);
|
m0.wb_wr1(`REG_BASE + `BA_MASK, 4'hf, 32'h0000_00f0);
|
m0.wb_wr1(`REG_BASE + `BA_MASK, 4'hf, 32'h0000_00f0);
|
|
|
Line 3377... |
Line 3689... |
3'd2, // CL
|
3'd2, // CL
|
1'b0, // Burst Type (0=Seq;1=Inter)
|
1'b0, // Burst Type (0=Seq;1=Inter)
|
3'd3 // Burst Length
|
3'd3 // Burst Length
|
});
|
});
|
|
|
kro = 0;
|
kro = 1;
|
|
for(cycle=0;cycle<8;cycle=cycle+1)
|
for(kro=0;kro<2;kro=kro+1) // Don't Need this for this test
|
for(kro=0;kro<2;kro=kro+1) // Don't Need this for this test
|
begin
|
begin
|
m0.wb_wr1(`REG_BASE + `CSC0, 4'hf, 32'h0000_0821 | (kro[0]<<10));
|
m0.wb_wr1(`REG_BASE + `CSC0, 4'hf, 32'h0000_0821 | (kro[0]<<10));
|
|
|
size = 1;
|
size = 1;
|
Line 3425... |
Line 3738... |
3'd0+bs // Burst Length
|
3'd0+bs // Burst Length
|
});
|
});
|
|
|
repeat(50) @(posedge clk);
|
repeat(50) @(posedge clk);
|
|
|
if(!verbose) $display("KRO: %0d, Mode: %b", kro, mode);
|
if(!verbose) $display("KRO: %0d, Mode: %b, Cyc.Del: %0d", kro, mode, cycle);
|
|
|
for(del=0;del<del_max;del=del+1)
|
for(del=0;del<del_max;del=del+1)
|
for(size=sz_inc;size<sz_max;size=size+sz_inc)
|
for(size=sz_inc;size<sz_max;size=size+sz_inc)
|
begin
|
begin
|
m0.mem_fill;
|
m0.mem_fill;
|
fill_mem(1024);
|
fill_mem(1024);
|
|
|
|
|
if(verbose) $display("KRO: %0d, Mode: %b, Size: %0d, Delay: %0d",
|
if(verbose) $display("KRO: %0d, Mode: %b, Size: %0d, Delay: %0d, Cyc.Del: %0d (%t)",
|
kro, mode, size, del);
|
kro, mode, size, del, cycle, $time);
|
|
|
|
repeat(cycle) @(posedge clk);
|
m0.wb_wmr(`MEM_BASE + (page_size*0*4) + size*0*4, 4'hf, del, size, size);
|
m0.wb_wmr(`MEM_BASE + (page_size*0*4) + size*0*4, 4'hf, del, size, size);
|
|
repeat(cycle) @(posedge clk);
|
m0.wb_wmr(`MEM_BASE + (page_size*0*4) + size*1*4, 4'hf, del, size, size);
|
m0.wb_wmr(`MEM_BASE + (page_size*0*4) + size*1*4, 4'hf, del, size, size);
|
|
|
|
repeat(cycle) @(posedge clk);
|
m0.wb_wmr(`MEM_BASE + (page_size*1*4) + size*2*4, 4'hf, del, size, size);
|
m0.wb_wmr(`MEM_BASE + (page_size*1*4) + size*2*4, 4'hf, del, size, size);
|
|
repeat(cycle) @(posedge clk);
|
m0.wb_wmr(`MEM_BASE + (page_size*1*4) + size*3*4, 4'hf, del, size, size);
|
m0.wb_wmr(`MEM_BASE + (page_size*1*4) + size*3*4, 4'hf, del, size, size);
|
|
|
|
repeat(cycle) @(posedge clk);
|
m0.wb_wmr(`MEM_BASE + (page_size*2*4) + size*4*4, 4'hf, del, size, size);
|
m0.wb_wmr(`MEM_BASE + (page_size*2*4) + size*4*4, 4'hf, del, size, size);
|
|
repeat(cycle) @(posedge clk);
|
m0.wb_wmr(`MEM_BASE + (page_size*2*4) + size*5*4, 4'hf, del, size, size);
|
m0.wb_wmr(`MEM_BASE + (page_size*2*4) + size*5*4, 4'hf, del, size, size);
|
|
|
|
repeat(cycle) @(posedge clk);
|
m0.wb_wmr(`MEM_BASE + (page_size*3*4) + size*6*4, 4'hf, del, size, size);
|
m0.wb_wmr(`MEM_BASE + (page_size*3*4) + size*6*4, 4'hf, del, size, size);
|
|
repeat(cycle) @(posedge clk);
|
m0.wb_wmr(`MEM_BASE + (page_size*3*4) + size*7*4, 4'hf, del, size, size);
|
m0.wb_wmr(`MEM_BASE + (page_size*3*4) + size*7*4, 4'hf, del, size, size);
|
|
|
|
repeat(cycle) @(posedge clk);
|
for(n=0;n<(size*2);n=n+1)
|
for(n=0;n<(size*2);n=n+1)
|
begin
|
begin
|
|
|
data = m0.wr_mem[n];
|
data = m0.wr_mem[n];
|
data1 = m0.rd_mem[n];
|
data1 = m0.rd_mem[n];
|