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

Subversion Repositories usbhostslave

[/] [usbhostslave/] [tags/] [rel_00_06_alpha/] [RTL/] [slaveController/] [sctxportarbiter.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
//// SCTxPortArbiter
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: sctxportarbiter.v,v 1.2 2004-12-18 14:36:20 sfielding Exp $
46
//
47
// CVS Revision History
48
//
49
// $Log: not supported by cvs2svn $
50
//
51
`timescale 1ns / 1ps
52
 
53
module SCTxPortArbiter (clk, directCntlCntl, directCntlData, directCntlGnt, directCntlReq, directCntlWEn, rst, SCTxPortCntl, SCTxPortData, SCTxPortRdyIn, SCTxPortRdyOut, SCTxPortWEnable, sendPacketCntl, sendPacketData, sendPacketGnt, sendPacketReq, sendPacketWEn);
54
input   clk;
55
input   [7:0]directCntlCntl;
56
input   [7:0]directCntlData;
57
input   directCntlReq;
58
input   directCntlWEn;
59
input   rst;
60
input   SCTxPortRdyIn;
61
input   [7:0]sendPacketCntl;
62
input   [7:0]sendPacketData;
63
input   sendPacketReq;
64
input   sendPacketWEn;
65
output  directCntlGnt;
66
output  [7:0]SCTxPortCntl;
67
output  [7:0]SCTxPortData;
68
output  SCTxPortRdyOut;
69
output  SCTxPortWEnable;
70
output  sendPacketGnt;
71
 
72
wire    clk;
73
wire    [7:0]directCntlCntl;
74
wire    [7:0]directCntlData;
75
reg     directCntlGnt, next_directCntlGnt;
76
wire    directCntlReq;
77
wire    directCntlWEn;
78
wire    rst;
79
reg     [7:0]SCTxPortCntl, next_SCTxPortCntl;
80
reg     [7:0]SCTxPortData, next_SCTxPortData;
81
wire    SCTxPortRdyIn;
82
reg     SCTxPortRdyOut, next_SCTxPortRdyOut;
83
reg     SCTxPortWEnable, next_SCTxPortWEnable;
84
wire    [7:0]sendPacketCntl;
85
wire    [7:0]sendPacketData;
86
reg     sendPacketGnt, next_sendPacketGnt;
87
wire    sendPacketReq;
88
wire    sendPacketWEn;
89
 
90
// diagram signals declarations
91
reg muxDCEn, next_muxDCEn;
92
 
93
// BINARY ENCODED state machine: SCTxArb
94
// State codes definitions:
95
`define SARB1_WAIT_REQ 2'b00
96
`define SARB_SEND_PACKET 2'b01
97
`define SARB_DC 2'b10
98
`define START_SARB 2'b11
99
 
100
reg [1:0]CurrState_SCTxArb, NextState_SCTxArb;
101
 
102
// Diagram actions (continuous assignments allowed only: assign ...)
103
// SOFController/directContol/sendPacket mux
104
always @(SCTxPortRdyIn)
105
begin
106
SCTxPortRdyOut <= SCTxPortRdyIn;
107
end
108
always @(muxDCEn or
109
directCntlWEn or directCntlData or directCntlCntl or
110
directCntlWEn or directCntlData or directCntlCntl or
111
sendPacketWEn or sendPacketData or sendPacketCntl)
112
begin
113
if (muxDCEn == 1'b1)
114
begin
115
SCTxPortWEnable <= directCntlWEn;
116
SCTxPortData <= directCntlData;
117
SCTxPortCntl <= directCntlCntl;
118
end
119
else
120
begin
121
SCTxPortWEnable <= sendPacketWEn;
122
SCTxPortData <= sendPacketData;
123
SCTxPortCntl <= sendPacketCntl;
124
end
125
end
126
 
127
 
128
// Machine: SCTxArb
129
 
130
// NextState logic (combinatorial)
131
always @ (sendPacketReq or directCntlReq or sendPacketGnt or muxDCEn or directCntlGnt or CurrState_SCTxArb)
132
begin
133
  NextState_SCTxArb <= CurrState_SCTxArb;
134
  // Set default values for outputs and signals
135
  next_sendPacketGnt <= sendPacketGnt;
136
  next_muxDCEn <= muxDCEn;
137
  next_directCntlGnt <= directCntlGnt;
138
  case (CurrState_SCTxArb)  // synopsys parallel_case full_case
139
    `SARB1_WAIT_REQ:
140
    begin
141
      if (sendPacketReq == 1'b1)
142
      begin
143
        NextState_SCTxArb <= `SARB_SEND_PACKET;
144
        next_sendPacketGnt <= 1'b1;
145
        next_muxDCEn <= 1'b0;
146
      end
147
      else if (directCntlReq == 1'b1)
148
      begin
149
        NextState_SCTxArb <= `SARB_DC;
150
        next_directCntlGnt <= 1'b1;
151
        next_muxDCEn <= 1'b1;
152
      end
153
    end
154
    `SARB_SEND_PACKET:
155
    begin
156
      if (sendPacketReq == 1'b0)
157
      begin
158
        NextState_SCTxArb <= `SARB1_WAIT_REQ;
159
        next_sendPacketGnt <= 1'b0;
160
      end
161
    end
162
    `SARB_DC:
163
    begin
164
      if (directCntlReq == 1'b0)
165
      begin
166
        NextState_SCTxArb <= `SARB1_WAIT_REQ;
167
        next_directCntlGnt <= 1'b0;
168
      end
169
    end
170
    `START_SARB:
171
    begin
172
      NextState_SCTxArb <= `SARB1_WAIT_REQ;
173
    end
174
  endcase
175
end
176
 
177
// Current State Logic (sequential)
178
always @ (posedge clk)
179
begin
180
  if (rst)
181
    CurrState_SCTxArb <= `START_SARB;
182
  else
183
    CurrState_SCTxArb <= NextState_SCTxArb;
184
end
185
 
186
// Registered outputs logic
187
always @ (posedge clk)
188
begin
189
  if (rst)
190
  begin
191
    sendPacketGnt <= 1'b0;
192
    directCntlGnt <= 1'b0;
193
    muxDCEn <= 1'b0;
194
  end
195
  else
196
  begin
197
    sendPacketGnt <= next_sendPacketGnt;
198
    directCntlGnt <= next_directCntlGnt;
199
    muxDCEn <= next_muxDCEn;
200
  end
201
end
202
 
203 2 sfielding
endmodule

powered by: WebSVN 2.1.0

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