|
楼主 |
发表于 2014-4-5 17:19:21
|
显示全部楼层
- always@(posedge clk or negedge rst_n)
- if(!rst_n)
- cur_state<=IDLE;
- else
- cur_state<=next_state;
-
- always@(cur_state,flaga,flagd,ack,USB_Command,empty)
- begin
- next_state = cur_state;
- case(cur_state)
- IDLE:
- begin
- if(flaga == 1'b1)
- next_state = READ_COM;
- end
- READ_COM:
- begin
- if((USB_Command[39:32]==8'h7e)&&(USB_Command[7:0]==8'hff)) //receive
- next_state = BUSY;
- else if(flaga == 1'b0)
- next_state = IDLE;
- end
- BUSY:
- begin
- if((ack == 1'b1)&&(empty==1'b1))
- next_state = FINISH;
- end
- FINISH:
- begin
- if(ack == 1'b0)
- next_state = IDLE;
- end
- endcase
- end
复制代码 还是把代码贴上来了吧 |
|