USB接口芯片FT245AM的原理
5AM读信号
本文链接地址:http://www.oyaya.net/fanwen/view/160411.html
always@(posedge clk or negedge reset)
begin
if(reset = =1'b0)
usb_rd<=1'b1;
else if(usb_rxf= =1'b1)
usb_rd<=1'b1;
else if(usb_rd= =1'b0)
usb_rd<=1'b1;
else if((usb_rxf = = 1'b0)&&(usb_rden= =1'b1)&&(cnt= =2'd0))
usb_rd<=~usb_rd;
end
//---------------------
//计数器,控制FT245AM读写时序
always@(posedge clk or negedge reset)
begin
if(reset = =1'b0)
cnt<=2'd0;
else if(cnt !=2'd0)
cnt<=cnt+1'b1;
else if((usb_txe = =1'b0)&&(data_valid = =1'b1)&&(usb_rden= =1'b0))
ent<=cnt+1'b1;
end
//---------------------
//产生FT245AM写信号
always@(posedge clk or negedge reset)
begin
if(reset= =1'b0)
usb_wr<=1'b0;
else
usb_wr<=(cnt= =2'd1);
end
//---------------------
//读取USB主机数据
always@(posedge clk or negedge reset)
begin
if(reset= =1'b0)
rx_data<=8'b00;
else if(usb_rd = = 1'b0)
rxdata<=usb_data;
end
《USB接口芯片FT245AM的原理(第3页)》