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

Subversion Repositories usbhostslave

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

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
// $Id: usbTxWireArbiter.v,v 1.2 2004-12-18 14:36:16 sfielding Exp $
46
//
47
// CVS Revision History
48
//
49
// $Log: not supported by cvs2svn $
50
//
51
`timescale 1ns / 1ps
52
`include "usbConstants_h.v"
53
`include "usbSerialInterfaceEngine_h.v"
54
 
55
 
56
 
57
module USBWireTxArbiter (clk, prcTxByteCtrl, prcTxByteData, prcTxByteGnt, prcTxByteReq, prcTxByteWEn, rst, SIETxCtrl, SIETxData, SIETxGnt, SIETxReq, SIETxWEn, TxBits, TxCtl, USBWireRdyIn, USBWireRdyOut, USBWireWEn);
58
input   clk;
59
input   prcTxByteCtrl;
60
input   [1:0]prcTxByteData;
61
input   prcTxByteReq;
62
input   prcTxByteWEn;
63
input   rst;
64
input   SIETxCtrl;
65
input   [1:0]SIETxData;
66
input   SIETxReq;
67
input   SIETxWEn;
68
input   USBWireRdyIn;
69
output  prcTxByteGnt;
70
output  SIETxGnt;
71
output  [1:0]TxBits;
72
output  TxCtl;
73
output  USBWireRdyOut;
74
output  USBWireWEn;
75
 
76
wire    clk;
77
wire    prcTxByteCtrl;
78
wire    [1:0]prcTxByteData;
79
reg     prcTxByteGnt, next_prcTxByteGnt;
80
wire    prcTxByteReq;
81
wire    prcTxByteWEn;
82
wire    rst;
83
wire    SIETxCtrl;
84
wire    [1:0]SIETxData;
85
reg     SIETxGnt, next_SIETxGnt;
86
wire    SIETxReq;
87
wire    SIETxWEn;
88
reg     [1:0]TxBits, next_TxBits;
89
reg     TxCtl, next_TxCtl;
90
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
SIETxCtrl or prcTxByteWEn or prcTxByteData or prcTxByteCtrl)
114
begin
115
if (muxSIENotPTXB  == 1'b1)
116
begin
117
USBWireWEn <= SIETxWEn;
118
TxBits <= SIETxData;
119
TxCtl <= SIETxCtrl;
120
end
121
else
122
begin
123
USBWireWEn <= prcTxByteWEn;
124
TxBits <= prcTxByteData;
125
TxCtl <= prcTxByteCtrl;
126
end
127
end
128
 
129
 
130
// Machine: txWireArb
131
 
132
// NextState logic (combinatorial)
133
always @ (prcTxByteReq or SIETxReq or prcTxByteGnt or SIETxGnt or muxSIENotPTXB or CurrState_txWireArb)
134
begin
135
  NextState_txWireArb <= CurrState_txWireArb;
136
  // Set default values for outputs and signals
137
  next_prcTxByteGnt <= prcTxByteGnt;
138
  next_SIETxGnt <= SIETxGnt;
139
  next_muxSIENotPTXB <= muxSIENotPTXB;
140
  case (CurrState_txWireArb)  // synopsys parallel_case full_case
141
    `START_TARB:
142
    begin
143
      NextState_txWireArb <= `TARB_WAIT_REQ;
144
    end
145
    `TARB_WAIT_REQ:
146
    begin
147
      if (prcTxByteReq == 1'b1)
148
      begin
149
        NextState_txWireArb <= `PTXB_ACT;
150
        next_prcTxByteGnt <= 1'b1;
151
        next_muxSIENotPTXB <= 1'b0;
152
      end
153
      else if (SIETxReq == 1'b1)
154
      begin
155
        NextState_txWireArb <= `SIE_TX_ACT;
156
        next_SIETxGnt <= 1'b1;
157
        next_muxSIENotPTXB <= 1'b1;
158
      end
159
    end
160
    `PTXB_ACT:
161
    begin
162
      if (prcTxByteReq == 1'b0)
163
      begin
164
        NextState_txWireArb <= `TARB_WAIT_REQ;
165
        next_prcTxByteGnt <= 1'b0;
166
      end
167
    end
168
    `SIE_TX_ACT:
169
    begin
170
      if (SIETxReq == 1'b0)
171
      begin
172
        NextState_txWireArb <= `TARB_WAIT_REQ;
173
        next_SIETxGnt <= 1'b0;
174
      end
175
    end
176
  endcase
177
end
178
 
179
// Current State Logic (sequential)
180
always @ (posedge clk)
181
begin
182
  if (rst)
183
    CurrState_txWireArb <= `START_TARB;
184
  else
185
    CurrState_txWireArb <= NextState_txWireArb;
186
end
187
 
188
// Registered outputs logic
189
always @ (posedge clk)
190
begin
191
  if (rst)
192
  begin
193
    prcTxByteGnt <= 1'b0;
194
    SIETxGnt <= 1'b0;
195
    muxSIENotPTXB <= 1'b0;
196
  end
197
  else
198
  begin
199
    prcTxByteGnt <= next_prcTxByteGnt;
200
    SIETxGnt <= next_SIETxGnt;
201
    muxSIENotPTXB <= next_muxSIENotPTXB;
202
  end
203
end
204
 
205 2 sfielding
endmodule

powered by: WebSVN 2.1.0

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