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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [bench/] [verilog/] [usbhostslave/] [sendPacketArbiter_simlib.v] - Blame information for rev 449

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

Line No. Rev Author Line
1 408 julius
 
2
// File        : ../RTL/hostController/sendpacketarbiter.v
3
// Generated   : 11/10/06 05:37:20
4
// From        : ../RTL/hostController/sendpacketarbiter.asf
5
// By          : FSM2VHDL ver. 5.0.0.9
6
 
7
//////////////////////////////////////////////////////////////////////
8
////                                                              ////
9
//// sendpacketarbiter
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
`include "usbConstants_h.v"
52
 
53
module sendPacketArbiter_simlib (HCTxGnt, HCTxReq, HC_PID, HC_SP_WEn, SOFTxGnt, SOFTxReq, SOF_SP_WEn, clk, rst, sendPacketPID, sendPacketWEnable);
54
input   HCTxReq;
55
input   [3:0] HC_PID;
56
input   HC_SP_WEn;
57
input   SOFTxReq;
58
input   SOF_SP_WEn;
59
input   clk;
60
input   rst;
61
output  HCTxGnt;
62
output  SOFTxGnt;
63
output  [3:0] sendPacketPID;
64
output  sendPacketWEnable;
65
 
66
reg     HCTxGnt, next_HCTxGnt;
67
wire    HCTxReq;
68
wire    [3:0] HC_PID;
69
wire    HC_SP_WEn;
70
reg     SOFTxGnt, next_SOFTxGnt;
71
wire    SOFTxReq;
72
wire    SOF_SP_WEn;
73
wire    clk;
74
wire    rst;
75
reg     [3:0] sendPacketPID, next_sendPacketPID;
76
reg     sendPacketWEnable, next_sendPacketWEnable;
77
 
78
// diagram signals declarations
79
reg  muxSOFNotHC, next_muxSOFNotHC;
80
 
81
// BINARY ENCODED state machine: sendPktArb
82
// State codes definitions:
83
`define HC_ACT 2'b00
84
`define SOF_ACT 2'b01
85
`define SARB_WAIT_REQ 2'b10
86
`define START_SARB 2'b11
87
 
88
reg [1:0] CurrState_sendPktArb;
89
reg [1:0] NextState_sendPktArb;
90
 
91
// Diagram actions (continuous assignments allowed only: assign ...)
92
 
93
// hostController/SOFTransmit mux
94
always @(muxSOFNotHC or SOF_SP_WEn or HC_SP_WEn or HC_PID)
95
begin
96
    if (muxSOFNotHC  == 1'b1)
97
    begin
98
        sendPacketWEnable <= SOF_SP_WEn;
99
        sendPacketPID <= `SOF;
100
    end
101
    else
102
    begin
103
        sendPacketWEnable <= HC_SP_WEn;
104
        sendPacketPID <= HC_PID;
105
    end
106
end
107
 
108
//--------------------------------------------------------------------
109
// Machine: sendPktArb
110
//--------------------------------------------------------------------
111
//----------------------------------
112
// Next State Logic (combinatorial)
113
//----------------------------------
114
always @ (HCTxReq or SOFTxReq or HCTxGnt or SOFTxGnt or muxSOFNotHC or CurrState_sendPktArb)
115
begin : sendPktArb_NextState
116
  NextState_sendPktArb <= CurrState_sendPktArb;
117
  // Set default values for outputs and signals
118
  next_HCTxGnt <= HCTxGnt;
119
  next_SOFTxGnt <= SOFTxGnt;
120
  next_muxSOFNotHC <= muxSOFNotHC;
121
  case (CurrState_sendPktArb)
122
    `HC_ACT:
123
      if (HCTxReq == 1'b0)
124
      begin
125
        NextState_sendPktArb <= `SARB_WAIT_REQ;
126
        next_HCTxGnt <= 1'b0;
127
      end
128
    `SOF_ACT:
129
      if (SOFTxReq == 1'b0)
130
      begin
131
        NextState_sendPktArb <= `SARB_WAIT_REQ;
132
        next_SOFTxGnt <= 1'b0;
133
      end
134
    `SARB_WAIT_REQ:
135
      if (SOFTxReq == 1'b1)
136
      begin
137
        NextState_sendPktArb <= `SOF_ACT;
138
        next_SOFTxGnt <= 1'b1;
139
        next_muxSOFNotHC <= 1'b1;
140
      end
141
      else if (HCTxReq == 1'b1)
142
      begin
143
        NextState_sendPktArb <= `HC_ACT;
144
        next_HCTxGnt <= 1'b1;
145
        next_muxSOFNotHC <= 1'b0;
146
      end
147
    `START_SARB:
148
      NextState_sendPktArb <= `SARB_WAIT_REQ;
149
  endcase
150
end
151
 
152
//----------------------------------
153
// Current State Logic (sequential)
154
//----------------------------------
155
always @ (posedge clk)
156
begin : sendPktArb_CurrentState
157
  if (rst)
158
    CurrState_sendPktArb <= `START_SARB;
159
  else
160
    CurrState_sendPktArb <= NextState_sendPktArb;
161
end
162
 
163
//----------------------------------
164
// Registered outputs logic
165
//----------------------------------
166
always @ (posedge clk)
167
begin : sendPktArb_RegOutput
168
  if (rst)
169
  begin
170
    muxSOFNotHC <= 1'b0;
171
    SOFTxGnt <= 1'b0;
172
    HCTxGnt <= 1'b0;
173
  end
174
  else
175
  begin
176
    muxSOFNotHC <= next_muxSOFNotHC;
177
    SOFTxGnt <= next_SOFTxGnt;
178
    HCTxGnt <= next_HCTxGnt;
179
  end
180
end
181
 
182
endmodule

powered by: WebSVN 2.1.0

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