Line 6... |
Line 6... |
//
|
//
|
// Purpose: This file is a test bench wrapper around the wishbone scope,
|
// Purpose: This file is a test bench wrapper around the wishbone scope,
|
// designed to create a "signal" which can then be scoped and
|
// designed to create a "signal" which can then be scoped and
|
// proven. In our case here, the "signal" is a counter. When we test
|
// proven. In our case here, the "signal" is a counter. When we test
|
// the scope within our bench/cpp Verilator testbench, we'll know if our
|
// the scope within our bench/cpp Verilator testbench, we'll know if our
|
// test was "correct" if the counter 1) only ever counts by 1, and 2) if
|
// test was "correct" if the counter 1) only ever increments by 1, and
|
// the trigger lands on thte right data sample.
|
// 2) if the trigger lands on thte right data sample.
|
//
|
//
|
// Creator: Dan Gisselquist, Ph.D.
|
// Creator: Dan Gisselquist, Ph.D.
|
// Gisselquist Technology, LLC
|
// Gisselquist Technology, LLC
|
//
|
//
|
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
Line 38... |
Line 38... |
//
|
//
|
//
|
//
|
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
//
|
//
|
//
|
//
|
|
`default_nettype none
|
|
//
|
module wbscope_tb(i_clk,
|
module wbscope_tb(i_clk,
|
// i_rst is required by our test infrastructure, yet unused here
|
// i_rst is required by our test infrastructure, yet unused here
|
i_rst,
|
i_rst,
|
// The test data. o_data is internally generated here from a
|
// The test data. o_data is internally generated here from a
|
// counter, i_trigger is given externally
|
// counter, i_trigger is given externally
|
Line 50... |
Line 52... |
i_wb_cyc, i_wb_stb, i_wb_we, i_wb_addr, i_wb_data,
|
i_wb_cyc, i_wb_stb, i_wb_we, i_wb_addr, i_wb_data,
|
// wishbone bus outputs
|
// wishbone bus outputs
|
o_wb_ack, o_wb_stall, o_wb_data,
|
o_wb_ack, o_wb_stall, o_wb_data,
|
// And our output interrupt
|
// And our output interrupt
|
o_interrupt);
|
o_interrupt);
|
input i_clk, i_rst, i_trigger;
|
input wire i_clk, i_rst, i_trigger;
|
output wire [31:0] o_data;
|
output wire [31:0] o_data;
|
//
|
//
|
input i_wb_cyc, i_wb_stb, i_wb_we;
|
input wire i_wb_cyc, i_wb_stb, i_wb_we;
|
input i_wb_addr;
|
input wire i_wb_addr;
|
input [31:0] i_wb_data;
|
input wire [31:0] i_wb_data;
|
//
|
//
|
output wire o_wb_ack;
|
output wire o_wb_ack;
|
output wire o_wb_stall;
|
output wire o_wb_stall;
|
output wire [31:0] o_wb_data;
|
output wire [31:0] o_wb_data;
|
//
|
//
|
output o_interrupt;
|
output wire o_interrupt;
|
|
|
reg [30:0] counter;
|
reg [30:0] counter;
|
initial counter = 0;
|
initial counter = 0;
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
counter <= counter + 1'b1;
|
counter <= counter + 1'b1;
|