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

Subversion Repositories usbhostslave

[/] [usbhostslave/] [trunk/] [RTL/] [hostController/] [sendpacketcheckpreamble.v] - Diff between revs 34 and 37

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 34 Rev 37
 
 
// File        : ../RTL/hostController/sendpacketcheckpreamble.v
// File        : ../RTL/hostController/sendpacketcheckpreamble.v
// Generated   : 10/15/06 20:31:20
// Generated   : 11/10/06 05:37:21
// From        : ../RTL/hostController/sendpacketcheckpreamble.asf
// From        : ../RTL/hostController/sendpacketcheckpreamble.asf
// By          : FSM2VHDL ver. 5.0.0.9
// By          : FSM2VHDL ver. 5.0.0.9
 
 
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
////                                                              ////
////                                                              ////
//// sendpacketcheckpreamble
//// sendpacketcheckpreamble
////                                                              ////
////                                                              ////
//// 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"
`include "usbConstants_h.v"
`include "usbConstants_h.v"
 
 
module sendPacketCheckPreamble (clk, preAmbleEnable, rst, sendPacketCPPID, sendPacketCPReady, sendPacketCPWEn, sendPacketPID, sendPacketRdy, sendPacketWEn);
module sendPacketCheckPreamble (clk, preAmbleEnable, rst, sendPacketCPPID, sendPacketCPReady, sendPacketCPWEn, sendPacketPID, sendPacketRdy, sendPacketWEn);
input   clk;
input   clk;
input   preAmbleEnable;
input   preAmbleEnable;
input   rst;
input   rst;
input   [3:0] sendPacketCPPID;
input   [3:0] sendPacketCPPID;
input   sendPacketCPWEn;
input   sendPacketCPWEn;
input   sendPacketRdy;
input   sendPacketRdy;
output  sendPacketCPReady;
output  sendPacketCPReady;
output  [3:0] sendPacketPID;
output  [3:0] sendPacketPID;
output  sendPacketWEn;
output  sendPacketWEn;
 
 
wire    clk;
wire    clk;
wire    preAmbleEnable;
wire    preAmbleEnable;
wire    rst;
wire    rst;
wire    [3:0] sendPacketCPPID;
wire    [3:0] sendPacketCPPID;
reg     sendPacketCPReady, next_sendPacketCPReady;
reg     sendPacketCPReady, next_sendPacketCPReady;
wire    sendPacketCPWEn;
wire    sendPacketCPWEn;
reg     [3:0] sendPacketPID, next_sendPacketPID;
reg     [3:0] sendPacketPID, next_sendPacketPID;
wire    sendPacketRdy;
wire    sendPacketRdy;
reg     sendPacketWEn, next_sendPacketWEn;
reg     sendPacketWEn, next_sendPacketWEn;
 
 
// BINARY ENCODED state machine: sendPktCP
// BINARY ENCODED state machine: sendPktCP
// State codes definitions:
// State codes definitions:
`define SPC_WAIT_EN 4'b0000
`define SPC_WAIT_EN 4'b0000
`define START_SPC 4'b0001
`define START_SPC 4'b0001
`define CHK_PREAM 4'b0010
`define CHK_PREAM 4'b0010
`define PREAM_PKT_SND_PREAM 4'b0011
`define PREAM_PKT_SND_PREAM 4'b0011
`define PREAM_PKT_WAIT_RDY1 4'b0100
`define PREAM_PKT_WAIT_RDY1 4'b0100
`define PREAM_PKT_PREAM_SENT 4'b0101
`define PREAM_PKT_PREAM_SENT 4'b0101
`define PREAM_PKT_SND_PID 4'b0110
`define PREAM_PKT_SND_PID 4'b0110
`define PREAM_PKT_PID_SENT 4'b0111
`define PREAM_PKT_PID_SENT 4'b0111
`define REG_PKT_SEND_PID 4'b1000
`define REG_PKT_SEND_PID 4'b1000
`define REG_PKT_WAIT_RDY1 4'b1001
`define REG_PKT_WAIT_RDY1 4'b1001
`define REG_PKT_WAIT_RDY 4'b1010
`define REG_PKT_WAIT_RDY 4'b1010
`define READY 4'b1011
`define READY 4'b1011
`define PREAM_PKT_WAIT_RDY2 4'b1100
`define PREAM_PKT_WAIT_RDY2 4'b1100
`define PREAM_PKT_WAIT_RDY3 4'b1101
`define PREAM_PKT_WAIT_RDY3 4'b1101
 
 
reg [3:0] CurrState_sendPktCP;
reg [3:0] CurrState_sendPktCP;
reg [3:0] NextState_sendPktCP;
reg [3:0] NextState_sendPktCP;
 
 
 
 
//--------------------------------------------------------------------
//--------------------------------------------------------------------
// Machine: sendPktCP
// Machine: sendPktCP
//--------------------------------------------------------------------
//--------------------------------------------------------------------
//----------------------------------
//----------------------------------
// Next State Logic (combinatorial)
// Next State Logic (combinatorial)
//----------------------------------
//----------------------------------
always @ (sendPacketCPPID or sendPacketCPWEn or preAmbleEnable or sendPacketRdy or sendPacketCPReady or sendPacketWEn or sendPacketPID or CurrState_sendPktCP)
always @ (sendPacketCPPID or sendPacketCPWEn or preAmbleEnable or sendPacketRdy or sendPacketCPReady or sendPacketWEn or sendPacketPID or CurrState_sendPktCP)
begin : sendPktCP_NextState
begin : sendPktCP_NextState
  NextState_sendPktCP <= CurrState_sendPktCP;
  NextState_sendPktCP <= CurrState_sendPktCP;
  // Set default values for outputs and signals
  // Set default values for outputs and signals
  next_sendPacketCPReady <= sendPacketCPReady;
  next_sendPacketCPReady <= sendPacketCPReady;
  next_sendPacketWEn <= sendPacketWEn;
  next_sendPacketWEn <= sendPacketWEn;
  next_sendPacketPID <= sendPacketPID;
  next_sendPacketPID <= sendPacketPID;
  case (CurrState_sendPktCP)
  case (CurrState_sendPktCP)
    `SPC_WAIT_EN:
    `SPC_WAIT_EN:
      if (sendPacketCPWEn == 1'b1)
      if (sendPacketCPWEn == 1'b1)
      begin
      begin
        NextState_sendPktCP <= `CHK_PREAM;
        NextState_sendPktCP <= `CHK_PREAM;
        next_sendPacketCPReady <= 1'b0;
        next_sendPacketCPReady <= 1'b0;
      end
      end
    `START_SPC:
    `START_SPC:
      NextState_sendPktCP <= `SPC_WAIT_EN;
      NextState_sendPktCP <= `SPC_WAIT_EN;
    `CHK_PREAM:
    `CHK_PREAM:
      if (preAmbleEnable == 1'b1)
      if (preAmbleEnable == 1'b1)
        NextState_sendPktCP <= `PREAM_PKT_WAIT_RDY1;
        NextState_sendPktCP <= `PREAM_PKT_WAIT_RDY1;
      else
      else
        NextState_sendPktCP <= `REG_PKT_WAIT_RDY1;
        NextState_sendPktCP <= `REG_PKT_WAIT_RDY1;
    `READY:
    `READY:
    begin
    begin
      next_sendPacketCPReady <= 1'b1;
      next_sendPacketCPReady <= 1'b1;
      NextState_sendPktCP <= `SPC_WAIT_EN;
      NextState_sendPktCP <= `SPC_WAIT_EN;
    end
    end
    `PREAM_PKT_SND_PREAM:
    `PREAM_PKT_SND_PREAM:
    begin
    begin
      next_sendPacketWEn <= 1'b1;
      next_sendPacketWEn <= 1'b1;
      next_sendPacketPID <= `PREAMBLE;
      next_sendPacketPID <= `PREAMBLE;
      NextState_sendPktCP <= `PREAM_PKT_PREAM_SENT;
      NextState_sendPktCP <= `PREAM_PKT_PREAM_SENT;
    end
    end
    `PREAM_PKT_WAIT_RDY1:
    `PREAM_PKT_WAIT_RDY1:
      if (sendPacketRdy == 1'b1)
      if (sendPacketRdy == 1'b1)
        NextState_sendPktCP <= `PREAM_PKT_SND_PREAM;
        NextState_sendPktCP <= `PREAM_PKT_SND_PREAM;
    `PREAM_PKT_PREAM_SENT:
    `PREAM_PKT_PREAM_SENT:
    begin
    begin
      next_sendPacketWEn <= 1'b0;
      next_sendPacketWEn <= 1'b0;
      NextState_sendPktCP <= `PREAM_PKT_WAIT_RDY2;
      NextState_sendPktCP <= `PREAM_PKT_WAIT_RDY2;
    end
    end
    `PREAM_PKT_SND_PID:
    `PREAM_PKT_SND_PID:
    begin
    begin
      next_sendPacketWEn <= 1'b1;
      next_sendPacketWEn <= 1'b1;
      next_sendPacketPID <= sendPacketCPPID;
      next_sendPacketPID <= sendPacketCPPID;
      NextState_sendPktCP <= `PREAM_PKT_PID_SENT;
      NextState_sendPktCP <= `PREAM_PKT_PID_SENT;
    end
    end
    `PREAM_PKT_PID_SENT:
    `PREAM_PKT_PID_SENT:
    begin
    begin
      next_sendPacketWEn <= 1'b0;
      next_sendPacketWEn <= 1'b0;
      NextState_sendPktCP <= `PREAM_PKT_WAIT_RDY3;
      NextState_sendPktCP <= `PREAM_PKT_WAIT_RDY3;
    end
    end
    `PREAM_PKT_WAIT_RDY2:
    `PREAM_PKT_WAIT_RDY2:
      if (sendPacketRdy == 1'b1)
      if (sendPacketRdy == 1'b1)
        NextState_sendPktCP <= `PREAM_PKT_SND_PID;
        NextState_sendPktCP <= `PREAM_PKT_SND_PID;
    `PREAM_PKT_WAIT_RDY3:
    `PREAM_PKT_WAIT_RDY3:
      if (sendPacketRdy == 1'b1)
      if (sendPacketRdy == 1'b1)
        NextState_sendPktCP <= `READY;
        NextState_sendPktCP <= `READY;
    `REG_PKT_SEND_PID:
    `REG_PKT_SEND_PID:
    begin
    begin
      next_sendPacketWEn <= 1'b1;
      next_sendPacketWEn <= 1'b1;
      next_sendPacketPID <= sendPacketCPPID;
      next_sendPacketPID <= sendPacketCPPID;
      NextState_sendPktCP <= `REG_PKT_WAIT_RDY;
      NextState_sendPktCP <= `REG_PKT_WAIT_RDY;
    end
    end
    `REG_PKT_WAIT_RDY1:
    `REG_PKT_WAIT_RDY1:
      if (sendPacketRdy == 1'b1)
      if (sendPacketRdy == 1'b1)
        NextState_sendPktCP <= `REG_PKT_SEND_PID;
        NextState_sendPktCP <= `REG_PKT_SEND_PID;
    `REG_PKT_WAIT_RDY:
    `REG_PKT_WAIT_RDY:
    begin
    begin
      next_sendPacketWEn <= 1'b0;
      next_sendPacketWEn <= 1'b0;
      NextState_sendPktCP <= `READY;
      NextState_sendPktCP <= `READY;
    end
    end
  endcase
  endcase
end
end
 
 
//----------------------------------
//----------------------------------
// Current State Logic (sequential)
// Current State Logic (sequential)
//----------------------------------
//----------------------------------
always @ (posedge clk)
always @ (posedge clk)
begin : sendPktCP_CurrentState
begin : sendPktCP_CurrentState
  if (rst)
  if (rst)
    CurrState_sendPktCP <= `START_SPC;
    CurrState_sendPktCP <= `START_SPC;
  else
  else
    CurrState_sendPktCP <= NextState_sendPktCP;
    CurrState_sendPktCP <= NextState_sendPktCP;
end
end
 
 
//----------------------------------
//----------------------------------
// Registered outputs logic
// Registered outputs logic
//----------------------------------
//----------------------------------
always @ (posedge clk)
always @ (posedge clk)
begin : sendPktCP_RegOutput
begin : sendPktCP_RegOutput
  if (rst)
  if (rst)
  begin
  begin
    sendPacketWEn <= 1'b0;
    sendPacketWEn <= 1'b0;
    sendPacketPID <= 4'b0;
    sendPacketPID <= 4'b0;
    sendPacketCPReady <= 1'b1;
    sendPacketCPReady <= 1'b1;
  end
  end
  else
  else
  begin
  begin
    sendPacketWEn <= next_sendPacketWEn;
    sendPacketWEn <= next_sendPacketWEn;
    sendPacketPID <= next_sendPacketPID;
    sendPacketPID <= next_sendPacketPID;
    sendPacketCPReady <= next_sendPacketCPReady;
    sendPacketCPReady <= next_sendPacketCPReady;
  end
  end
end
end
 
 
 
 

powered by: WebSVN 2.1.0

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