////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
//
|
//
|
// WISHBONE revB.2 compliant Xgate Coprocessor - Master Bus interface
|
// WISHBONE revB.2 compliant Xgate Coprocessor - Master Bus interface
|
//
|
//
|
// Author: Bob Hayes
|
// Author: Bob Hayes
|
// rehayes@opencores.org
|
// rehayes@opencores.org
|
//
|
//
|
// Downloaded from: http://www.opencores.org/projects/xgate.....
|
// Downloaded from: http://www.opencores.org/projects/xgate.....
|
//
|
//
|
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
// Copyright (c) 2009, Robert Hayes
|
// Copyright (c) 2009, Robert Hayes
|
//
|
//
|
// This source file is free software: you can redistribute it and/or modify
|
// This source file is free software: you can redistribute it and/or modify
|
// it under the terms of the GNU Lesser General Public License as published
|
// it under the terms of the GNU Lesser General Public License as published
|
// by the Free Software Foundation, either version 3 of the License, or
|
// by the Free Software Foundation, either version 3 of the License, or
|
// (at your option) any later version.
|
// (at your option) any later version.
|
//
|
//
|
// Supplemental terms.
|
// Supplemental terms.
|
// * Redistributions of source code must retain the above copyright
|
// * Redistributions of source code must retain the above copyright
|
// notice, this list of conditions and the following disclaimer.
|
// notice, this list of conditions and the following disclaimer.
|
// * Neither the name of the <organization> nor the
|
// * Neither the name of the <organization> nor the
|
// names of its contributors may be used to endorse or promote products
|
// names of its contributors may be used to endorse or promote products
|
// derived from this software without specific prior written permission.
|
// derived from this software without specific prior written permission.
|
//
|
//
|
// THIS SOFTWARE IS PROVIDED BY Robert Hayes ''AS IS'' AND ANY
|
// THIS SOFTWARE IS PROVIDED BY Robert Hayes ''AS IS'' AND ANY
|
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
// DISCLAIMED. IN NO EVENT SHALL Robert Hayes BE LIABLE FOR ANY
|
// DISCLAIMED. IN NO EVENT SHALL Robert Hayes BE LIABLE FOR ANY
|
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
//
|
//
|
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
|
module xgate_wbm_bus #(parameter ARST_LVL = 1'b0, // asynchronous reset level
|
module xgate_wbm_bus #(parameter ARST_LVL = 1'b0, // asynchronous reset level
|
parameter DWIDTH = 16,
|
parameter DWIDTH = 16,
|
parameter SINGLE_CYCLE = 1'b0)
|
parameter SINGLE_CYCLE = 1'b0)
|
(
|
(
|
// Wishbone Signals
|
// Wishbone Signals
|
output [DWIDTH-1:0] wbm_dat_o, // databus output
|
output [DWIDTH-1:0] wbm_dat_o, // databus output
|
output wbm_we_o, // write enable output
|
output wbm_we_o, // write enable output
|
output wbm_stb_o, // stobe/core select signal
|
output wbm_stb_o, // stobe/core select signal
|
output wbm_cyc_o, // valid bus cycle output
|
output wbm_cyc_o, // valid bus cycle output
|
output [ 1:0] wbm_sel_o, // Select byte in word bus transaction
|
output [ 1:0] wbm_sel_o, // Select byte in word bus transaction
|
output [15:0] wbm_adr_o, // Address bits
|
output [15:0] wbm_adr_o, // Address bits
|
input [DWIDTH-1:0] wbm_dat_i, // databus input
|
input [DWIDTH-1:0] wbm_dat_i, // databus input
|
input wbm_ack_i, // bus cycle acknowledge input
|
input wbm_ack_i, // bus cycle acknowledge input
|
input wbs_clk_i, // master clock input
|
input wbs_clk_i, // master clock input
|
input wbs_rst_i, // synchronous active high reset
|
input wbs_rst_i, // synchronous active high reset
|
input arst_i, // asynchronous reset
|
input arst_i, // asynchronous reset
|
// XGATE Control Signals
|
// XGATE Control Signals
|
output [DWIDTH-1:0] read_mem_data, // Data from system memory
|
output [DWIDTH-1:0] read_mem_data, // Data from system memory
|
output mem_req_ack, // Memory bus transaction complete
|
output mem_req_ack, // Memory bus transaction complete
|
input [15:0] xgate_address, // Address to system memory
|
input [15:0] xgate_address, // Address to system memory
|
input write_mem_strb_l, // Strobe for writing low data byte
|
input write_mem_strb_l, // Strobe for writing low data byte
|
input write_mem_strb_h, // Strobe for writing high data bye
|
input write_mem_strb_h, // Strobe for writing high data bye
|
input [DWIDTH-1:0] write_mem_data // Data to system memory
|
input [DWIDTH-1:0] write_mem_data // Data to system memory
|
);
|
);
|
|
|
|
|
// registers
|
// registers
|
|
|
// Wires
|
// Wires
|
wire module_sel; // This module is selected for bus transaction
|
wire module_sel; // This module is selected for bus transaction
|
|
|
//
|
//
|
// module body
|
// module body
|
//
|
//
|
|
|
// generate internal resets
|
// generate internal resets
|
|
|
assign wbm_dat_o = write_mem_data;
|
assign wbm_dat_o = write_mem_data;
|
assign read_mem_data = wbm_dat_i;
|
assign read_mem_data = wbm_dat_i;
|
assign wbm_adr_o = xgate_address;
|
assign wbm_adr_o = xgate_address;
|
|
|
assign mem_req_ack = wbm_ack_i;
|
assign mem_req_ack = wbm_ack_i;
|
|
|
|
assign wbm_we_o = write_mem_strb_h || write_mem_strb_l;
|
|
|
|
assign wbm_sel_o = {write_mem_strb_h, write_mem_strb_l};
|
|
|
|
assign wbm_cyc_o = 1'b1;
|
|
|
|
assign wbm_stb_o = 1'b1;
|
|
|
endmodule // xgate_wbm_bus
|
endmodule // xgate_wbm_bus
|
|
|