1 |
408 |
julius |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// hostSlaveMux.v ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// This file is part of the usbhostslave opencores effort.
|
6 |
|
|
//// <http://www.opencores.org/cores//> ////
|
7 |
|
|
//// ////
|
8 |
|
|
//// Module Description: ////
|
9 |
|
|
//// Controls the select line for the mux that enables the sharing
|
10 |
|
|
//// of a single SerialInterfaceEgine between the hostController
|
11 |
|
|
//// and slaveController
|
12 |
|
|
//// Also a dumping area for any features common to host and slave
|
13 |
|
|
//// operation. That is reset control and version number report.
|
14 |
|
|
//// ////
|
15 |
|
|
//// To Do: ////
|
16 |
|
|
////
|
17 |
|
|
//// ////
|
18 |
|
|
//// Author(s): ////
|
19 |
|
|
//// - Steve Fielding, sfielding@base2designs.com ////
|
20 |
|
|
//// ////
|
21 |
|
|
//////////////////////////////////////////////////////////////////////
|
22 |
|
|
//// ////
|
23 |
|
|
//// Copyright (C) 2004 Steve Fielding and OPENCORES.ORG ////
|
24 |
|
|
//// ////
|
25 |
|
|
//// This source file may be used and distributed without ////
|
26 |
|
|
//// restriction provided that this copyright statement is not ////
|
27 |
|
|
//// removed from the file and that any derivative work contains ////
|
28 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
29 |
|
|
//// ////
|
30 |
|
|
//// This source file is free software; you can redistribute it ////
|
31 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
32 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
33 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
34 |
|
|
//// later version. ////
|
35 |
|
|
//// ////
|
36 |
|
|
//// This source is distributed in the hope that it will be ////
|
37 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
38 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
39 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
40 |
|
|
//// details. ////
|
41 |
|
|
//// ////
|
42 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
43 |
|
|
//// Public License along with this source; if not, download it ////
|
44 |
|
|
//// from <http://www.opencores.org/lgpl.shtml> ////
|
45 |
|
|
//// ////
|
46 |
|
|
//////////////////////////////////////////////////////////////////////
|
47 |
|
|
//
|
48 |
|
|
`include "timescale.v"
|
49 |
|
|
|
50 |
|
|
module hostSlaveMux (
|
51 |
|
|
SIEPortCtrlInToSIE,
|
52 |
|
|
SIEPortCtrlInFromHost,
|
53 |
|
|
SIEPortCtrlInFromSlave,
|
54 |
|
|
SIEPortDataInToSIE,
|
55 |
|
|
SIEPortDataInFromHost,
|
56 |
|
|
SIEPortDataInFromSlave,
|
57 |
|
|
SIEPortWEnToSIE,
|
58 |
|
|
SIEPortWEnFromHost,
|
59 |
|
|
SIEPortWEnFromSlave,
|
60 |
|
|
fullSpeedPolarityToSIE,
|
61 |
|
|
fullSpeedPolarityFromHost,
|
62 |
|
|
fullSpeedPolarityFromSlave,
|
63 |
|
|
fullSpeedBitRateToSIE,
|
64 |
|
|
fullSpeedBitRateFromHost,
|
65 |
|
|
fullSpeedBitRateFromSlave,
|
66 |
|
|
noActivityTimeOutEnableToSIE,
|
67 |
|
|
noActivityTimeOutEnableFromHost,
|
68 |
|
|
noActivityTimeOutEnableFromSlave,
|
69 |
|
|
dataIn,
|
70 |
|
|
dataOut,
|
71 |
|
|
address,
|
72 |
|
|
writeEn,
|
73 |
|
|
strobe_i,
|
74 |
|
|
busClk,
|
75 |
|
|
usbClk,
|
76 |
|
|
hostSlaveMuxSel,
|
77 |
|
|
rstFromWire,
|
78 |
|
|
rstSyncToBusClkOut,
|
79 |
|
|
rstSyncToUsbClkOut
|
80 |
|
|
);
|
81 |
|
|
|
82 |
|
|
|
83 |
|
|
output [7:0] SIEPortCtrlInToSIE;
|
84 |
|
|
input [7:0] SIEPortCtrlInFromHost;
|
85 |
|
|
input [7:0] SIEPortCtrlInFromSlave;
|
86 |
|
|
output [7:0] SIEPortDataInToSIE;
|
87 |
|
|
input [7:0] SIEPortDataInFromHost;
|
88 |
|
|
input [7:0] SIEPortDataInFromSlave;
|
89 |
|
|
output SIEPortWEnToSIE;
|
90 |
|
|
input SIEPortWEnFromHost;
|
91 |
|
|
input SIEPortWEnFromSlave;
|
92 |
|
|
output fullSpeedPolarityToSIE;
|
93 |
|
|
input fullSpeedPolarityFromHost;
|
94 |
|
|
input fullSpeedPolarityFromSlave;
|
95 |
|
|
output fullSpeedBitRateToSIE;
|
96 |
|
|
input fullSpeedBitRateFromHost;
|
97 |
|
|
input fullSpeedBitRateFromSlave;
|
98 |
|
|
output noActivityTimeOutEnableToSIE;
|
99 |
|
|
input noActivityTimeOutEnableFromHost;
|
100 |
|
|
input noActivityTimeOutEnableFromSlave;
|
101 |
|
|
//hostSlaveMuxBI
|
102 |
|
|
input [7:0] dataIn;
|
103 |
|
|
input address;
|
104 |
|
|
input writeEn;
|
105 |
|
|
input strobe_i;
|
106 |
|
|
input busClk;
|
107 |
|
|
input usbClk;
|
108 |
|
|
input rstFromWire;
|
109 |
|
|
output rstSyncToBusClkOut;
|
110 |
|
|
output rstSyncToUsbClkOut;
|
111 |
|
|
output [7:0] dataOut;
|
112 |
|
|
input hostSlaveMuxSel;
|
113 |
|
|
|
114 |
|
|
reg [7:0] SIEPortCtrlInToSIE;
|
115 |
|
|
wire [7:0] SIEPortCtrlInFromHost;
|
116 |
|
|
wire [7:0] SIEPortCtrlInFromSlave;
|
117 |
|
|
reg [7:0] SIEPortDataInToSIE;
|
118 |
|
|
wire [7:0] SIEPortDataInFromHost;
|
119 |
|
|
wire [7:0] SIEPortDataInFromSlave;
|
120 |
|
|
reg SIEPortWEnToSIE;
|
121 |
|
|
wire SIEPortWEnFromHost;
|
122 |
|
|
wire SIEPortWEnFromSlave;
|
123 |
|
|
reg fullSpeedPolarityToSIE;
|
124 |
|
|
wire fullSpeedPolarityFromHost;
|
125 |
|
|
wire fullSpeedPolarityFromSlave;
|
126 |
|
|
reg fullSpeedBitRateToSIE;
|
127 |
|
|
wire fullSpeedBitRateFromHost;
|
128 |
|
|
wire fullSpeedBitRateFromSlave;
|
129 |
|
|
reg noActivityTimeOutEnableToSIE;
|
130 |
|
|
wire noActivityTimeOutEnableFromHost;
|
131 |
|
|
wire noActivityTimeOutEnableFromSlave;
|
132 |
|
|
//hostSlaveMuxBI
|
133 |
|
|
wire [7:0] dataIn;
|
134 |
|
|
wire address;
|
135 |
|
|
wire writeEn;
|
136 |
|
|
wire strobe_i;
|
137 |
|
|
wire busClk;
|
138 |
|
|
wire usbClk;
|
139 |
|
|
wire rstSyncToBusClkOut;
|
140 |
|
|
wire rstSyncToUsbClkOut;
|
141 |
|
|
wire rstFromWire;
|
142 |
|
|
wire [7:0] dataOut;
|
143 |
|
|
wire hostSlaveMuxSel;
|
144 |
|
|
|
145 |
|
|
//internal wires and regs
|
146 |
|
|
wire hostMode;
|
147 |
|
|
|
148 |
|
|
always @(hostMode or
|
149 |
|
|
SIEPortCtrlInFromHost or
|
150 |
|
|
SIEPortCtrlInFromSlave or
|
151 |
|
|
SIEPortDataInFromHost or
|
152 |
|
|
SIEPortDataInFromSlave or
|
153 |
|
|
SIEPortWEnFromHost or
|
154 |
|
|
SIEPortWEnFromSlave or
|
155 |
|
|
fullSpeedPolarityFromHost or
|
156 |
|
|
fullSpeedPolarityFromSlave or
|
157 |
|
|
fullSpeedBitRateFromHost or
|
158 |
|
|
fullSpeedBitRateFromSlave or
|
159 |
|
|
noActivityTimeOutEnableFromHost or
|
160 |
|
|
noActivityTimeOutEnableFromSlave)
|
161 |
|
|
begin
|
162 |
|
|
if (hostMode == 1'b1)
|
163 |
|
|
begin
|
164 |
|
|
SIEPortCtrlInToSIE <= SIEPortCtrlInFromHost;
|
165 |
|
|
SIEPortDataInToSIE <= SIEPortDataInFromHost;
|
166 |
|
|
SIEPortWEnToSIE <= SIEPortWEnFromHost;
|
167 |
|
|
fullSpeedPolarityToSIE <= fullSpeedPolarityFromHost;
|
168 |
|
|
fullSpeedBitRateToSIE <= fullSpeedBitRateFromHost;
|
169 |
|
|
noActivityTimeOutEnableToSIE <= noActivityTimeOutEnableFromHost;
|
170 |
|
|
end
|
171 |
|
|
else
|
172 |
|
|
begin
|
173 |
|
|
SIEPortCtrlInToSIE <= SIEPortCtrlInFromSlave;
|
174 |
|
|
SIEPortDataInToSIE <= SIEPortDataInFromSlave;
|
175 |
|
|
SIEPortWEnToSIE <= SIEPortWEnFromSlave;
|
176 |
|
|
fullSpeedPolarityToSIE <= fullSpeedPolarityFromSlave;
|
177 |
|
|
fullSpeedBitRateToSIE <= fullSpeedBitRateFromSlave;
|
178 |
|
|
noActivityTimeOutEnableToSIE <= noActivityTimeOutEnableFromSlave;
|
179 |
|
|
end
|
180 |
|
|
end
|
181 |
|
|
|
182 |
|
|
hostSlaveMuxBI u_hostSlaveMuxBI (
|
183 |
|
|
.dataIn(dataIn),
|
184 |
|
|
.dataOut(dataOut),
|
185 |
|
|
.address(address),
|
186 |
|
|
.writeEn(writeEn),
|
187 |
|
|
.strobe_i(strobe_i),
|
188 |
|
|
.busClk(busClk),
|
189 |
|
|
.usbClk(usbClk),
|
190 |
|
|
.hostMode(hostMode),
|
191 |
|
|
.hostSlaveMuxSel(hostSlaveMuxSel),
|
192 |
|
|
.rstFromWire(rstFromWire),
|
193 |
|
|
.rstSyncToBusClkOut(rstSyncToBusClkOut),
|
194 |
|
|
.rstSyncToUsbClkOut(rstSyncToUsbClkOut) );
|
195 |
|
|
|
196 |
|
|
|
197 |
|
|
endmodule
|