1 |
24 |
rehayes |
////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
//
|
3 |
|
|
// WISHBONE revB.2 compliant -- Wishbone Bus interface
|
4 |
|
|
//
|
5 |
|
|
// Author: Bob Hayes
|
6 |
|
|
// rehayes@opencores.org
|
7 |
|
|
//
|
8 |
|
|
// Downloaded from: http://www.opencores.org/projects/pit.....
|
9 |
|
|
//
|
10 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
11 |
|
|
// Copyright (c) 2011, Robert Hayes
|
12 |
|
|
//
|
13 |
|
|
// All rights reserved.
|
14 |
|
|
//
|
15 |
|
|
// Redistribution and use in source and binary forms, with or without
|
16 |
|
|
// modification, are permitted provided that the following conditions are met:
|
17 |
|
|
// * Redistributions of source code must retain the above copyright
|
18 |
|
|
// notice, this list of conditions and the following disclaimer.
|
19 |
|
|
// * Redistributions in binary form must reproduce the above copyright
|
20 |
|
|
// notice, this list of conditions and the following disclaimer in the
|
21 |
|
|
// documentation and/or other materials provided with the distribution.
|
22 |
|
|
// * Neither the name of the nor the
|
23 |
|
|
// names of its contributors may be used to endorse or promote products
|
24 |
|
|
// derived from this software without specific prior written permission.
|
25 |
|
|
//
|
26 |
|
|
// THIS SOFTWARE IS PROVIDED BY Robert Hayes ''AS IS'' AND ANY
|
27 |
|
|
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
28 |
|
|
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
29 |
|
|
// DISCLAIMED. IN NO EVENT SHALL Robert Hayes BE LIABLE FOR ANY
|
30 |
|
|
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
31 |
|
|
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
32 |
|
|
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
33 |
|
|
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
34 |
|
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
35 |
|
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
36 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
37 |
|
|
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
38 |
|
|
|
39 |
|
|
// The signal names lose their "_i", "_o" postfix since that is relative to
|
40 |
|
|
// their usage in a specific instance declaration.
|
41 |
|
|
|
42 |
|
|
interface wishbone_if #(parameter D_WIDTH = 16,
|
43 |
|
|
parameter A_WIDTH = 3,
|
44 |
|
|
parameter S_WIDTH = 2)
|
45 |
|
|
|
46 |
|
|
// These signals are connected in the top-most instance instantation
|
47 |
|
|
(input logic wb_clk, // master clock input
|
48 |
|
|
input logic arst, // asynchronous reset
|
49 |
|
|
input logic wb_rst); // synchronous active high reset
|
50 |
|
|
|
51 |
|
|
// These signals are hierarchal to the instance instantation and bridge
|
52 |
|
|
// between all the modules that use the same top-most instantiation.
|
53 |
|
|
// These signals may change direction based on interface usage
|
54 |
|
|
logic [D_WIDTH-1:0] wb_dat; // databus
|
55 |
|
|
logic [A_WIDTH-1:0] wb_adr; // address bits
|
56 |
|
|
logic wb_we; // write enable input
|
57 |
|
|
logic wb_cyc; // valid bus cycle input
|
58 |
|
|
logic [S_WIDTH-1:0] wb_sel; // Select bytes in word bus transaction
|
59 |
|
|
|
60 |
|
|
// Define the signal directions when the interface is used as a slave
|
61 |
|
|
modport slave (input wb_clk,
|
62 |
|
|
arst,
|
63 |
|
|
wb_rst,
|
64 |
|
|
wb_adr,
|
65 |
|
|
wb_we,
|
66 |
|
|
wb_cyc,
|
67 |
|
|
wb_sel,
|
68 |
|
|
wb_dat);
|
69 |
|
|
|
70 |
|
|
// define the signal directions when the interface is used as a master
|
71 |
|
|
modport master (output wb_adr,
|
72 |
|
|
wb_we,
|
73 |
|
|
wb_cyc,
|
74 |
|
|
wb_sel,
|
75 |
|
|
wb_dat,
|
76 |
|
|
input wb_clk,
|
77 |
|
|
arst,
|
78 |
|
|
wb_rst);
|
79 |
|
|
|
80 |
|
|
endinterface // wishbone_if
|