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

Subversion Repositories usbhostslave

[/] [usbhostslave/] [trunk/] [RTL/] [serialInterfaceEngine/] [usbTxWireArbiter.v] - Blame information for rev 34

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

Line No. Rev Author Line
1 5 sfielding
 
2 22 sfielding
// File        : ../RTL/serialInterfaceEngine/usbTxWireArbiter.v
3 34 sfielding
// Generated   : 10/15/06 20:31:23
4 22 sfielding
// From        : ../RTL/serialInterfaceEngine/usbTxWireArbiter.asf
5
// By          : FSM2VHDL ver. 5.0.0.9
6
 
7 5 sfielding
//////////////////////////////////////////////////////////////////////
8
////                                                              ////
9
//// usbTxWireArbiter
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 22 sfielding
`include "timescale.v"
51 5 sfielding
`include "usbConstants_h.v"
52
`include "usbSerialInterfaceEngine_h.v"
53
 
54
 
55
 
56 22 sfielding
module USBTxWireArbiter (SIETxCtrl, SIETxData, SIETxFSRate, SIETxGnt, SIETxReq, SIETxWEn, TxBits, TxCtl, TxFSRate, USBWireRdyIn, USBWireRdyOut, USBWireWEn, clk, prcTxByteCtrl, prcTxByteData, prcTxByteFSRate, prcTxByteGnt, prcTxByteReq, prcTxByteWEn, rst);
57
input   SIETxCtrl;
58
input   [1:0] SIETxData;
59
input   SIETxFSRate;
60
input   SIETxReq;
61
input   SIETxWEn;
62
input   USBWireRdyIn;
63 5 sfielding
input   clk;
64
input   prcTxByteCtrl;
65 22 sfielding
input   [1:0] prcTxByteData;
66 14 sfielding
input   prcTxByteFSRate;
67 5 sfielding
input   prcTxByteReq;
68
input   prcTxByteWEn;
69
input   rst;
70
output  SIETxGnt;
71 22 sfielding
output  [1:0] TxBits;
72 5 sfielding
output  TxCtl;
73 14 sfielding
output  TxFSRate;
74 5 sfielding
output  USBWireRdyOut;
75
output  USBWireWEn;
76 22 sfielding
output  prcTxByteGnt;
77 5 sfielding
 
78
wire    SIETxCtrl;
79 22 sfielding
wire    [1:0] SIETxData;
80 14 sfielding
wire    SIETxFSRate;
81 5 sfielding
reg     SIETxGnt, next_SIETxGnt;
82
wire    SIETxReq;
83
wire    SIETxWEn;
84 22 sfielding
reg     [1:0] TxBits, next_TxBits;
85 5 sfielding
reg     TxCtl, next_TxCtl;
86 14 sfielding
reg     TxFSRate, next_TxFSRate;
87 5 sfielding
wire    USBWireRdyIn;
88
reg     USBWireRdyOut, next_USBWireRdyOut;
89
reg     USBWireWEn, next_USBWireWEn;
90 22 sfielding
wire    clk;
91
wire    prcTxByteCtrl;
92
wire    [1:0] prcTxByteData;
93
wire    prcTxByteFSRate;
94
reg     prcTxByteGnt, next_prcTxByteGnt;
95
wire    prcTxByteReq;
96
wire    prcTxByteWEn;
97
wire    rst;
98 5 sfielding
 
99
// diagram signals declarations
100 22 sfielding
reg  muxSIENotPTXB, next_muxSIENotPTXB;
101 5 sfielding
 
102
// BINARY ENCODED state machine: txWireArb
103
// State codes definitions:
104
`define START_TARB 2'b00
105
`define TARB_WAIT_REQ 2'b01
106
`define PTXB_ACT 2'b10
107
`define SIE_TX_ACT 2'b11
108
 
109 22 sfielding
reg [1:0] CurrState_txWireArb;
110
reg [1:0] NextState_txWireArb;
111 5 sfielding
 
112
// Diagram actions (continuous assignments allowed only: assign ...)
113 22 sfielding
 
114 5 sfielding
// processTxByte/SIETransmitter mux
115
always @(USBWireRdyIn)
116
begin
117 22 sfielding
    USBWireRdyOut <= USBWireRdyIn;
118 5 sfielding
end
119
always @(muxSIENotPTXB or SIETxWEn or SIETxData or
120 14 sfielding
SIETxCtrl or prcTxByteWEn or prcTxByteData or prcTxByteCtrl or
121
SIETxFSRate or prcTxByteFSRate)
122 5 sfielding
begin
123 22 sfielding
    if (muxSIENotPTXB  == 1'b1)
124 5 sfielding
    begin
125 22 sfielding
        USBWireWEn <= SIETxWEn;
126
        TxBits <= SIETxData;
127
        TxCtl <= SIETxCtrl;
128
        TxFSRate <= SIETxFSRate;
129 5 sfielding
    end
130 22 sfielding
    else
131 5 sfielding
    begin
132 22 sfielding
        USBWireWEn <= prcTxByteWEn;
133
        TxBits <= prcTxByteData;
134
        TxCtl <= prcTxByteCtrl;
135
        TxFSRate <= prcTxByteFSRate;
136 5 sfielding
    end
137
end
138
 
139 22 sfielding
//--------------------------------------------------------------------
140
// Machine: txWireArb
141
//--------------------------------------------------------------------
142
//----------------------------------
143
// Next State Logic (combinatorial)
144
//----------------------------------
145
always @ (prcTxByteReq or SIETxReq or prcTxByteGnt or muxSIENotPTXB or SIETxGnt or CurrState_txWireArb)
146
begin : txWireArb_NextState
147 34 sfielding
  NextState_txWireArb <= CurrState_txWireArb;
148
  // Set default values for outputs and signals
149
  next_prcTxByteGnt <= prcTxByteGnt;
150
  next_muxSIENotPTXB <= muxSIENotPTXB;
151
  next_SIETxGnt <= SIETxGnt;
152
  case (CurrState_txWireArb)
153
    `START_TARB:
