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

Subversion Repositories usbhostslave

[/] [usbhostslave/] [tags/] [rel_01_01/] [RTL/] [serialInterfaceEngine/] [usbTxWireArbiter.v] - Blame information for rev 21

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

Line No. Rev Author Line
1 5 sfielding
 
2
//////////////////////////////////////////////////////////////////////
3
////                                                              ////
4
//// usbTxWireArbiter
5
////                                                              ////
6
//// This file is part of the usbhostslave opencores effort.
7
//// http://www.opencores.org/cores/usbhostslave/                 ////
8
////                                                              ////
9
//// Module Description:                                          ////
10
//// 
11
////                                                              ////
12
//// To Do:                                                       ////
13
//// 
14
////                                                              ////
15
//// Author(s):                                                   ////
16
//// - Steve Fielding, sfielding@base2designs.com                 ////
17
////                                                              ////
18
//////////////////////////////////////////////////////////////////////
19
////                                                              ////
20
//// Copyright (C) 2004 Steve Fielding and OPENCORES.ORG          ////
21
////                                                              ////
22
//// This source file may be used and distributed without         ////
23
//// restriction provided that this copyright statement is not    ////
24
//// removed from the file and that any derivative work contains  ////
25
//// the original copyright notice and the associated disclaimer. ////
26
////                                                              ////
27
//// This source file is free software; you can redistribute it   ////
28
//// and/or modify it under the terms of the GNU Lesser General   ////
29
//// Public License as published by the Free Software Foundation; ////
30
//// either version 2.1 of the License, or (at your option) any   ////
31
//// later version.                                               ////
32
////                                                              ////
33
//// This source is distributed in the hope that it will be       ////
34
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
35
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
36
//// PURPOSE. See the GNU Lesser General Public License for more  ////
37
//// details.                                                     ////
38
////                                                              ////
39
//// You should have received a copy of the GNU Lesser General    ////
40
//// Public License along with this source; if not, download it   ////
41
//// from http://www.opencores.org/lgpl.shtml                     ////
42
////                                                              ////
43
//////////////////////////////////////////////////////////////////////
44
//
45
`timescale 1ns / 1ps
46
`include "usbConstants_h.v"
47
`include "usbSerialInterfaceEngine_h.v"
48
 
49
 
50
 
51 14 sfielding
module USBTxWireArbiter (clk, prcTxByteCtrl, prcTxByteData, prcTxByteFSRate, prcTxByteGnt, prcTxByteReq, prcTxByteWEn, rst, SIETxCtrl, SIETxData, SIETxFSRate, SIETxGnt, SIETxReq, SIETxWEn, TxBits, TxCtl, TxFSRate, USBWireRdyIn, USBWireRdyOut, USBWireWEn);
52 5 sfielding
input   clk;
53
input   prcTxByteCtrl;
54
input   [1:0]prcTxByteData;
55 14 sfielding
input   prcTxByteFSRate;
56 5 sfielding
input   prcTxByteReq;
57
input   prcTxByteWEn;
58
input   rst;
59
input   SIETxCtrl;
60
input   [1:0]SIETxData;
61 14 sfielding
input   SIETxFSRate;
62 5 sfielding
input   SIETxReq;
63
input   SIETxWEn;
64
input   USBWireRdyIn;
65
output  prcTxByteGnt;
66
output  SIETxGnt;
67
output  [1:0]TxBits;
68
output  TxCtl;
69 14 sfielding
output  TxFSRate;
70 5 sfielding
output  USBWireRdyOut;
71
output  USBWireWEn;
72
 
73
wire    clk;
74
wire    prcTxByteCtrl;
75
wire    [1:0]prcTxByteData;
76 14 sfielding
wire    prcTxByteFSRate;
77 5 sfielding
reg     prcTxByteGnt, next_prcTxByteGnt;
78
wire    prcTxByteReq;
79
wire    prcTxByteWEn;
80
wire    rst;
81
wire    SIETxCtrl;
82
wire    [1:0]SIETxData;
83 14 sfielding
wire    SIETxFSRate;
84 5 sfielding
reg     SIETxGnt, next_SIETxGnt;
85
wire    SIETxReq;
86
wire    SIETxWEn;
87
reg     [1:0]TxBits, next_TxBits;
88
reg     TxCtl, next_TxCtl;
89 14 sfielding
reg     TxFSRate, next_TxFSRate;
90 5 sfielding
wire    USBWireRdyIn;
91
reg     USBWireRdyOut, next_USBWireRdyOut;
92
reg     USBWireWEn, next_USBWireWEn;
93
 
94
// diagram signals declarations
95
reg muxSIENotPTXB, next_muxSIENotPTXB;
96
 
97
// BINARY ENCODED state machine: txWireArb
98
// State codes definitions:
99
`define START_TARB 2'b00
100
`define TARB_WAIT_REQ 2'b01
101
`define PTXB_ACT 2'b10
102
`define SIE_TX_ACT 2'b11
103
 
104
reg [1:0]CurrState_txWireArb, NextState_txWireArb;
105
 
106
// Diagram actions (continuous assignments allowed only: assign ...)
107
// processTxByte/SIETransmitter mux
108
always @(USBWireRdyIn)
109
begin
110
USBWireRdyOut <= USBWireRdyIn;
111
end
112
always @(muxSIENotPTXB or SIETxWEn or SIETxData or
113 14 sfielding
SIETxCtrl or prcTxByteWEn or prcTxByteData or prcTxByteCtrl or
114
SIETxFSRate or prcTxByteFSRate)
115 5 sfielding
begin
116
if (muxSIENotPTXB  == 1'b1)
117
begin
118
USBWireWEn <= SIETxWEn;
119
TxBits <= SIETxData;
120
TxCtl <= SIETxCtrl;
121 14 sfielding
TxFSRate <= SIETxFSRate;
122 5 sfielding
end
123
else
124
begin
125
USBWireWEn <= prcTxByteWEn;
126
TxBits <= prcTxByteData;
127
TxCtl <= prcTxByteCtrl;
128 14 sfielding
TxFSRate <= prcTxByteFSRate;
129 5 sfielding
end
130
end
131
 
132
 
133
// Machine: txWireArb
134
 
135
// NextState logic (combinatorial)
136
always @ (prcTxByteReq or SIETxReq or prcTxByteGnt or SIETxGnt or muxSIENotPTXB or CurrState_txWireArb)
137
begin
138
  NextState_txWireArb <= CurrState_txWireArb;
139
  // Set default values for outputs and signals
140
  next_prcTxByteGnt <= prcTxByteGnt;
141
  next_SIETxGnt <= SIETxGnt;
142
  next_muxSIENotPTXB <= muxSIENotPTXB;
143
  case (CurrState_txWireArb)  // synopsys parallel_case full_case
144
    `START_TARB:
