Line 44... |
Line 44... |
module test_module (
|
module test_module (
|
input i_clk,
|
input i_clk,
|
|
|
output o_irq,
|
output o_irq,
|
output o_firq,
|
output o_firq,
|
|
output o_mem_ctrl, // 0=128MB, 1=32MB
|
input [31:0] i_wb_adr,
|
input [31:0] i_wb_adr,
|
input [3:0] i_wb_sel,
|
input [3:0] i_wb_sel,
|
input i_wb_we,
|
input i_wb_we,
|
output [31:0] o_wb_dat,
|
output [31:0] o_wb_dat,
|
input [31:0] i_wb_dat,
|
input [31:0] i_wb_dat,
|
Line 72... |
Line 72... |
reg [1:0] tb_uart_status_reg = 'd0;
|
reg [1:0] tb_uart_status_reg = 'd0;
|
reg tb_uart_push = 'd0;
|
reg tb_uart_push = 'd0;
|
reg [7:0] tb_uart_txd_reg = 'd0;
|
reg [7:0] tb_uart_txd_reg = 'd0;
|
//synopsys translate_on
|
//synopsys translate_on
|
|
|
reg [1:0] sim_ctrl_reg = 'd0; // 1,2 = simulation, 0 = fpga
|
reg [2:0] sim_ctrl_reg = 'd0; // 0 = fpga, other values for simulations
|
|
reg mem_ctrl_reg = 'd0; // 0 = 128MB, 1 = 32MB main memory
|
reg [31:0] test_status_reg = 'd0;
|
reg [31:0] test_status_reg = 'd0;
|
reg test_status_set = 'd0; // used to terminate tests
|
reg test_status_set = 'd0; // used to terminate tests
|
|
|
wire wb_start_write;
|
wire wb_start_write;
|
wire wb_start_read;
|
wire wb_start_read;
|
Line 92... |
Line 93... |
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_wb_dat = wb_rdata;
|
assign o_wb_dat = wb_rdata;
|
|
assign o_mem_ctrl = mem_ctrl_reg;
|
|
|
// ========================================================
|
// ========================================================
|
// Register Reads
|
// Register Reads
|
// ========================================================
|
// ========================================================
|
always @( posedge i_clk )
|
always @( posedge i_clk )
|
Line 131... |
Line 132... |
AMBER_TEST_UART_CONTROL: wb_rdata <= {30'd0, tb_uart_control_reg};
|
AMBER_TEST_UART_CONTROL: wb_rdata <= {30'd0, tb_uart_control_reg};
|
AMBER_TEST_UART_STATUS: wb_rdata <= {30'd0, tb_uart_status_reg};
|
AMBER_TEST_UART_STATUS: wb_rdata <= {30'd0, tb_uart_status_reg};
|
AMBER_TEST_UART_TXD: wb_rdata <= {24'd0, tb_uart_txd_reg};
|
AMBER_TEST_UART_TXD: wb_rdata <= {24'd0, tb_uart_txd_reg};
|
//synopsys translate_on
|
//synopsys translate_on
|
|
|
AMBER_TEST_SIM_CTRL: wb_rdata <= {30'd0, sim_ctrl_reg};
|
AMBER_TEST_SIM_CTRL: wb_rdata <= {29'd0, sim_ctrl_reg};
|
|
AMBER_TEST_MEM_CTRL: wb_rdata <= {31'd0, mem_ctrl_reg};
|
default: wb_rdata <= 32'haabbccdd;
|
default: wb_rdata <= 32'haabbccdd;
|
|
|
endcase
|
endcase
|
|
|
|
|
Line 152... |
Line 154... |
`endif
|
`endif
|
|
|
always @( posedge i_clk )
|
always @( posedge i_clk )
|
begin
|
begin
|
// Value reads as 1 in simulation, and zero in the FPGA
|
// Value reads as 1 in simulation, and zero in the FPGA
|
sim_ctrl_reg <= 2'd `AMBER_SIM_CTRL ;
|
sim_ctrl_reg <= 3'd `AMBER_SIM_CTRL ;
|
end
|
end
|
//synopsys translate_on
|
//synopsys translate_on
|
|
|
|
|
// ======================================
|
// ======================================
|
Line 229... |
Line 231... |
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;
|
|
|
|
|
// ======================================
|
// ======================================
|
|
// Memory Configuration Register Write
|
|
// ======================================
|
|
always @( posedge i_clk )
|
|
if ( wb_start_write && i_wb_adr[15:0] == AMBER_TEST_MEM_CTRL )
|
|
mem_ctrl_reg <= i_wb_dat[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
|
|
|