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

Subversion Repositories amber

[/] [amber/] [trunk/] [hw/] [vlog/] [system/] [test_module.v] - Diff between revs 35 and 61

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

Rev 35 Rev 61
Line 56... Line 56...
output      [WB_DWIDTH-1:0] o_wb_dat,
output      [WB_DWIDTH-1:0] o_wb_dat,
input       [WB_DWIDTH-1:0] i_wb_dat,
input       [WB_DWIDTH-1:0] i_wb_dat,
input                       i_wb_cyc,
input                       i_wb_cyc,
input                       i_wb_stb,
input                       i_wb_stb,
output                      o_wb_ack,
output                      o_wb_ack,
output                      o_wb_err
output                      o_wb_err,
 
output     [3:0]            o_led,
 
output                      o_phy_rst_n
 
 
);
);
 
 
`include "register_addresses.v"
`include "register_addresses.v"
 
 
Line 87... Line 88...
wire            wb_start_read;
wire            wb_start_read;
reg             wb_start_read_d1    = 'd0;
reg             wb_start_read_d1    = 'd0;
reg  [31:0]     wb_rdata32          = 'd0;
reg  [31:0]     wb_rdata32          = 'd0;
wire [31:0]     wb_wdata32;
wire [31:0]     wb_wdata32;
 
 
 
reg  [3:0]      led_reg             = 'd0;
 
reg             phy_rst_reg         = 'd0;
 
 
 
 
// Can't start a write while a read is completing. The ack for the read cycle
// Can't start a write while a read is completing. The ack for the read cycle
// needs to be sent first
// needs to be sent first
assign wb_start_write = i_wb_stb && i_wb_we && !wb_start_read_d1;
assign wb_start_write = i_wb_stb && i_wb_we && !wb_start_read_d1;
assign wb_start_read  = i_wb_stb && !i_wb_we && !o_wb_ack;
assign wb_start_read  = i_wb_stb && !i_wb_we && !o_wb_ack;
 
 
Line 98... Line 103...
    wb_start_read_d1 <= wb_start_read;
    wb_start_read_d1 <= wb_start_read;
 
 
assign o_wb_ack   = i_wb_stb && ( wb_start_write || wb_start_read_d1 );
assign o_wb_ack   = i_wb_stb && ( wb_start_write || wb_start_read_d1 );
assign o_wb_err   = 1'd0;
assign o_wb_err   = 1'd0;
assign o_mem_ctrl = mem_ctrl_reg;
assign o_mem_ctrl = mem_ctrl_reg;
 
assign o_led        = led_reg;
 
assign o_phy_rst_n  = phy_rst_reg;
 
 
generate
generate
if (WB_DWIDTH == 128)
if (WB_DWIDTH == 128)
    begin : wb128
    begin : wb128
    assign wb_wdata32   = i_wb_adr[3:2] == 2'd3 ? i_wb_dat[127:96] :
    assign wb_wdata32   = i_wb_adr[3:2] == 2'd3 ? i_wb_dat[127:96] :
Line 117... Line 123...
    assign wb_wdata32  = i_wb_dat;
    assign wb_wdata32  = i_wb_dat;
    assign o_wb_dat    = wb_rdata32;
    assign o_wb_dat    = wb_rdata32;
    end
    end
endgenerate
endgenerate
 
 
 
 
// ========================================================
// ========================================================
// Register Reads
// Register Reads
// ========================================================
// ========================================================
always @( posedge i_clk )
always @( posedge i_clk )
    if ( wb_start_read )
    if ( wb_start_read )
Line 158... Line 165...
 
 
            AMBER_TEST_SIM_CTRL:         wb_rdata32 <= {29'd0, sim_ctrl_reg};
            AMBER_TEST_SIM_CTRL:         wb_rdata32 <= {29'd0, sim_ctrl_reg};
            AMBER_TEST_MEM_CTRL:         wb_rdata32 <= {31'd0, mem_ctrl_reg};
            AMBER_TEST_MEM_CTRL:         wb_rdata32 <= {31'd0, mem_ctrl_reg};
 
 
            AMBER_TEST_CYCLES:           wb_rdata32 <=  cycles_reg;
            AMBER_TEST_CYCLES:           wb_rdata32 <=  cycles_reg;
 
            AMBER_TEST_LED:              wb_rdata32 <= {27'd0, led_reg};
 
            AMBER_TEST_PHY_RST:          wb_rdata32 <= {31'd0, phy_rst_reg};
            default:                     wb_rdata32 <= 32'haabbccdd;
            default:                     wb_rdata32 <= 32'haabbccdd;
 
 
        endcase
        endcase
 
 
 
 
Line 253... Line 262...
// ======================================
// ======================================
always @( posedge i_clk )
always @( posedge i_clk )
    if ( wb_start_write && i_wb_adr[15:0] == AMBER_TEST_STATUS )
    if ( wb_start_write && i_wb_adr[15:0] == AMBER_TEST_STATUS )
        test_status_set <= 1'd1;
        test_status_set <= 1'd1;
 
 
 
 
// ======================================
// ======================================
// Cycles counter
// Cycles counter
// ======================================
// ======================================
always @( posedge i_clk )
always @( posedge i_clk )
    cycles_reg <= cycles_reg + 1'd1;
    cycles_reg <= cycles_reg + 1'd1;
 
 
 
 
// ======================================
// ======================================
// Memory Configuration Register Write
// Memory Configuration Register Write
// ======================================
// ======================================
always @( posedge i_clk )
always @( posedge i_clk )
    if ( wb_start_write && i_wb_adr[15:0] == AMBER_TEST_MEM_CTRL )
    if ( wb_start_write && i_wb_adr[15:0] == AMBER_TEST_MEM_CTRL )
        mem_ctrl_reg <= wb_wdata32[0];
        mem_ctrl_reg <= wb_wdata32[0];
 
 
 
 
// ======================================
// ======================================
 
// Test LEDs
 
// ======================================
 
always @( posedge i_clk )
 
    if ( wb_start_write && i_wb_adr[15:0] == AMBER_TEST_LED )
 
        led_reg <= wb_wdata32[3:0];
 
 
 
 
 
// ======================================
 
// PHY Reset Register
 
// ======================================
 
always @( posedge i_clk )
 
    if ( wb_start_write && i_wb_adr[15:0] == AMBER_TEST_PHY_RST )
 
        phy_rst_reg <= wb_wdata32[0];
 
 
 
 
 
// ======================================
// Test UART registers
// Test UART registers
// ======================================
// ======================================
// These control the testbench UART, not the real
// These control the testbench UART, not the real
// UART in system
// UART in system
 
 

powered by: WebSVN 2.1.0

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