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

Subversion Repositories usbhostslave

[/] [usbhostslave/] [trunk/] [usbDevice/] [RTL/] [usbDeviceActelTop.v] - Blame information for rev 44

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

Line No. Rev Author Line
1 37 sfielding
 
2
module usbDeviceActelTop (
3
 
4
  //
5
  // Global signals
6
  //
7
  clk,
8
  rst_n,
9
 
10
  // eval board features
11
  ledOut,
12
 
13
  //
14
  // USB
15
  //
16
  usbSlaveVP,
17
  usbSlaveVM,
18
  usbSlaveOE_n,
19
  usbDPlusPullup
20
 
21
);
22
 
23
  //
24
  // Global signals
25
  //
26
  input clk;
27
  input rst_n;
28
 
29
  output [9:0] ledOut;
30
 
31
  //
32
  // USB
33
  //
34
  inout usbSlaveVP;
35
  inout usbSlaveVM;
36
  output usbSlaveOE_n;
37
  output usbDPlusPullup;
38
 
39
//local wires and regs
40
reg [1:0] rstReg;
41
wire rst;
42
 
43
//generate sync reset
44
always @(posedge clk) begin
45
  rstReg[1:0] <= {rstReg[0], ~rst_n};
46
end
47
assign rst = rstReg[1];
48
 
49
 
50
usbDevice u_usbDevice (
51
  .clk(clk),
52
  .rst(rst),
53
  .usbSlaveVP_in(usbSlaveVP_in),
54
  .usbSlaveVM_in(usbSlaveVM_in),
55
  .usbSlaveVP_out(usbSlaveVP_out),
56
  .usbSlaveVM_out(usbSlaveVM_out),
57
  .usbSlaveOE_n(usbSlaveOE_n),
58
  .usbDPlusPullup(usbDPlusPullup),
59
  .vBusDetect(1'b1)
60
);
61
 
62
 
63
assign {usbSlaveVP_in, usbSlaveVM_in} = {usbSlaveVP, usbSlaveVM};
64
assign {usbSlaveVP, usbSlaveVM} = (usbSlaveOE_n == 1'b0) ? {usbSlaveVP_out, usbSlaveVM_out} : 2'bzz;
65
 
66
 
67
// comfort lights
68
reg [9:0] ledCntReg;
69
reg [21:0] cnt;
70
 
71
assign ledOut = ledCntReg;
72
 
73
 
74
always @(posedge clk) begin
75
  if (rst == 1'b1) begin
76
    ledCntReg <= 10'b00_0000_0000;
77
    cnt <= {22{1'b0}};
78
  end
79
  else begin
80
    cnt <= cnt + 1'b1;
81
    if (cnt == {22{1'b0}})
82
      ledCntReg <= ledCntReg + 1'b1;
83
  end
84
end
85
 
86
endmodule
87
 
88
 

powered by: WebSVN 2.1.0

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