1 |
12 |
rehayes |
////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
//
|
3 |
|
|
// WISHBONE revB.2 compliant Xgate Coprocessor - Master Bus interface
|
4 |
|
|
//
|
5 |
|
|
// Author: Bob Hayes
|
6 |
|
|
// rehayes@opencores.org
|
7 |
|
|
//
|
8 |
|
|
// Downloaded from: http://www.opencores.org/projects/xgate.....
|
9 |
|
|
//
|
10 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
11 |
|
|
// Copyright (c) 2009, Robert Hayes
|
12 |
|
|
//
|
13 |
|
|
// This source file is free software: you can redistribute it and/or modify
|
14 |
|
|
// it under the terms of the GNU Lesser General Public License as published
|
15 |
|
|
// by the Free Software Foundation, either version 3 of the License, or
|
16 |
|
|
// (at your option) any later version.
|
17 |
|
|
//
|
18 |
|
|
// Supplemental terms.
|
19 |
|
|
// * Redistributions of source code must retain the above copyright
|
20 |
|
|
// notice, this list of conditions and the following disclaimer.
|
21 |
|
|
// * Neither the name of the <organization> nor the
|
22 |
|
|
// names of its contributors may be used to endorse or promote products
|
23 |
|
|
// derived from this software without specific prior written permission.
|
24 |
|
|
//
|
25 |
|
|
// THIS SOFTWARE IS PROVIDED BY Robert Hayes ''AS IS'' AND ANY
|
26 |
|
|
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
27 |
|
|
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
28 |
|
|
// DISCLAIMED. IN NO EVENT SHALL Robert Hayes BE LIABLE FOR ANY
|
29 |
|
|
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
30 |
|
|
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
31 |
|
|
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
32 |
|
|
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
33 |
|
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
34 |
|
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
35 |
|
|
//
|
36 |
|
|
// You should have received a copy of the GNU General Public License
|
37 |
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
38 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
39 |
|
|
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
40 |
|
|
|
41 |
|
|
module xgate_wbm_bus #(parameter ARST_LVL = 1'b0, // asynchronous reset level
|
42 |
|
|
parameter DWIDTH = 16,
|
43 |
|
|
parameter SINGLE_CYCLE = 1'b0)
|
44 |
|
|
(
|
45 |
|
|
// Wishbone Signals
|
46 |
|
|
output [DWIDTH-1:0] wbm_dat_o, // databus output
|
47 |
|
|
output wbm_we_o, // write enable output
|
48 |
|
|
output wbm_stb_o, // stobe/core select signal
|
49 |
|
|
output wbm_cyc_o, // valid bus cycle output
|
50 |
|
|
output [ 1:0] wbm_sel_o, // Select byte in word bus transaction
|
51 |
|
|
output [15:0] wbm_adr_o, // Address bits
|
52 |
|
|
input [DWIDTH-1:0] wbm_dat_i, // databus input
|
53 |
|
|
input wbm_ack_i, // bus cycle acknowledge input
|
54 |
|
|
input wbs_clk_i, // master clock input
|
55 |
|
|
input wbs_rst_i, // synchronous active high reset
|
56 |
|
|
input arst_i, // asynchronous reset
|
57 |
29 |
rehayes |
// XGATE Control Signals
|
58 |
12 |
rehayes |
output [DWIDTH-1:0] read_mem_data, // Data from system memory
|
59 |
|
|
output mem_req_ack, // Memory bus transaction complete
|
60 |
|
|
input [15:0] xgate_address, // Address to system memory
|
61 |
|
|
input write_mem_strb_l, // Strobe for writing low data byte
|
62 |
|
|
input write_mem_strb_h, // Strobe for writing high data bye
|
63 |
|
|
input [DWIDTH-1:0] write_mem_data // Data to system memory
|
64 |
|
|
);
|
65 |
|
|
|
66 |
|
|
|
67 |
|
|
// registers
|
68 |
|
|
|
69 |
|
|
// Wires
|
70 |
|
|
wire module_sel; // This module is selected for bus transaction
|
71 |
|
|
|
72 |
|
|
//
|
73 |
|
|
// module body
|
74 |
|
|
//
|
75 |
|
|
|
76 |
|
|
// generate internal resets
|
77 |
|
|
|
78 |
|
|
assign wbm_dat_o = write_mem_data;
|
79 |
|
|
assign read_mem_data = wbm_dat_i;
|
80 |
|
|
assign wbm_adr_o = xgate_address;
|
81 |
|
|
|
82 |
|
|
assign mem_req_ack = wbm_ack_i;
|
83 |
29 |
rehayes |
|
84 |
|
|
assign wbm_we_o = write_mem_strb_h || write_mem_strb_l;
|
85 |
|
|
|
86 |
|
|
assign wbm_sel_o = {write_mem_strb_h, write_mem_strb_l};
|
87 |
|
|
|
88 |
|
|
assign wbm_cyc_o = 1'b1;
|
89 |
|
|
|
90 |
|
|
assign wbm_stb_o = 1'b1;
|
91 |
12 |
rehayes |
|
92 |
|
|
endmodule // xgate_wbm_bus
|