Line 45... |
Line 45... |
|
|
|
|
module tb();
|
module tb();
|
|
|
`include "debug_functions.v"
|
`include "debug_functions.v"
|
|
`include "system_functions.v"
|
|
|
reg sysrst;
|
reg sysrst;
|
`ifdef XILINX_VIRTEX6_FPGA
|
`ifdef XILINX_VIRTEX6_FPGA
|
reg clk_533mhz;
|
reg clk_533mhz;
|
`endif
|
`endif
|
Line 72... |
Line 73... |
reg [31:0] boot_mem_file_data;
|
reg [31:0] boot_mem_file_data;
|
integer boot_mem_line_count;
|
integer boot_mem_line_count;
|
integer fgets_return;
|
integer fgets_return;
|
reg [120*8-1:0] line;
|
reg [120*8-1:0] line;
|
reg [120*8-1:0] aligned_line;
|
reg [120*8-1:0] aligned_line;
|
|
reg [8*16-1:0] test_name;
|
|
integer timeout = 0;
|
|
|
wire [12:0] ddr3_addr;
|
wire [12:0] ddr3_addr;
|
wire [2:0] ddr3_ba;
|
wire [2:0] ddr3_ba;
|
wire ddr3_ck_p;
|
wire ddr3_ck_p;
|
wire ddr3_ck_n;
|
wire ddr3_ck_n;
|
Line 266... |
Line 269... |
clk_count <= clk_count + 1'd1;
|
clk_count <= clk_count + 1'd1;
|
|
|
|
|
|
|
// ======================================
|
// ======================================
|
// Test Name
|
|
// ======================================
|
|
initial
|
|
begin
|
|
$display("Test %s, log file %s",`AMBER_TEST_NAME, `AMBER_LOG_FILE);
|
|
log_file = $fopen(`AMBER_LOG_FILE, "a");
|
|
end
|
|
|
|
|
|
|
|
// ======================================
|
|
// Initialize Boot Memory
|
// Initialize Boot Memory
|
// ======================================
|
// ======================================
|
`ifndef XILINX_FPGA
|
`ifndef XILINX_FPGA
|
initial
|
initial
|
begin
|
begin
|
Line 328... |
Line 320... |
end
|
end
|
end
|
end
|
|
|
$display("Read in %1d lines", boot_mem_line_count);
|
$display("Read in %1d lines", boot_mem_line_count);
|
end
|
end
|
|
|
|
// Grab the test name from memory
|
|
timeout = tb.u_system.u_boot_mem.u_mem.mem [11'h7fb];
|
|
test_name = { endian_x32(tb.u_system.u_boot_mem.u_mem.mem [11'h7fc]),
|
|
endian_x32(tb.u_system.u_boot_mem.u_mem.mem [11'h7fd]),
|
|
endian_x32(tb.u_system.u_boot_mem.u_mem.mem [11'h7fe]),
|
|
endian_x32(tb.u_system.u_boot_mem.u_mem.mem [11'h7ff])};
|
|
$display("log file %s, timeout %0d, test name %0s ", `AMBER_LOG_FILE, timeout, test_name);
|
|
log_file = $fopen(`AMBER_LOG_FILE, "a");
|
end
|
end
|
|
|
`endif
|
`endif
|
|
|
|
|
Line 445... |
Line 446... |
reg testfail;
|
reg testfail;
|
wire test_status_set;
|
wire test_status_set;
|
wire [31:0] test_status_reg;
|
wire [31:0] test_status_reg;
|
|
|
initial
|
initial
|
|
begin
|
testfail = 1'd0;
|
testfail = 1'd0;
|
|
end
|
|
|
assign test_status_set = `U_TEST_MODULE.test_status_set;
|
assign test_status_set = `U_TEST_MODULE.test_status_set;
|
assign test_status_reg = `U_TEST_MODULE.test_status_reg;
|
assign test_status_reg = `U_TEST_MODULE.test_status_reg;
|
|
|
always @*
|
always @*
|
Line 458... |
Line 461... |
begin
|
begin
|
if ( test_status_reg == 32'd17 && !testfail )
|
if ( test_status_reg == 32'd17 && !testfail )
|
begin
|
begin
|
display_registers;
|
display_registers;
|
$display("++++++++++++++++++++");
|
$display("++++++++++++++++++++");
|
$write("Passed %s %0d ticks\n", `AMBER_TEST_NAME, `U_TB.clk_count);
|
$write("Passed %s %0d ticks\n", test_name, `U_TB.clk_count);
|
$display("++++++++++++++++++++");
|
$display("++++++++++++++++++++");
|
$fwrite(`U_TB.log_file,"Passed %s %0d ticks\n", `AMBER_TEST_NAME, `U_TB.clk_count);
|
$fwrite(`U_TB.log_file,"Passed %s %0d ticks\n", test_name, `U_TB.clk_count);
|
$finish;
|
$finish;
|
end
|
end
|
else
|
else
|
begin
|
begin
|
display_registers;
|
display_registers;
|
if ( testfail )
|
if ( testfail )
|
begin
|
begin
|
$display("++++++++++++++++++++");
|
$display("++++++++++++++++++++");
|
$write("Failed %s\n", `AMBER_TEST_NAME);
|
$write("Failed %s\n", test_name);
|
$display("++++++++++++++++++++");
|
$display("++++++++++++++++++++");
|
$fwrite(`U_TB.log_file,"Failed %s\n", `AMBER_TEST_NAME);
|
$fwrite(`U_TB.log_file,"Failed %s\n", test_name);
|
$finish;
|
$finish;
|
end
|
end
|
else
|
else
|
begin
|
begin
|
$display("++++++++++++++++++++");
|
$display("++++++++++++++++++++");
|
if (test_status_reg >= 32'h8000)
|
if (test_status_reg >= 32'h8000)
|
$write("Failed %s - with error 0x%08x\n", `AMBER_TEST_NAME, test_status_reg);
|
$write("Failed %s - with error 0x%08x\n", test_name, test_status_reg);
|
else
|
else
|
$write("Failed %s - with error %1d\n", `AMBER_TEST_NAME, test_status_reg);
|
$write("Failed %s - with error on line %1d\n", test_name, test_status_reg);
|
$display("++++++++++++++++++++");
|
$display("++++++++++++++++++++");
|
if (test_status_reg >= 32'h8000)
|
if (test_status_reg >= 32'h8000)
|
$fwrite(`U_TB.log_file,"Failed %s - with error 0x%08h\n", `AMBER_TEST_NAME, test_status_reg);
|
$fwrite(`U_TB.log_file,"Failed %s - with error 0x%08h\n", test_name, test_status_reg);
|
else
|
else
|
$fwrite(`U_TB.log_file,"Failed %s - with error %1d\n", `AMBER_TEST_NAME, test_status_reg);
|
$fwrite(`U_TB.log_file,"Failed %s - with error on line %1d\n", test_name, test_status_reg);
|
$finish;
|
$finish;
|
end
|
end
|
end
|
end
|
end
|
end
|
end
|
end
|
Line 497... |
Line 500... |
|
|
// ======================================
|
// ======================================
|
// Timeout
|
// Timeout
|
// ======================================
|
// ======================================
|
always @ ( posedge `U_SYSTEM.sys_clk )
|
always @ ( posedge `U_SYSTEM.sys_clk )
|
if ( `AMBER_TIMEOUT != 0 )
|
if ( timeout != 0 )
|
if (`U_TB.clk_count >= `AMBER_TIMEOUT)
|
if (`U_TB.clk_count >= timeout)
|
begin
|
begin
|
`TB_ERROR_MESSAGE
|
`TB_ERROR_MESSAGE
|
$display("Timeout Error");
|
$display("Timeout Error");
|
end
|
end
|
|
|