OpenCores
URL https://opencores.org/ocsvn/amber/amber/trunk

Subversion Repositories amber

[/] [amber/] [trunk/] [hw/] [vlog/] [tb/] [tb.v] - Diff between revs 35 and 36

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 35 Rev 36
Line 69... Line 69...
`endif
`endif
 
 
integer                 boot_mem_file;
integer                 boot_mem_file;
reg     [31:0]          boot_mem_file_address;
reg     [31:0]          boot_mem_file_address;
reg     [31:0]          boot_mem_file_data;
reg     [31:0]          boot_mem_file_data;
 
reg     [127:0]         boot_mem_file_data_128;
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;
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;
Line 271... Line 271...
 
 
 
 
// ======================================
// ======================================
// Initialize Boot Memory
// Initialize Boot Memory
// ======================================
// ======================================
`ifndef XILINX_FPGA
 
    initial
    initial
        begin
        begin
 
`ifndef XILINX_FPGA
        $display("Load boot memory from %s", `BOOT_MEM_FILE);
        $display("Load boot memory from %s", `BOOT_MEM_FILE);
        boot_mem_line_count   = 0;
        boot_mem_line_count   = 0;
        boot_mem_file         = $fopen(`BOOT_MEM_FILE,    "r");
        boot_mem_file         = $fopen(`BOOT_MEM_FILE,    "r");
        if (boot_mem_file == 0)
        if (boot_mem_file == 0)
            begin
            begin
Line 308... Line 308...
                    if (aligned_line[120*8-1:119*8] != 8'h00)
                    if (aligned_line[120*8-1:119*8] != 8'h00)
                        begin
                        begin
                        boot_mem_file_address  =   hex_chars_to_32bits (aligned_line[119*8-1:111*8]);
                        boot_mem_file_address  =   hex_chars_to_32bits (aligned_line[119*8-1:111*8]);
                        boot_mem_file_data     =   hex_chars_to_32bits (aligned_line[110*8-1:102*8]);
                        boot_mem_file_data     =   hex_chars_to_32bits (aligned_line[110*8-1:102*8]);
 
 
                        tb.u_system.u_boot_mem.u_mem.mem [boot_mem_file_address[12:2]] = boot_mem_file_data;
                        `ifdef AMBER_A25_CORE
 
                            boot_mem_file_data_128 = `U_BOOT_MEM.u_mem.mem[boot_mem_file_address[12:4]];
 
                            `U_BOOT_MEM.u_mem.mem[boot_mem_file_address[12:4]] =
 
                                    insert_32_into_128 ( boot_mem_file_address[3:2],
 
                                                         boot_mem_file_data_128,
 
                                                         boot_mem_file_data );
 
                        `else
 
                            `U_BOOT_MEM.u_mem.mem[boot_mem_file_address[12:2]] = boot_mem_file_data;
 
                        `endif
 
 
                        `ifdef AMBER_LOAD_MEM_DEBUG
                        `ifdef AMBER_LOAD_MEM_DEBUG
                            $display ("Load Boot Mem: PAddr: 0x%08x, Data 0x%08x",
                            $display ("Load Boot Mem: PAddr: 0x%08x, Data 0x%08x",
                                        boot_mem_file_address, boot_mem_file_data);
                                        boot_mem_file_address, boot_mem_file_data);
                        `endif
                        `endif
Line 320... Line 328...
                    end
                    end
                end
                end
 
 
            $display("Read in %1d lines", boot_mem_line_count);
            $display("Read in %1d lines", boot_mem_line_count);
            end
            end
 
`endif
 
 
        // Grab the test name from memory    
        // Grab the test name from memory    
        timeout   =              tb.u_system.u_boot_mem.u_mem.mem [11'h7fb];
        timeout   = `AMBER_TIMEOUT   ;
        test_name = { endian_x32(tb.u_system.u_boot_mem.u_mem.mem [11'h7fc]),
        $display("log file %s, timeout %0d, test name %0s ", `AMBER_LOG_FILE, timeout, `AMBER_TEST_NAME );
                      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");
        log_file = $fopen(`AMBER_LOG_FILE, "a");
        end
        end
 
 
`endif
 
 
 
 
 
// ======================================
// ======================================
// Initialize Main Memory
// Initialize Main Memory
// ======================================
// ======================================
Line 461... Line 465...
            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", test_name, `U_TB.clk_count);
                $write("Passed %s %0d ticks\n", `AMBER_TEST_NAME, `U_TB.clk_count);
                $display("++++++++++++++++++++");
                $display("++++++++++++++++++++");
                $fwrite(`U_TB.log_file,"Passed %s %0d ticks\n", test_name, `U_TB.clk_count);
                $fwrite(`U_TB.log_file,"Passed %s %0d ticks\n", `AMBER_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", test_name);
                    $write("Failed %s\n", `AMBER_TEST_NAME);
                    $display("++++++++++++++++++++");
                    $display("++++++++++++++++++++");
                    $fwrite(`U_TB.log_file,"Failed %s\n", test_name);
                    $fwrite(`U_TB.log_file,"Failed %s\n", `AMBER_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", test_name, test_status_reg);
                        $write("Failed %s - with error 0x%08x\n", `AMBER_TEST_NAME, test_status_reg);
                    else
                    else
                        $write("Failed %s - with error on line %1d\n", test_name, test_status_reg);
                        $write("Failed %s - with error on line %1d\n", `AMBER_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", test_name, test_status_reg);
                        $fwrite(`U_TB.log_file,"Failed %s - with error 0x%08h\n", `AMBER_TEST_NAME, test_status_reg);
                    else
                    else
                        $fwrite(`U_TB.log_file,"Failed %s - with error on line %1d\n", test_name, test_status_reg);
                        $fwrite(`U_TB.log_file,"Failed %s - with error on line %1d\n", `AMBER_TEST_NAME, test_status_reg);
                    $finish;
                    $finish;
                    end
                    end
                end
                end
            end
            end
        end
        end

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.