|
|
module usbDeviceActelTop (
|
module usbDeviceActelTop (
|
|
|
//
|
//
|
// Global signals
|
// Global signals
|
//
|
//
|
clk,
|
clk,
|
rst_n,
|
rst_n,
|
|
|
// eval board features
|
// eval board features
|
ledOut,
|
ledOut,
|
|
|
//
|
//
|
// USB
|
// USB
|
//
|
//
|
usbSlaveVP,
|
usbSlaveVP,
|
usbSlaveVM,
|
usbSlaveVM,
|
usbSlaveOE_n,
|
usbSlaveOE_n,
|
usbDPlusPullup
|
usbDPlusPullup
|
|
|
);
|
);
|
|
|
//
|
//
|
// Global signals
|
// Global signals
|
//
|
//
|
input clk;
|
input clk;
|
input rst_n;
|
input rst_n;
|
|
|
output [9:0] ledOut;
|
output [9:0] ledOut;
|
|
|
//
|
//
|
// USB
|
// USB
|
//
|
//
|
inout usbSlaveVP;
|
inout usbSlaveVP;
|
inout usbSlaveVM;
|
inout usbSlaveVM;
|
output usbSlaveOE_n;
|
output usbSlaveOE_n;
|
output usbDPlusPullup;
|
output usbDPlusPullup;
|
|
|
//local wires and regs
|
//local wires and regs
|
reg [1:0] rstReg;
|
reg [1:0] rstReg;
|
wire rst;
|
wire rst;
|
|
|
//generate sync reset
|
//generate sync reset
|
always @(posedge clk) begin
|
always @(posedge clk) begin
|
rstReg[1:0] <= {rstReg[0], ~rst_n};
|
rstReg[1:0] <= {rstReg[0], ~rst_n};
|
end
|
end
|
assign rst = rstReg[1];
|
assign rst = rstReg[1];
|
|
|
|
|
usbDevice u_usbDevice (
|
usbDevice u_usbDevice (
|
.clk(clk),
|
.clk(clk),
|
.rst(rst),
|
.rst(rst),
|
.usbSlaveVP_in(usbSlaveVP_in),
|
.usbSlaveVP_in(usbSlaveVP_in),
|
.usbSlaveVM_in(usbSlaveVM_in),
|
.usbSlaveVM_in(usbSlaveVM_in),
|
.usbSlaveVP_out(usbSlaveVP_out),
|
.usbSlaveVP_out(usbSlaveVP_out),
|
.usbSlaveVM_out(usbSlaveVM_out),
|
.usbSlaveVM_out(usbSlaveVM_out),
|
.usbSlaveOE_n(usbSlaveOE_n),
|
.usbSlaveOE_n(usbSlaveOE_n),
|
.usbDPlusPullup(usbDPlusPullup),
|
.usbDPlusPullup(usbDPlusPullup),
|
.vBusDetect(1'b1)
|
.vBusDetect(1'b1)
|
);
|
);
|
|
|
|
|
assign {usbSlaveVP_in, usbSlaveVM_in} = {usbSlaveVP, usbSlaveVM};
|
assign {usbSlaveVP_in, usbSlaveVM_in} = {usbSlaveVP, usbSlaveVM};
|
assign {usbSlaveVP, usbSlaveVM} = (usbSlaveOE_n == 1'b0) ? {usbSlaveVP_out, usbSlaveVM_out} : 2'bzz;
|
assign {usbSlaveVP, usbSlaveVM} = (usbSlaveOE_n == 1'b0) ? {usbSlaveVP_out, usbSlaveVM_out} : 2'bzz;
|
|
|
|
|
// comfort lights
|
// comfort lights
|
reg [9:0] ledCntReg;
|
reg [9:0] ledCntReg;
|
reg [21:0] cnt;
|
reg [21:0] cnt;
|
|
|
assign ledOut = ledCntReg;
|
assign ledOut = ledCntReg;
|
|
|
|
|
always @(posedge clk) begin
|
always @(posedge clk) begin
|
if (rst == 1'b1) begin
|
if (rst == 1'b1) begin
|
ledCntReg <= 10'b00_0000_0000;
|
ledCntReg <= 10'b00_0000_0000;
|
cnt <= {22{1'b0}};
|
cnt <= {22{1'b0}};
|
end
|
end
|
else begin
|
else begin
|
cnt <= cnt + 1'b1;
|
cnt <= cnt + 1'b1;
|
if (cnt == {22{1'b0}})
|
if (cnt == {22{1'b0}})
|
ledCntReg <= ledCntReg + 1'b1;
|
ledCntReg <= ledCntReg + 1'b1;
|
end
|
end
|
end
|
end
|
|
|
endmodule
|
endmodule
|
|
|
|
|
|
|