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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [rtl/] [verilog/] [usbhostslave/] [directControl.v] - Blame information for rev 682

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

Line No. Rev Author Line
1 408 julius
 
2
// File        : ../RTL/hostController/directcontrol.v
3
// Generated   : 11/10/06 05:37:19
4
// From        : ../RTL/hostController/directcontrol.asf
5
// By          : FSM2VHDL ver. 5.0.0.9
6
 
7
//////////////////////////////////////////////////////////////////////
8
////                                                              ////
9
//// directControl
10
////                                                              ////
11
//// This file is part of the usbhostslave opencores effort.
12
//// http://www.opencores.org/cores/usbhostslave/                 ////
13
////                                                              ////
14
//// Module Description:                                          ////
15
//// 
16
////                                                              ////
17
//// To Do:                                                       ////
18
//// 
19
////                                                              ////
20
//// Author(s):                                                   ////
21
//// - Steve Fielding, sfielding@base2designs.com                 ////
22
////                                                              ////
23
//////////////////////////////////////////////////////////////////////
24
////                                                              ////
25
//// Copyright (C) 2004 Steve Fielding and OPENCORES.ORG          ////
26
////                                                              ////
27
//// This source file may be used and distributed without         ////
28
//// restriction provided that this copyright statement is not    ////
29
//// removed from the file and that any derivative work contains  ////
30
//// the original copyright notice and the associated disclaimer. ////
31
////                                                              ////
32
//// This source file is free software; you can redistribute it   ////
33
//// and/or modify it under the terms of the GNU Lesser General   ////
34
//// Public License as published by the Free Software Foundation; ////
35
//// either version 2.1 of the License, or (at your option) any   ////
36
//// later version.                                               ////
37
////                                                              ////
38
//// This source is distributed in the hope that it will be       ////
39
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
40
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
41
//// PURPOSE. See the GNU Lesser General Public License for more  ////
42
//// details.                                                     ////
43
////                                                              ////
44
//// You should have received a copy of the GNU Lesser General    ////
45
//// Public License along with this source; if not, download it   ////
46
//// from http://www.opencores.org/lgpl.shtml                     ////
47
////                                                              ////
48
//////////////////////////////////////////////////////////////////////
49
//
50
`include "timescale.v"
51
`include "usbhostslave_serialinterfaceengine_h.v"
52
 
53
module directControl (HCTxPortCntl, HCTxPortData, HCTxPortGnt, HCTxPortRdy, HCTxPortReq, HCTxPortWEn, clk, directControlEn, directControlLineState, rst);
54
input   HCTxPortGnt;
55
input   HCTxPortRdy;
56
input   clk;
57
input   directControlEn;
58
input   [1:0] directControlLineState;
59
input   rst;
60
output  [7:0] HCTxPortCntl;
61
output  [7:0] HCTxPortData;
62
output  HCTxPortReq;
63
output  HCTxPortWEn;
64
 
65
reg     [7:0] HCTxPortCntl, next_HCTxPortCntl;
66
reg     [7:0] HCTxPortData, next_HCTxPortData;
67
wire    HCTxPortGnt;
68
wire    HCTxPortRdy;
69
reg     HCTxPortReq, next_HCTxPortReq;
70
reg     HCTxPortWEn, next_HCTxPortWEn;
71
wire    clk;
72
wire    directControlEn;
73
wire    [1:0] directControlLineState;
74
wire    rst;
75
 
76
// BINARY ENCODED state machine: drctCntl
77
// State codes definitions:
78
`define START_DC 3'b000
79
`define CHK_DRCT_CNTL 3'b001
80
`define DRCT_CNTL_WAIT_GNT 3'b010
81
`define DRCT_CNTL_CHK_LOOP 3'b011
82
`define DRCT_CNTL_WAIT_RDY 3'b100
83
`define IDLE_FIN 3'b101
84
`define IDLE_WAIT_GNT 3'b110
85
`define IDLE_WAIT_RDY 3'b111
86
 
87
reg [2:0] CurrState_drctCntl;
88
reg [2:0] NextState_drctCntl;
89
 
90
// Diagram actions (continuous assignments allowed only: assign ...)
91
 
92
// diagram ACTION
93
 
