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

Subversion Repositories wbscope

[/] [wbscope/] [trunk/] [bench/] [rtl/] [wbscope_tb.v] - Blame information for rev 14

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 dgisselq
////////////////////////////////////////////////////////////////////////////////
2
//
3
// Filename:    wbscope_tb.v
4
//
5
// Project:     WBScope, a wishbone hosted scope
6
//
7 13 dgisselq
// Purpose:     This file is a test bench wrapper around the wishbone scope,
8
//              designed to create a "signal" which can then be scoped and
9
//      proven.  In our case here, the "signal" is a counter.  When we test
10
//      the scope within our bench/cpp Verilator testbench, we'll know if our
11 14 dgisselq
//      test was "correct" if the counter 1) only ever increments by 1, and
12
//      2) if the trigger lands on thte right data sample.
13 12 dgisselq
//
14
// Creator:     Dan Gisselquist, Ph.D.
15
//              Gisselquist Technology, LLC
16
//
17
////////////////////////////////////////////////////////////////////////////////
18
//
19
// Copyright (C) 2015-2017, Gisselquist Technology, LLC
20
//
21
// This program is free software (firmware): you can redistribute it and/or
22
// modify it under the terms of  the GNU General Public License as published
23
// by the Free Software Foundation, either version 3 of the License, or (at
24
// your option) any later version.
25
//
26
// This program is distributed in the hope that it will be useful, but WITHOUT
27
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
28
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
29
// for more details.
30
//
31
// You should have received a copy of the GNU General Public License along
32
// with this program.  (It's in the $(ROOT)/doc directory.  Run make with no
33
// target there if the PDF file isn't present.)  If not, see
34
// <http://www.gnu.org/licenses/> for a copy.
35
//
36
// License:     GPL, v3, as defined and found on www.gnu.org,
37
//              http://www.gnu.org/licenses/gpl.html
38
//
39
//
40
////////////////////////////////////////////////////////////////////////////////
41
//
42
//
43 14 dgisselq
`default_nettype        none
44
//
45 13 dgisselq
module  wbscope_tb(i_clk,
46
                // i_rst is required by our test infrastructure, yet unused here
47
                i_rst,
48
                // The test data.  o_data is internally generated here from a
49
                // counter, i_trigger is given externally
50
                i_trigger, o_data,
51
                // Wishbone bus interaction
52
                i_wb_cyc, i_wb_stb, i_wb_we, i_wb_addr, i_wb_data,
53
                //      wishbone bus outputs
54
                o_wb_ack, o_wb_stall, o_wb_data,
55
                // And our output interrupt
56
                o_interrupt);
57 14 dgisselq
        input   wire            i_clk, i_rst, i_trigger;
58 12 dgisselq
        output  wire    [31:0]   o_data;
59
        //
60 14 dgisselq
        input   wire            i_wb_cyc, i_wb_stb, i_wb_we;
61
        input   wire            i_wb_addr;
62
        input   wire    [31:0]   i_wb_data;
63 12 dgisselq
        //
64
        output  wire            o_wb_ack;
65 13 dgisselq
        output  wire            o_wb_stall;
66 12 dgisselq
        output  wire    [31:0]   o_wb_data;
67
        //
68 14 dgisselq
        output  wire            o_interrupt;
69 12 dgisselq
 
70
        reg     [30:0]   counter;
71
        initial counter = 0;
72
        always @(posedge i_clk)
73
                counter <= counter + 1'b1;
74
 
75
        assign  o_data = { i_trigger, counter };
76
 
77
        wire    wb_stall_ignored;
78
 
79 13 dgisselq
        wbscope #(.LGMEM(5'd6), .BUSW(32), .SYNCHRONOUS(1),
80
                        .DEFAULT_HOLDOFF(1))
81 12 dgisselq
                scope(i_clk, 1'b1, i_trigger, o_data,
82
                        i_clk, i_wb_cyc, i_wb_stb, i_wb_we,
83
                                        i_wb_addr, i_wb_data,
84
                                o_wb_ack, wb_stall_ignored, o_wb_data,
85
                        o_interrupt);
86
 
87 13 dgisselq
        assign  o_wb_stall = 1'b0;
88
 
89
        // verilator lint_off UNUSED
90
        wire    [1:0]    unused;
91
        assign  unused = { i_rst, wb_stall_ignored };
92
        // verilator lint_on UNUSED
93 12 dgisselq
endmodule

powered by: WebSVN 2.1.0

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