Line 1... |
Line 1... |
|
|
|
// File : ../RTL/hostController/hctxportarbiter.v
|
|
// Generated : 10/06/06 19:35:28
|
|
// From : ../RTL/hostController/hctxportarbiter.asf
|
|
// By : FSM2VHDL ver. 5.0.0.9
|
|
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// hctxPortArbiter
|
//// hctxPortArbiter
|
//// ////
|
//// ////
|
//// This file is part of the usbhostslave opencores effort.
|
//// This file is part of the usbhostslave opencores effort.
|
Line 40... |
Line 45... |
//// Public License along with this source; if not, download it ////
|
//// Public License along with this source; if not, download it ////
|
//// from http://www.opencores.org/lgpl.shtml ////
|
//// from http://www.opencores.org/lgpl.shtml ////
|
//// ////
|
//// ////
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//
|
//
|
`timescale 1ns / 1ps
|
`include "timescale.v"
|
|
|
module HCTxPortArbiter (clk, directCntlCntl, directCntlData, directCntlGnt, directCntlReq, directCntlWEn, HCTxPortCntl, HCTxPortData, HCTxPortWEnable, rst, sendPacketCntl, sendPacketData, sendPacketGnt, sendPacketReq, sendPacketWEn, SOFCntlCntl, SOFCntlData, SOFCntlGnt, SOFCntlReq, SOFCntlWEn);
|
module HCTxPortArbiter (HCTxPortCntl, HCTxPortData, HCTxPortWEnable, SOFCntlCntl, SOFCntlData, SOFCntlGnt, SOFCntlReq, SOFCntlWEn, clk, directCntlCntl, directCntlData, directCntlGnt, directCntlReq, directCntlWEn, rst, sendPacketCntl, sendPacketData, sendPacketGnt, sendPacketReq, sendPacketWEn);
|
|
input [7:0] SOFCntlCntl;
|
|
input [7:0] SOFCntlData;
|
|
input SOFCntlReq;
|
|
input SOFCntlWEn;
|
input clk;
|
input clk;
|
input [7:0]directCntlCntl;
|
input [7:0]directCntlCntl;
|
input [7:0]directCntlData;
|
input [7:0]directCntlData;
|
input directCntlReq;
|
input directCntlReq;
|
input directCntlWEn;
|
input directCntlWEn;
|
input rst;
|
input rst;
|
input [7:0]sendPacketCntl;
|
input [7:0]sendPacketCntl;
|
input [7:0]sendPacketData;
|
input [7:0]sendPacketData;
|
input sendPacketReq;
|
input sendPacketReq;
|
input sendPacketWEn;
|
input sendPacketWEn;
|
input [7:0]SOFCntlCntl;
|
|
input [7:0]SOFCntlData;
|
|
input SOFCntlReq;
|
|
input SOFCntlWEn;
|
|
output directCntlGnt;
|
|
output [7:0]HCTxPortCntl;
|
output [7:0]HCTxPortCntl;
|
output [7:0]HCTxPortData;
|
output [7:0]HCTxPortData;
|
output HCTxPortWEnable;
|
output HCTxPortWEnable;
|
output sendPacketGnt;
|
|
output SOFCntlGnt;
|
output SOFCntlGnt;
|
|
output directCntlGnt;
|
|
output sendPacketGnt;
|
|
|
|
reg [7:0] HCTxPortCntl, next_HCTxPortCntl;
|
|
reg [7:0] HCTxPortData, next_HCTxPortData;
|
|
reg HCTxPortWEnable, next_HCTxPortWEnable;
|
|
wire [7:0] SOFCntlCntl;
|
|
wire [7:0] SOFCntlData;
|
|
reg SOFCntlGnt, next_SOFCntlGnt;
|
|
wire SOFCntlReq;
|
|
wire SOFCntlWEn;
|
wire clk;
|
wire clk;
|
wire [7:0]directCntlCntl;
|
wire [7:0]directCntlCntl;
|
wire [7:0]directCntlData;
|
wire [7:0]directCntlData;
|
reg directCntlGnt, next_directCntlGnt;
|
reg directCntlGnt, next_directCntlGnt;
|
wire directCntlReq;
|
wire directCntlReq;
|
wire directCntlWEn;
|
wire directCntlWEn;
|
reg [7:0]HCTxPortCntl, next_HCTxPortCntl;
|
|
reg [7:0]HCTxPortData, next_HCTxPortData;
|
|
reg HCTxPortWEnable, next_HCTxPortWEnable;
|
|
wire rst;
|
wire rst;
|
wire [7:0]sendPacketCntl;
|
wire [7:0]sendPacketCntl;
|
wire [7:0]sendPacketData;
|
wire [7:0]sendPacketData;
|
reg sendPacketGnt, next_sendPacketGnt;
|
reg sendPacketGnt, next_sendPacketGnt;
|
wire sendPacketReq;
|
wire sendPacketReq;
|
wire sendPacketWEn;
|
wire sendPacketWEn;
|
wire [7:0]SOFCntlCntl;
|
|
wire [7:0]SOFCntlData;
|
|
reg SOFCntlGnt, next_SOFCntlGnt;
|
|
wire SOFCntlReq;
|
|
wire SOFCntlWEn;
|
|
|
|
|
|
// Constants
|
// Constants
|
`define DIRECT_CTRL_MUX 2'b10
|
`define DIRECT_CTRL_MUX 2'b10
|
`define SEND_PACKET_MUX 2'b00
|
`define SEND_PACKET_MUX 2'b00
|
Line 101... |
Line 106... |
`define WAIT_REQ 3'b001
|
`define WAIT_REQ 3'b001
|
`define SEND_SOF 3'b010
|
`define SEND_SOF 3'b010
|
`define SEND_PACKET 3'b011
|
`define SEND_PACKET 3'b011
|
`define DIRECT_CONTROL 3'b100
|
`define DIRECT_CONTROL 3'b100
|
|
|
reg [2:0]CurrState_HCTxArb, NextState_HCTxArb;
|
reg [2:0] CurrState_HCTxArb;
|
|
reg [2:0] NextState_HCTxArb;
|
|
|
// Diagram actions (continuous assignments allowed only: assign ...)
|
// Diagram actions (continuous assignments allowed only: assign ...)
|
|
|
// SOFController/directContol/sendPacket mux
|
// SOFController/directContol/sendPacket mux
|
always @(muxCntl or SOFCntlWEn or SOFCntlData or SOFCntlCntl or
|
always @(muxCntl or SOFCntlWEn or SOFCntlData or SOFCntlCntl or
|
directCntlWEn or directCntlData or directCntlCntl or
|
directCntlWEn or directCntlData or directCntlCntl or
|
directCntlWEn or directCntlData or directCntlCntl or
|
directCntlWEn or directCntlData or directCntlCntl or
|
sendPacketWEn or sendPacketData or sendPacketCntl)
|
sendPacketWEn or sendPacketData or sendPacketCntl)
|
Line 138... |
Line 145... |
HCTxPortCntl <= 8'h00;
|
HCTxPortCntl <= 8'h00;
|
end
|
end
|
endcase
|
endcase
|
end
|
end
|
|
|
|
//--------------------------------------------------------------------
|
// Machine: HCTxArb
|
// Machine: HCTxArb
|
|
//--------------------------------------------------------------------
|
// NextState logic (combinatorial)
|
//----------------------------------
|
always @ (SOFCntlReq or sendPacketReq or directCntlReq or SOFCntlGnt or sendPacketGnt or directCntlGnt or muxCntl or CurrState_HCTxArb)
|
// Next State Logic (combinatorial)
|
begin
|
//----------------------------------
|
|
always @ (SOFCntlReq or sendPacketReq or directCntlReq or SOFCntlGnt or muxCntl or sendPacketGnt or directCntlGnt or CurrState_HCTxArb)
|
|
begin : HCTxArb_NextState
|
NextState_HCTxArb <= CurrState_HCTxArb;
|
NextState_HCTxArb <= CurrState_HCTxArb;
|
// Set default values for outputs and signals
|
// Set default values for outputs and signals
|
next_SOFCntlGnt <= SOFCntlGnt;
|
next_SOFCntlGnt <= SOFCntlGnt;
|
|
next_muxCntl <= muxCntl;
|
next_sendPacketGnt <= sendPacketGnt;
|
next_sendPacketGnt <= sendPacketGnt;
|
next_directCntlGnt <= directCntlGnt;
|
next_directCntlGnt <= directCntlGnt;
|
next_muxCntl <= muxCntl;
|
case (CurrState_HCTxArb)
|
case (CurrState_HCTxArb) // synopsys parallel_case full_case
|
|
`START_HARB:
|
`START_HARB:
|
begin
|
|
NextState_HCTxArb <= `WAIT_REQ;
|
NextState_HCTxArb <= `WAIT_REQ;
|
end
|
|
`WAIT_REQ:
|
`WAIT_REQ:
|
begin
|
|
if (SOFCntlReq == 1'b1)
|
if (SOFCntlReq == 1'b1)
|
begin
|
begin
|
NextState_HCTxArb <= `SEND_SOF;
|
NextState_HCTxArb <= `SEND_SOF;
|
next_SOFCntlGnt <= 1'b1;
|
next_SOFCntlGnt <= 1'b1;
|
next_muxCntl <= `SOF_CTRL_MUX;
|
next_muxCntl <= `SOF_CTRL_MUX;
|
Line 175... |
Line 181... |
begin
|
begin
|
NextState_HCTxArb <= `DIRECT_CONTROL;
|
NextState_HCTxArb <= `DIRECT_CONTROL;
|
next_directCntlGnt <= 1'b1;
|
next_directCntlGnt <= 1'b1;
|
next_muxCntl <= `DIRECT_CTRL_MUX;
|
next_muxCntl <= `DIRECT_CTRL_MUX;
|
end
|
end
|
end
|
|
`SEND_SOF:
|
`SEND_SOF:
|
begin
|
|
if (SOFCntlReq == 1'b0)
|
if (SOFCntlReq == 1'b0)
|
begin
|
begin
|
NextState_HCTxArb <= `WAIT_REQ;
|
NextState_HCTxArb <= `WAIT_REQ;
|
next_SOFCntlGnt <= 1'b0;
|
next_SOFCntlGnt <= 1'b0;
|
end
|
end
|
end
|
|
`SEND_PACKET:
|
`SEND_PACKET:
|
begin
|
|
if (sendPacketReq == 1'b0)
|
if (sendPacketReq == 1'b0)
|
begin
|
begin
|
NextState_HCTxArb <= `WAIT_REQ;
|
NextState_HCTxArb <= `WAIT_REQ;
|
next_sendPacketGnt <= 1'b0;
|
next_sendPacketGnt <= 1'b0;
|
end
|
end
|
end
|
|
`DIRECT_CONTROL:
|
`DIRECT_CONTROL:
|
begin
|
|
if (directCntlReq == 1'b0)
|
if (directCntlReq == 1'b0)
|
begin
|
begin
|
NextState_HCTxArb <= `WAIT_REQ;
|
NextState_HCTxArb <= `WAIT_REQ;
|
next_directCntlGnt <= 1'b0;
|
next_directCntlGnt <= 1'b0;
|
end
|
end
|
end
|
|
endcase
|
endcase
|
end
|
end
|
|
|
|
//----------------------------------
|
// Current State Logic (sequential)
|
// Current State Logic (sequential)
|
|
//----------------------------------
|
always @ (posedge clk)
|
always @ (posedge clk)
|
begin
|
begin : HCTxArb_CurrentState
|
if (rst)
|
if (rst)
|
CurrState_HCTxArb <= `START_HARB;
|
CurrState_HCTxArb <= `START_HARB;
|
else
|
else
|
CurrState_HCTxArb <= NextState_HCTxArb;
|
CurrState_HCTxArb <= NextState_HCTxArb;
|
end
|
end
|
|
|
|
//----------------------------------
|
// Registered outputs logic
|
// Registered outputs logic
|
|
//----------------------------------
|
always @ (posedge clk)
|
always @ (posedge clk)
|
begin
|
begin : HCTxArb_RegOutput
|
if (rst)
|
if (rst)
|
begin
|
begin
|
|
muxCntl <= 2'b00;
|
SOFCntlGnt <= 1'b0;
|
SOFCntlGnt <= 1'b0;
|
sendPacketGnt <= 1'b0;
|
sendPacketGnt <= 1'b0;
|
directCntlGnt <= 1'b0;
|
directCntlGnt <= 1'b0;
|
muxCntl <= 2'b00;
|
|
end
|
end
|
else
|
else
|
begin
|
begin
|
|
muxCntl <= next_muxCntl;
|
SOFCntlGnt <= next_SOFCntlGnt;
|
SOFCntlGnt <= next_SOFCntlGnt;
|
sendPacketGnt <= next_sendPacketGnt;
|
sendPacketGnt <= next_sendPacketGnt;
|
directCntlGnt <= next_directCntlGnt;
|
directCntlGnt <= next_directCntlGnt;
|
muxCntl <= next_muxCntl;
|
|
end
|
end
|
end
|
end
|
|
|
endmodule
|
endmodule
|
No newline at end of file
|
No newline at end of file
|