154
      NextState_txWireArb <= `TARB_WAIT_REQ;
155
    `TARB_WAIT_REQ:
156
      if (prcTxByteReq == 1'b1)
157
      begin
158
        NextState_txWireArb <= `PTXB_ACT;
159
        next_prcTxByteGnt <= 1'b1;
160
        next_muxSIENotPTXB <= 1'b0;
161
      end
162
      else if (SIETxReq == 1'b1)
163
      begin
164
        NextState_txWireArb <= `SIE_TX_ACT;
165
        next_SIETxGnt <= 1'b1;
166
        next_muxSIENotPTXB <= 1'b1;
167
      end
168
    `PTXB_ACT:
169
      if (prcTxByteReq == 1'b0)
170
      begin
171
        NextState_txWireArb <= `TARB_WAIT_REQ;
172
        next_prcTxByteGnt <= 1'b0;
173
      end
174
    `SIE_TX_ACT:
175
      if (SIETxReq == 1'b0)
176
      begin
177
        NextState_txWireArb <= `TARB_WAIT_REQ;
178
        next_SIETxGnt <= 1'b0;
179
      end
180
  endcase
181 22 sfielding
end
182
 
183
//----------------------------------
184 5 sfielding
// Current State Logic (sequential)
185 22 sfielding
//----------------------------------
186 5 sfielding
always @ (posedge clk)
187 22 sfielding
begin : txWireArb_CurrentState
188 34 sfielding
  if (rst)
189
    CurrState_txWireArb <= `START_TARB;
190
  else
191
    CurrState_txWireArb <= NextState_txWireArb;
192 5 sfielding
end
193
 
194 22 sfielding
//----------------------------------
195 5 sfielding
// Registered outputs logic
196 22 sfielding
//----------------------------------
197 5 sfielding
always @ (posedge clk)
198 22 sfielding
begin : txWireArb_RegOutput
199 34 sfielding
  if (rst)
200
  begin
201
    muxSIENotPTXB <= 1'b0;
202
    prcTxByteGnt <= 1'b0;
203
    SIETxGnt <= 1'b0;
204
  end
205
  else
206
  begin
207
    muxSIENotPTXB <= next_muxSIENotPTXB;
208
    prcTxByteGnt <= next_prcTxByteGnt;
209
    SIETxGnt <= next_SIETxGnt;
210
  end
211 5 sfielding
end
212
 
213 2 sfielding
endmodule

powered by: WebSVN 2.1.0

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