1 //////////////////////////////////////////////////////////////////////
\r
3 //// wishBoneBI.v ////
\r
5 //// This file is part of the usbhostslave opencores effort.
\r
6 //// <http://www.opencores.org/cores//> ////
\r
8 //// Module Description: ////
\r
14 //// Author(s): ////
\r
15 //// - Steve Fielding, sfielding@base2designs.com ////
\r
17 //////////////////////////////////////////////////////////////////////
\r
19 //// Copyright (C) 2004 Steve Fielding and OPENCORES.ORG ////
\r
21 //// This source file may be used and distributed without ////
\r
22 //// restriction provided that this copyright statement is not ////
\r
23 //// removed from the file and that any derivative work contains ////
\r
24 //// the original copyright notice and the associated disclaimer. ////
\r
26 //// This source file is free software; you can redistribute it ////
\r
27 //// and/or modify it under the terms of the GNU Lesser General ////
\r
28 //// Public License as published by the Free Software Foundation; ////
\r
29 //// either version 2.1 of the License, or (at your option) any ////
\r
30 //// later version. ////
\r
32 //// This source is distributed in the hope that it will be ////
\r
33 //// useful, but WITHOUT ANY WARRANTY; without even the implied ////
\r
34 //// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
\r
35 //// PURPOSE. See the GNU Lesser General Public License for more ////
\r
38 //// You should have received a copy of the GNU Lesser General ////
\r
39 //// Public License along with this source; if not, download it ////
\r
40 //// from <http://www.opencores.org/lgpl.shtml> ////
\r
42 //////////////////////////////////////////////////////////////////////
\r
44 `include "timescale.v"
\r
45 `include "spiMaster_defines.v"
\r
50 address, dataIn, dataOut, writeEn,
\r
54 rxFifoSel, txFifoSel,
\r
61 input [7:0] address;
\r
63 output [7:0] dataOut;
\r
67 output ctrlStsRegSel;
\r
70 input [7:0] dataFromCtrlStsReg;
\r
71 input [7:0] dataFromRxFifo;
\r
72 input [7:0] dataFromTxFifo;
\r
86 wire [7:0] dataFromCtrlStsReg;
\r
87 wire [7:0] dataFromRxFifo;
\r
88 wire [7:0] dataFromTxFifo;
\r
90 //internal wires and regs
\r
94 //address decode and data mux
\r
96 dataFromCtrlStsReg or
\r
100 ctrlStsRegSel <= 1'b0;
\r
103 case (address & `ADDRESS_DECODE_MASK)
\r
104 `CTRL_STS_REG_BASE : begin
\r
105 ctrlStsRegSel <= 1'b1;
\r
106 dataOut <= dataFromCtrlStsReg;
\r
108 `RX_FIFO_BASE : begin
\r
110 dataOut <= dataFromRxFifo;
\r
112 `TX_FIFO_BASE : begin
\r
114 dataOut <= dataFromTxFifo;
\r
122 always @(posedge clk) begin
\r
123 ack_delayed <= strobe_i;
\r
127 always @(strobe_i) begin
\r
128 ack_immediate <= strobe_i;
\r
131 //select between immediate and delayed ack
\r
132 always @(writeEn or address or ack_delayed or ack_immediate) begin
\r
133 if (writeEn == 1'b0 &&
\r
134 (address == `RX_FIFO_BASE + `FIFO_DATA_REG ||
\r
135 address == `TX_FIFO_BASE + `FIFO_DATA_REG) )
\r
137 ack_o <= ack_delayed;
\r
141 ack_o <= ack_immediate;
\r