145
    begin
146
      NextState_txWireArb <= `TARB_WAIT_REQ;
147
    end
148
    `TARB_WAIT_REQ:
149
    begin
150
      if (prcTxByteReq == 1'b1)
151
      begin
152
        NextState_txWireArb <= `PTXB_ACT;
153
        next_prcTxByteGnt <= 1'b1;
154
        next_muxSIENotPTXB <= 1'b0;
155
      end
156
      else if (SIETxReq == 1'b1)
157
      begin
158
        NextState_txWireArb <= `SIE_TX_ACT;
159
        next_SIETxGnt <= 1'b1;
160
        next_muxSIENotPTXB <= 1'b1;
161
      end
162
    end
163
    `PTXB_ACT:
164
    begin
165
      if (prcTxByteReq == 1'b0)
166
      begin
167
        NextState_txWireArb <= `TARB_WAIT_REQ;
168
        next_prcTxByteGnt <= 1'b0;
169
      end
170
    end
171
    `SIE_TX_ACT:
172
    begin
173
      if (SIETxReq == 1'b0)
174
      begin
175
        NextState_txWireArb <= `TARB_WAIT_REQ;
176
        next_SIETxGnt <= 1'b0;
177
      end
178
    end
179
  endcase
180
end
181
 
182
// Current State Logic (sequential)
183
always @ (posedge clk)
184
begin
185
  if (rst)
186
    CurrState_txWireArb <= `START_TARB;
187
  else
188
    CurrState_txWireArb <= NextState_txWireArb;
189
end
190
 
191
// Registered outputs logic
192
always @ (posedge clk)
193
begin
194
  if (rst)
195
  begin
196
    prcTxByteGnt <= 1'b0;
197
    SIETxGnt <= 1'b0;
198
    muxSIENotPTXB <= 1'b0;
199
  end
200
  else
201
  begin
202
    prcTxByteGnt <= next_prcTxByteGnt;
203
    SIETxGnt <= next_SIETxGnt;
204
    muxSIENotPTXB <= next_muxSIENotPTXB;
205
  end
206
end
207
 
208 2 sfielding
endmodule

powered by: WebSVN 2.1.0

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