OpenCores
URL https://opencores.org/ocsvn/usbhostslave/usbhostslave/trunk

Subversion Repositories usbhostslave

[/] [usbhostslave/] [trunk/] [usbDevice/] [RTL/] [usbDeviceAlteraTop.v] - Blame information for rev 37

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 37 sfielding
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
//// usbDeviceAlteraTop.v                                                 ////
4
////                                                              ////
5
//// This file is part of the spiMaster opencores effort.
6
//// <http://www.opencores.org/cores//>                           ////
7
////                                                              ////
8
//// Module Description:                                          ////
9
//// Top level module for Altera FPGA and NXP ISP1105 USB PHY.
10
//// Specifically it targets the Base2Designs Altera Development board.
11
//// Instantiates a PLL so that the lock signal can be used
12
//// to reset the logic, and ties unused control signals
13
//// to the off or disabled state
14
////                                                              ////
15
//// To Do:                                                       ////
16
//// 
17
////                                                              ////
18
//// Author(s):                                                   ////
19
//// - Steve Fielding, sfielding@base2designs.com                 ////
20
////                                                              ////
21
//////////////////////////////////////////////////////////////////////
22
////                                                              ////
23
//// Copyright (C) 2008 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
 
49
module usbDeviceAlteraTop (
50
 
51
        //
52
        // Global signals
53
        //
54
                clk,
55
 
56
        //
57
        // SDRAM
58
        //
59
        mc_addr,
60
        mc_ba,
61
        mc_dqm,
62
        mc_we_,
63
        mc_cas_,
64
        mc_ras_,
65
        mc_cke_,
66
        sdram_cs,
67
        sdram_clk,
68
 
69
  //
70
  // SPI bus
71
  //
72
  spiClk,
73
  spiMasterDataOut,
74
  spiCS_n,
75
 
76
 
77
  //
78
  // USB host
79
  //
80
  usbHostOE_n,
81
 
82
  //
83
  // USB slave
84
  //
85
  usbSlaveVP,
86
  usbSlaveVM,
87
  usbSlaveOE_n,
88
  usbDPlusPullup,
89
  vBusDetect
90
);
91
        //
92
        // Global signals
93
        //
94
        input   clk;
95
 
96
        //
97
        // SDRAM
98
        //
99
        output  [11:0]   mc_addr;
100
        output  [1:0]    mc_ba;
101
        output  [3:0]    mc_dqm;
102
        output          mc_we_;
103
        output          mc_cas_;
104
        output          mc_ras_;
105
        output          mc_cke_;
106
        output          sdram_cs;
107
        output          sdram_clk;
108
 
109
  //
110
  // SPI bus
111
  //
112
  output spiClk;
113
  output spiMasterDataOut;
114
  output spiCS_n;
115
 
116
  //
117
  // USB host
118
  //
119
  output usbHostOE_n;
120
 
121
  //
122
  // USB slave
123
  //
124
  inout usbSlaveVP;
125
  inout usbSlaveVM;
126
  output usbSlaveOE_n;
127
  output usbDPlusPullup;
128
  input vBusDetect;
129
 
130
//local wires and regs
131
reg [1:0] rstReg;
132
wire rst;
133
wire pll_locked;
134
 
135
assign mc_addr = {12{1'b0}};
136
assign mc_ba = 2'b00;
137
assign mc_dqm = 4'h0;
138
assign mc_we_ = 1'b1;
139
assign mc_cas_ = 1'b1;
140
assign mc_ras_ = 1'b1;
141
assign mc_cke_ = 1'b1;
142
assign sdram_cs = 1'b1;
143
assign sdram_clk = 1'b1;
144
assign spiClk = 1'b0;
145
assign spiMasterDataOut = 1'b0;
146
assign spiCS_n = 1'b1;
147
assign usbHostOE_n = 1'b1;
148
 
149
pll_48MHz       pll_48MHz_inst (
150
        .inclk0 ( clk ),
151
        .locked( pll_locked)
152
        );
153
 
154
//generate sync reset from pll lock signal
155
always @(posedge clk) begin
156
  rstReg[1:0] <= {rstReg[0], ~pll_locked};
157
end
158
assign rst = rstReg[1];
159
 
160
 
161
usbDevice u_usbDevice (
162
  .clk(clk),
163
  .rst(rst),
164
  .usbSlaveVP_in(usbSlaveVP_in),
165
  .usbSlaveVM_in(usbSlaveVM_in),
166
  .usbSlaveVP_out(usbSlaveVP_out),
167
  .usbSlaveVM_out(usbSlaveVM_out),
168
  .usbSlaveOE_n(usbSlaveOE_n),
169
  .usbDPlusPullup(usbDPlusPullup),
170
  .vBusDetect(vBusDetect)
171
);
172
 
173
 
174
assign {usbSlaveVP_in, usbSlaveVM_in} = {usbSlaveVP, usbSlaveVM};
175
assign {usbSlaveVP, usbSlaveVM} = (usbSlaveOE_n == 1'b0) ? {usbSlaveVP_out, usbSlaveVM_out} : 2'bzz;
176
 
177
endmodule
178
 
179
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.