94
//--------------------------------------------------------------------
95
// Machine: drctCntl
96
//--------------------------------------------------------------------
97
//----------------------------------
98
// Next State Logic (combinatorial)
99
//----------------------------------
100
always @ (directControlLineState or directControlEn or HCTxPortGnt or HCTxPortRdy or HCTxPortReq or HCTxPortWEn or HCTxPortData or HCTxPortCntl or CurrState_drctCntl)
101
begin : drctCntl_NextState
102
  NextState_drctCntl <= CurrState_drctCntl;
103
  // Set default values for outputs and signals
104
  next_HCTxPortReq <= HCTxPortReq;
105
  next_HCTxPortWEn <= HCTxPortWEn;
106
  next_HCTxPortData <= HCTxPortData;
107
  next_HCTxPortCntl <= HCTxPortCntl;
108
  case (CurrState_drctCntl)
109
    `START_DC:
110
      NextState_drctCntl <= `CHK_DRCT_CNTL;
111
    `CHK_DRCT_CNTL:
112
      if (directControlEn == 1'b1)
113
      begin
114
        NextState_drctCntl <= `DRCT_CNTL_WAIT_GNT;
115
        next_HCTxPortReq <= 1'b1;
116
      end
117
      else
118
      begin
119
        NextState_drctCntl <= `IDLE_WAIT_GNT;
120
        next_HCTxPortReq <= 1'b1;
121
      end
122
    `DRCT_CNTL_WAIT_GNT:
123
      if (HCTxPortGnt == 1'b1)
124
        NextState_drctCntl <= `DRCT_CNTL_WAIT_RDY;
125
    `DRCT_CNTL_CHK_LOOP:
126
    begin
127
      next_HCTxPortWEn <= 1'b0;
128
      if (directControlEn == 1'b0)
129
      begin
130
        NextState_drctCntl <= `CHK_DRCT_CNTL;
131
        next_HCTxPortReq <= 1'b0;
132
      end
133
      else
134
        NextState_drctCntl <= `DRCT_CNTL_WAIT_RDY;
135
    end
136
    `DRCT_CNTL_WAIT_RDY:
137
      if (HCTxPortRdy == 1'b1)
138
      begin
139
        NextState_drctCntl <= `DRCT_CNTL_CHK_LOOP;
140
        next_HCTxPortWEn <= 1'b1;
141
        next_HCTxPortData <= {6'b000000, directControlLineState};
142
        next_HCTxPortCntl <= `TX_DIRECT_CONTROL;
143
      end
144
    `IDLE_FIN:
145
    begin
146
      next_HCTxPortWEn <= 1'b0;
147
      next_HCTxPortReq <= 1'b0;
148
      NextState_drctCntl <= `CHK_DRCT_CNTL;
149
    end
150
    `IDLE_WAIT_GNT:
151
      if (HCTxPortGnt == 1'b1)
152
        NextState_drctCntl <= `IDLE_WAIT_RDY;
153
    `IDLE_WAIT_RDY:
154
      if (HCTxPortRdy == 1'b1)
155
      begin
156
        NextState_drctCntl <= `IDLE_FIN;
157
        next_HCTxPortWEn <= 1'b1;
158
        next_HCTxPortData <= 8'h00;
159
        next_HCTxPortCntl <= `TX_IDLE;
160
      end
161
  endcase
162
end
163
 
164
//----------------------------------
165
// Current State Logic (sequential)
166
//----------------------------------
167
always @ (posedge clk)
168
begin : drctCntl_CurrentState
169
  if (rst)
170
    CurrState_drctCntl <= `START_DC;
171
  else
172
    CurrState_drctCntl <= NextState_drctCntl;
173
end
174
 
175
//----------------------------------
176
// Registered outputs logic
177
//----------------------------------
178
always @ (posedge clk)
179
begin : drctCntl_RegOutput
180
  if (rst)
181
  begin
182
    HCTxPortCntl <= 8'h00;
183
    HCTxPortData <= 8'h00;
184
    HCTxPortWEn <= 1'b0;
185
    HCTxPortReq <= 1'b0;
186
  end
187
  else
188
  begin
189
    HCTxPortCntl <= next_HCTxPortCntl;
190
    HCTxPortData <= next_HCTxPortData;
191
    HCTxPortWEn <= next_HCTxPortWEn;
192
    HCTxPortReq <= next_HCTxPortReq;
193
  end
194
end
195
 
196
endmodule

powered by: WebSVN 2.1.0

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