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

Subversion Repositories wbscope

[/] [wbscope/] [trunk/] [bench/] [rtl/] [wbscopc_tb.v] - Blame information for rev 13

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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