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

Subversion Repositories usbhostslave

[/] [usbhostslave/] [trunk/] [RTL/] [slaveController/] [sctxportarbiter.v] - Diff between revs 37 and 40

Only display areas with differences | Details | Blame | View Log

Rev 37 Rev 40
 
 
// File        : ../RTL/slaveController/sctxportarbiter.v
// File        : ../RTL/slaveController/sctxportarbiter.v
// Generated   : 11/10/06 05:37:24
// Generated   : 11/10/06 05:37:24
// From        : ../RTL/slaveController/sctxportarbiter.asf
// From        : ../RTL/slaveController/sctxportarbiter.asf
// By          : FSM2VHDL ver. 5.0.0.9
// By          : FSM2VHDL ver. 5.0.0.9
 
 
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
////                                                              ////
////                                                              ////
//// SCTxPortArbiter
//// SCTxPortArbiter
////                                                              ////
////                                                              ////
//// This file is part of the usbhostslave opencores effort.
//// This file is part of the usbhostslave opencores effort.
//// http://www.opencores.org/cores/usbhostslave/                 ////
//// http://www.opencores.org/cores/usbhostslave/                 ////
////                                                              ////
////                                                              ////
//// Module Description:                                          ////
//// Module Description:                                          ////
//// 
//// 
////                                                              ////
////                                                              ////
//// To Do:                                                       ////
//// To Do:                                                       ////
//// 
//// 
////                                                              ////
////                                                              ////
//// Author(s):                                                   ////
//// Author(s):                                                   ////
//// - Steve Fielding, sfielding@base2designs.com                 ////
//// - Steve Fielding, sfielding@base2designs.com                 ////
////                                                              ////
////                                                              ////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
////                                                              ////
////                                                              ////
//// Copyright (C) 2004 Steve Fielding and OPENCORES.ORG          ////
//// Copyright (C) 2004 Steve Fielding and OPENCORES.ORG          ////
////                                                              ////
////                                                              ////
//// This source file may be used and distributed without         ////
//// This source file may be used and distributed without         ////
//// restriction provided that this copyright statement is not    ////
//// restriction provided that this copyright statement is not    ////
//// removed from the file and that any derivative work contains  ////
//// removed from the file and that any derivative work contains  ////
//// the original copyright notice and the associated disclaimer. ////
//// the original copyright notice and the associated disclaimer. ////
////                                                              ////
////                                                              ////
//// This source file is free software; you can redistribute it   ////
//// This source file is free software; you can redistribute it   ////
//// and/or modify it under the terms of the GNU Lesser General   ////
//// and/or modify it under the terms of the GNU Lesser General   ////
//// Public License as published by the Free Software Foundation; ////
//// Public License as published by the Free Software Foundation; ////
//// either version 2.1 of the License, or (at your option) any   ////
//// either version 2.1 of the License, or (at your option) any   ////
//// later version.                                               ////
//// later version.                                               ////
////                                                              ////
////                                                              ////
//// This source is distributed in the hope that it will be       ////
//// This source is distributed in the hope that it will be       ////
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
//// PURPOSE. See the GNU Lesser General Public License for more  ////
//// PURPOSE. See the GNU Lesser General Public License for more  ////
//// details.                                                     ////
//// details.                                                     ////
////                                                              ////
////                                                              ////
//// You should have received a copy of the GNU Lesser General    ////
//// You should have received a copy of the GNU Lesser General    ////
//// 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                     ////
////                                                              ////
////                                                              ////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
`include "timescale.v"
`include "timescale.v"
 
 
module SCTxPortArbiter (SCTxPortCntl, SCTxPortData, SCTxPortRdyIn, SCTxPortRdyOut, SCTxPortWEnable, clk, directCntlCntl, directCntlData, directCntlGnt, directCntlReq, directCntlWEn, rst, sendPacketCntl, sendPacketData, sendPacketGnt, sendPacketReq, sendPacketWEn);
module SCTxPortArbiter (SCTxPortCntl, SCTxPortData, SCTxPortRdyIn, SCTxPortRdyOut, SCTxPortWEnable, clk, directCntlCntl, directCntlData, directCntlGnt, directCntlReq, directCntlWEn, rst, sendPacketCntl, sendPacketData, sendPacketGnt, sendPacketReq, sendPacketWEn);
input   SCTxPortRdyIn;
input   SCTxPortRdyIn;
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;
output  [7:0] SCTxPortCntl;
output  [7:0] SCTxPortCntl;
output  [7:0] SCTxPortData;
output  [7:0] SCTxPortData;
output  SCTxPortRdyOut;
output  SCTxPortRdyOut;
output  SCTxPortWEnable;
output  SCTxPortWEnable;
output  directCntlGnt;
output  directCntlGnt;
output  sendPacketGnt;
output  sendPacketGnt;
 
 
reg     [7:0] SCTxPortCntl, next_SCTxPortCntl;
reg     [7:0] SCTxPortCntl, next_SCTxPortCntl;
reg     [7:0] SCTxPortData, next_SCTxPortData;
reg     [7:0] SCTxPortData, next_SCTxPortData;
wire    SCTxPortRdyIn;
wire    SCTxPortRdyIn;
reg     SCTxPortRdyOut, next_SCTxPortRdyOut;
reg     SCTxPortRdyOut, next_SCTxPortRdyOut;
reg     SCTxPortWEnable, next_SCTxPortWEnable;
reg     SCTxPortWEnable, next_SCTxPortWEnable;
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;
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;
 
 
// diagram signals declarations
// diagram signals declarations
reg  muxDCEn, next_muxDCEn;
reg  muxDCEn, next_muxDCEn;
 
 
// BINARY ENCODED state machine: SCTxArb
// BINARY ENCODED state machine: SCTxArb
// State codes definitions:
// State codes definitions:
`define SARB1_WAIT_REQ 2'b00
`define SARB1_WAIT_REQ 2'b00
`define SARB_SEND_PACKET 2'b01
`define SARB_SEND_PACKET 2'b01
`define SARB_DC 2'b10
`define SARB_DC 2'b10
`define START_SARB 2'b11
`define START_SARB 2'b11
 
 
reg [1:0] CurrState_SCTxArb;
reg [1:0] CurrState_SCTxArb;
reg [1:0] NextState_SCTxArb;
reg [1:0] NextState_SCTxArb;
 
 
// Diagram actions (continuous assignments allowed only: assign ...)
// Diagram actions (continuous assignments allowed only: assign ...)
 
 
// SOFController/directContol/sendPacket mux
// SOFController/directContol/sendPacket mux
always @(SCTxPortRdyIn)
always @(SCTxPortRdyIn)
begin
begin
    SCTxPortRdyOut <= SCTxPortRdyIn;
    SCTxPortRdyOut <= SCTxPortRdyIn;
