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

Subversion Repositories openrisc

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

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

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

powered by: WebSVN 2.1.0

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