end
end
always @(muxDCEn or
always @(muxDCEn 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)
begin
begin
if (muxDCEn == 1'b1)
if (muxDCEn == 1'b1)
    begin
    begin
        SCTxPortWEnable <= directCntlWEn;
        SCTxPortWEnable <= directCntlWEn;
        SCTxPortData <= directCntlData;
        SCTxPortData <= directCntlData;
        SCTxPortCntl <= directCntlCntl;
        SCTxPortCntl <= directCntlCntl;
    end
    end
else
else
    begin
    begin
        SCTxPortWEnable <= sendPacketWEn;
        SCTxPortWEnable <= sendPacketWEn;
        SCTxPortData <= sendPacketData;
        SCTxPortData <= sendPacketData;
        SCTxPortCntl <= sendPacketCntl;
        SCTxPortCntl <= sendPacketCntl;
    end
    end
end
end
 
 
//--------------------------------------------------------------------
//--------------------------------------------------------------------
// Machine: SCTxArb
// Machine: SCTxArb
//--------------------------------------------------------------------
//--------------------------------------------------------------------
//----------------------------------
//----------------------------------
// Next State Logic (combinatorial)
// Next State Logic (combinatorial)
//----------------------------------
//----------------------------------
always @ (sendPacketReq or directCntlReq or sendPacketGnt or muxDCEn or directCntlGnt or CurrState_SCTxArb)
always @ (sendPacketReq or directCntlReq or sendPacketGnt or muxDCEn or directCntlGnt or CurrState_SCTxArb)
begin : SCTxArb_NextState
begin : SCTxArb_NextState
  NextState_SCTxArb <= CurrState_SCTxArb;
  NextState_SCTxArb <= CurrState_SCTxArb;
  // Set default values for outputs and signals
  // Set default values for outputs and signals
  next_sendPacketGnt <= sendPacketGnt;
  next_sendPacketGnt <= sendPacketGnt;
  next_muxDCEn <= muxDCEn;
  next_muxDCEn <= muxDCEn;
  next_directCntlGnt <= directCntlGnt;
  next_directCntlGnt <= directCntlGnt;
  case (CurrState_SCTxArb)
  case (CurrState_SCTxArb)
    `SARB1_WAIT_REQ:
    `SARB1_WAIT_REQ:
      if (sendPacketReq == 1'b1)
      if (sendPacketReq == 1'b1)
      begin
      begin
        NextState_SCTxArb <= `SARB_SEND_PACKET;
        NextState_SCTxArb <= `SARB_SEND_PACKET;
        next_sendPacketGnt <= 1'b1;
        next_sendPacketGnt <= 1'b1;
        next_muxDCEn <= 1'b0;
        next_muxDCEn <= 1'b0;
      end
      end
      else if (directCntlReq == 1'b1)
      else if (directCntlReq == 1'b1)
      begin
      begin
        NextState_SCTxArb <= `SARB_DC;
        NextState_SCTxArb <= `SARB_DC;
        next_directCntlGnt <= 1'b1;
        next_directCntlGnt <= 1'b1;
        next_muxDCEn <= 1'b1;
        next_muxDCEn <= 1'b1;
      end
      end
    `SARB_SEND_PACKET:
    `SARB_SEND_PACKET:
      if (sendPacketReq == 1'b0)
      if (sendPacketReq == 1'b0)
      begin
      begin
        NextState_SCTxArb <= `SARB1_WAIT_REQ;
        NextState_SCTxArb <= `SARB1_WAIT_REQ;
        next_sendPacketGnt <= 1'b0;
        next_sendPacketGnt <= 1'b0;
      end
      end
    `SARB_DC:
    `SARB_DC:
      if (directCntlReq == 1'b0)
      if (directCntlReq == 1'b0)
      begin
      begin
        NextState_SCTxArb <= `SARB1_WAIT_REQ;
        NextState_SCTxArb <= `SARB1_WAIT_REQ;
        next_directCntlGnt <= 1'b0;
        next_directCntlGnt <= 1'b0;
      end
      end
    `START_SARB:
    `START_SARB:
      NextState_SCTxArb <= `SARB1_WAIT_REQ;
      NextState_SCTxArb <= `SARB1_WAIT_REQ;
  endcase
  endcase
end
end
 
 
//----------------------------------
//----------------------------------
// Current State Logic (sequential)
// Current State Logic (sequential)
//----------------------------------
//----------------------------------
always @ (posedge clk)
always @ (posedge clk)
begin : SCTxArb_CurrentState
begin : SCTxArb_CurrentState
  if (rst)
  if (rst)
    CurrState_SCTxArb <= `START_SARB;
    CurrState_SCTxArb <= `START_SARB;
  else
  else
    CurrState_SCTxArb <= NextState_SCTxArb;
    CurrState_SCTxArb <= NextState_SCTxArb;
end
end
 
 
//----------------------------------
//----------------------------------
// Registered outputs logic
// Registered outputs logic
//----------------------------------
//----------------------------------
always @ (posedge clk)
always @ (posedge clk)
begin : SCTxArb_RegOutput
begin : SCTxArb_RegOutput
  if (rst)
  if (rst)
  begin
  begin
    muxDCEn <= 1'b0;
    muxDCEn <= 1'b0;
    sendPacketGnt <= 1'b0;
    sendPacketGnt <= 1'b0;
    directCntlGnt <= 1'b0;
    directCntlGnt <= 1'b0;
  end
  end
  else
  else
  begin
  begin
    muxDCEn <= next_muxDCEn;
    muxDCEn <= next_muxDCEn;
    sendPacketGnt <= next_sendPacketGnt;
    sendPacketGnt <= next_sendPacketGnt;
    directCntlGnt <= next_directCntlGnt;
    directCntlGnt <= next_directCntlGnt;
  end
  end
end
end
 
 
 
 

powered by: WebSVN 2.1.0

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