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

Subversion Repositories usbhostslave

[/] [usbhostslave/] [trunk/] [RTL/] [serialInterfaceEngine/] [siereceiver.v] - Diff between revs 18 and 22

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

Rev 18 Rev 22
 
 
 
// File        : ../RTL/serialInterfaceEngine/siereceiver.v
 
// Generated   : 10/06/06 19:35:30
 
// From        : ../RTL/serialInterfaceEngine/siereceiver.asf
 
// By          : FSM2VHDL ver. 5.0.0.9
 
 
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
////                                                              ////
////                                                              ////
//// SIEReceiver
//// SIEReceiver
////                                                              ////
////                                                              ////
//// 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                     ////
////                                                              ////
////                                                              ////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
`timescale 1ns / 1ps
`include "timescale.v"
`include "usbSerialInterfaceEngine_h.v"
`include "usbSerialInterfaceEngine_h.v"
 
 
 
 
module SIEReceiver (clk, connectState, rst, RxWireDataIn, RxWireDataWEn);
module SIEReceiver (RxWireDataIn, RxWireDataWEn, clk, connectState, rst);
input   clk;
 
input   rst;
 
input   [1:0]RxWireDataIn;
input   [1:0]RxWireDataIn;
input   RxWireDataWEn;
input   RxWireDataWEn;
 
input   clk;
 
input   rst;
output  [1:0]connectState;
output  [1:0]connectState;
 
 
 
wire    [1:0] RxWireDataIn;
 
wire    RxWireDataWEn;
wire    clk;
wire    clk;
reg     [1:0]connectState, next_connectState;
reg     [1:0] connectState, next_connectState;
wire    rst;
wire    rst;
wire    [1:0]RxWireDataIn;
 
wire    RxWireDataWEn;
 
 
 
// diagram signals declarations
// diagram signals declarations
reg  [1:0]RxBits, next_RxBits;
 
reg  [3:0]RXStMachCurrState, next_RXStMachCurrState;
reg  [3:0]RXStMachCurrState, next_RXStMachCurrState;
reg  [7:0]RXWaitCount, next_RXWaitCount;
reg  [7:0]RXWaitCount, next_RXWaitCount;
 
reg  [1:0]RxBits, next_RxBits;
 
 
// BINARY ENCODED state machine: rcvr
// BINARY ENCODED state machine: rcvr
// State codes definitions:
// State codes definitions:
`define WAIT_FS_CONN_CHK_RX_BITS 4'b0000
`define WAIT_FS_CONN_CHK_RX_BITS 4'b0000
`define WAIT_LS_CONN_CHK_RX_BITS 4'b0001
`define WAIT_LS_CONN_CHK_RX_BITS 4'b0001
`define LS_CONN_CHK_RX_BITS 4'b0010
`define LS_CONN_CHK_RX_BITS 4'b0010
`define DISCNCT_CHK_RXBITS 4'b0011
`define DISCNCT_CHK_RXBITS 4'b0011
`define WAIT_BIT 4'b0100
`define WAIT_BIT 4'b0100
`define START_SRX 4'b0101
`define START_SRX 4'b0101
`define FS_CONN_CHK_RX_BITS1 4'b0110
`define FS_CONN_CHK_RX_BITS1 4'b0110
`define WAIT_LS_DIS_CHK_RX_BITS 4'b0111
`define WAIT_LS_DIS_CHK_RX_BITS 4'b0111
`define WAIT_FS_DIS_CHK_RX_BITS2 4'b1000
`define WAIT_FS_DIS_CHK_RX_BITS2 4'b1000
 
 
reg [3:0]CurrState_rcvr, NextState_rcvr;
reg [3:0] CurrState_rcvr;
 
reg [3:0] NextState_rcvr;
 
 
 
 
 
//--------------------------------------------------------------------
// Machine: rcvr
// Machine: rcvr
 
//--------------------------------------------------------------------
// NextState logic (combinatorial)
//----------------------------------
always @ (RXWaitCount or RxBits or RxWireDataWEn or RxWireDataIn or connectState or RXStMachCurrState or CurrState_rcvr)
// Next State Logic (combinatorial)
begin
//----------------------------------
 
always @ (RxWireDataIn or RxBits or RXWaitCount or RxWireDataWEn or RXStMachCurrState or connectState or CurrState_rcvr)
 
begin : rcvr_NextState
  NextState_rcvr <= CurrState_rcvr;
  NextState_rcvr <= CurrState_rcvr;
  // Set default values for outputs and signals
  // Set default values for outputs and signals
 
        next_RxBits <= RxBits;
 
        next_RXStMachCurrState <= RXStMachCurrState;
  next_RXWaitCount <= RXWaitCount;
  next_RXWaitCount <= RXWaitCount;
  next_connectState <= connectState;
  next_connectState <= connectState;
  next_RXStMachCurrState <= RXStMachCurrState;
        case (CurrState_rcvr)
  next_RxBits <= RxBits;
 
  case (CurrState_rcvr)  // synopsys parallel_case full_case
 
    `WAIT_BIT:
    `WAIT_BIT:
    begin
 
      if ((RxWireDataWEn == 1'b1) && (RXStMachCurrState == `WAIT_LOW_SP_DISCONNECT_ST))
      if ((RxWireDataWEn == 1'b1) && (RXStMachCurrState == `WAIT_LOW_SP_DISCONNECT_ST))
      begin
                        begin
        NextState_rcvr <= `WAIT_LS_DIS_CHK_RX_BITS;
                                NextState_rcvr <= `WAIT_LS_DIS_CHK_RX_BITS;
        next_RxBits <= RxWireDataIn;
                                next_RxBits <= RxWireDataIn;
      end
                        end
      else if ((RxWireDataWEn == 1'b1) && (RXStMachCurrState == `CONNECT_FULL_SPEED_ST))
                        else if ((RxWireDataWEn == 1'b1) && (RXStMachCurrState == `CONNECT_FULL_SPEED_ST))
      begin
                        begin
        NextState_rcvr <= `FS_CONN_CHK_RX_BITS1;
                                NextState_rcvr <= `FS_CONN_CHK_RX_BITS1;
        next_RxBits <= RxWireDataIn;
                                next_RxBits <= RxWireDataIn;
      end
                        end
      else if ((RxWireDataWEn == 1'b1) && (RXStMachCurrState == `CONNECT_LOW_SPEED_ST))
                        else if ((RxWireDataWEn == 1'b1) && (RXStMachCurrState == `CONNECT_LOW_SPEED_ST))
      begin
                        begin
        NextState_rcvr <= `LS_CONN_CHK_RX_BITS;
                                NextState_rcvr <= `LS_CONN_CHK_RX_BITS;
        next_RxBits <= RxWireDataIn;
                                next_RxBits <= RxWireDataIn;
      end
                        end
      else if ((RxWireDataWEn == 1'b1) && (RXStMachCurrState == `WAIT_LOW_SPEED_CONN_ST))
                        else if ((RxWireDataWEn == 1'b1) && (RXStMachCurrState == `WAIT_LOW_SPEED_CONN_ST))
      begin
                        begin
        NextState_rcvr <= `WAIT_LS_CONN_CHK_RX_BITS;
                                NextState_rcvr <= `WAIT_LS_CONN_CHK_RX_BITS;
        next_RxBits <= RxWireDataIn;
                                next_RxBits <= RxWireDataIn;
      end
                        end
      else if ((RxWireDataWEn == 1'b1) && (RXStMachCurrState == `WAIT_FULL_SPEED_CONN_ST))
                        else if ((RxWireDataWEn == 1'b1) && (RXStMachCurrState == `WAIT_FULL_SPEED_CONN_ST))
      begin
                        begin
        NextState_rcvr <= `WAIT_FS_CONN_CHK_RX_BITS;
                                NextState_rcvr <= `WAIT_FS_CONN_CHK_RX_BITS;
        next_RxBits <= RxWireDataIn;
                                next_RxBits <= RxWireDataIn;
      end
                        end
      else if ((RxWireDataWEn == 1'b1) && (RXStMachCurrState == `DISCONNECT_ST))
                        else if ((RxWireDataWEn == 1'b1) && (RXStMachCurrState == `DISCONNECT_ST))
      begin
                        begin
        NextState_rcvr <= `DISCNCT_CHK_RXBITS;
                                NextState_rcvr <= `DISCNCT_CHK_RXBITS;
        next_RxBits <= RxWireDataIn;
                                next_RxBits <= RxWireDataIn;
      end
                        end
      else if ((RxWireDataWEn == 1'b1) && (RXStMachCurrState == `WAIT_FULL_SP_DISCONNECT_ST))
                        else if ((RxWireDataWEn == 1'b1) && (RXStMachCurrState == `WAIT_FULL_SP_DISCONNECT_ST))
      begin
                        begin
        NextState_rcvr <= `WAIT_FS_DIS_CHK_RX_BITS2;
                                NextState_rcvr <= `WAIT_FS_DIS_CHK_RX_BITS2;
        next_RxBits <= RxWireDataIn;
                                next_RxBits <= RxWireDataIn;
      end
      end
    end
 
    `START_SRX:
    `START_SRX:
    begin
                begin
      next_RXStMachCurrState <= `DISCONNECT_ST;
                        next_RXStMachCurrState <= `DISCONNECT_ST;
      next_RXWaitCount <= 8'h00;
                        next_RXWaitCount <= 8'h00;
      next_connectState <= `DISCONNECT;
                        next_connectState <= `DISCONNECT;
      next_RxBits <= 2'b00;
                        next_RxBits <= 2'b00;
      NextState_rcvr <= `WAIT_BIT;
                        NextState_rcvr <= `WAIT_BIT;
    end
                end
    `DISCNCT_CHK_RXBITS:
    `DISCNCT_CHK_RXBITS:
    begin
 
      if (RxBits == `ZERO_ONE)
      if (RxBits == `ZERO_ONE)
      begin
                        begin
        NextState_rcvr <= `WAIT_BIT;
                                NextState_rcvr <= `WAIT_BIT;
        next_RXStMachCurrState <= `WAIT_LOW_SPEED_CONN_ST;
                                next_RXStMachCurrState <= `WAIT_LOW_SPEED_CONN_ST;
        next_RXWaitCount <= 8'h00;
                                next_RXWaitCount <= 8'h00;
      end
                        end
      else if (RxBits == `ONE_ZERO)
                        else if (RxBits == `ONE_ZERO)
      begin
                        begin
        NextState_rcvr <= `WAIT_BIT;
                                NextState_rcvr <= `WAIT_BIT;
        next_RXStMachCurrState <= `WAIT_FULL_SPEED_CONN_ST;
                                next_RXStMachCurrState <= `WAIT_FULL_SPEED_CONN_ST;
        next_RXWaitCount <= 8'h00;
                                next_RXWaitCount <= 8'h00;
      end
                        end
      else
      else
      begin
 
        NextState_rcvr <= `WAIT_BIT;
        NextState_rcvr <= `WAIT_BIT;
      end
 
    end
 
    `WAIT_FS_CONN_CHK_RX_BITS:
    `WAIT_FS_CONN_CHK_RX_BITS:
    begin
                begin
      if (RxBits == `ONE_ZERO)
                        if (RxBits == `ONE_ZERO)
      begin
                        begin
      next_RXWaitCount <= RXWaitCount + 1'b1;
                          next_RXWaitCount <= RXWaitCount + 1'b1;
      if (RXWaitCount == `CONNECT_WAIT_TIME)
                            if (RXWaitCount == `CONNECT_WAIT_TIME)
      begin
                            begin
      next_connectState <= `FULL_SPEED_CONNECT;
                            next_connectState <= `FULL_SPEED_CONNECT;
      next_RXStMachCurrState <= `CONNECT_FULL_SPEED_ST;
                            next_RXStMachCurrState <= `CONNECT_FULL_SPEED_ST;
      end
                            end
      end
                        end
      else
                        else
      begin
                        begin
      next_RXStMachCurrState <= `DISCONNECT_ST;
                          next_RXStMachCurrState <= `DISCONNECT_ST;
      end
                        end
      NextState_rcvr <= `WAIT_BIT;
                        NextState_rcvr <= `WAIT_BIT;
    end
                end
    `WAIT_LS_CONN_CHK_RX_BITS:
                `WAIT_LS_CONN_CHK_RX_BITS:
    begin
                begin
      if (RxBits == `ZERO_ONE)
                        if (RxBits == `ZERO_ONE)
      begin
                        begin
      next_RXWaitCount <= RXWaitCount + 1'b1;
                          next_RXWaitCount <= RXWaitCount + 1'b1;
      if (RXWaitCount == `CONNECT_WAIT_TIME)
                            if (RXWaitCount == `CONNECT_WAIT_TIME)
      begin
                            begin
      next_connectState <= `LOW_SPEED_CONNECT;
                            next_connectState <= `LOW_SPEED_CONNECT;
      next_RXStMachCurrState <= `CONNECT_LOW_SPEED_ST;
                            next_RXStMachCurrState <= `CONNECT_LOW_SPEED_ST;
      end
                            end
      end
                        end
      else
                        else
      begin
                        begin
      next_RXStMachCurrState <= `DISCONNECT_ST;
                          next_RXStMachCurrState <= `DISCONNECT_ST;
      end
                        end
      NextState_rcvr <= `WAIT_BIT;
                        NextState_rcvr <= `WAIT_BIT;
    end
                end
    `LS_CONN_CHK_RX_BITS:
                `LS_CONN_CHK_RX_BITS:
    begin
                begin
      NextState_rcvr <= `WAIT_BIT;
                        NextState_rcvr <= `WAIT_BIT;
      if (RxBits == `SE0)
                        if (RxBits == `SE0)
      begin
                        begin
      next_RXStMachCurrState <= `WAIT_LOW_SP_DISCONNECT_ST;
                          next_RXStMachCurrState <= `WAIT_LOW_SP_DISCONNECT_ST;
      next_RXWaitCount <= 0;
                          next_RXWaitCount <= 0;
      end
                        end
    end
                end
    `FS_CONN_CHK_RX_BITS1:
                `FS_CONN_CHK_RX_BITS1:
    begin
                begin
      NextState_rcvr <= `WAIT_BIT;
                        NextState_rcvr <= `WAIT_BIT;
      if (RxBits == `SE0)
                        if (RxBits == `SE0)
      begin
                        begin
      next_RXStMachCurrState <= `WAIT_FULL_SP_DISCONNECT_ST;
                          next_RXStMachCurrState <= `WAIT_FULL_SP_DISCONNECT_ST;
      next_RXWaitCount <= 0;
                          next_RXWaitCount <= 0;
      end
                        end
    end
                end
    `WAIT_LS_DIS_CHK_RX_BITS:
                `WAIT_LS_DIS_CHK_RX_BITS:
    begin
                begin
      NextState_rcvr <= `WAIT_BIT;
                        NextState_rcvr <= `WAIT_BIT;
      if (RxBits == `SE0)
                        if (RxBits == `SE0)
      begin
                        begin
      next_RXWaitCount <= RXWaitCount + 1'b1;
                          next_RXWaitCount <= RXWaitCount + 1'b1;
      if (RXWaitCount == `DISCONNECT_WAIT_TIME)
                            if (RXWaitCount == `DISCONNECT_WAIT_TIME)
      begin
                            begin
      next_RXStMachCurrState <= `DISCONNECT_ST;
                            next_RXStMachCurrState <= `DISCONNECT_ST;
      next_connectState <= `DISCONNECT;
                            next_connectState <= `DISCONNECT;
      end
                            end
      end
                        end
      else
                        else
      begin
                        begin
      next_RXStMachCurrState <= `CONNECT_LOW_SPEED_ST;
                          next_RXStMachCurrState <= `CONNECT_LOW_SPEED_ST;
      end
                        end
    end
                end
    `WAIT_FS_DIS_CHK_RX_BITS2:
                `WAIT_FS_DIS_CHK_RX_BITS2:
    begin
                begin
      NextState_rcvr <= `WAIT_BIT;
                        NextState_rcvr <= `WAIT_BIT;
      if (RxBits == `SE0)
                        if (RxBits == `SE0)
      begin
                        begin
      next_RXWaitCount <= RXWaitCount + 1'b1;
                          next_RXWaitCount <= RXWaitCount + 1'b1;
      if (RXWaitCount == `DISCONNECT_WAIT_TIME)
                            if (RXWaitCount == `DISCONNECT_WAIT_TIME)
      begin
                            begin
      next_RXStMachCurrState <= `DISCONNECT_ST;
                            next_RXStMachCurrState <= `DISCONNECT_ST;
      next_connectState <= `DISCONNECT;
                            next_connectState <= `DISCONNECT;
      end
                            end
      end
                        end
      else
                        else
      begin
                        begin
      next_RXStMachCurrState <= `CONNECT_FULL_SPEED_ST;
                          next_RXStMachCurrState <= `CONNECT_FULL_SPEED_ST;
      end
                        end
    end
                end
  endcase
        endcase
end
end
 
 
 
//----------------------------------
// Current State Logic (sequential)
// Current State Logic (sequential)
 
//----------------------------------
always @ (posedge clk)
always @ (posedge clk)
begin
begin : rcvr_CurrentState
  if (rst)
  if (rst)
    CurrState_rcvr <= `START_SRX;
                CurrState_rcvr <= `START_SRX;
  else
        else
    CurrState_rcvr <= NextState_rcvr;
                CurrState_rcvr <= NextState_rcvr;
end
end
 
 
 
//----------------------------------
// Registered outputs logic
// Registered outputs logic
 
//----------------------------------
always @ (posedge clk)
always @ (posedge clk)
begin
begin : rcvr_RegOutput
  if (rst)
  if (rst)
  begin
  begin
    connectState <= `DISCONNECT;
 
    RXWaitCount <= 8'h00;
 
    RXStMachCurrState <= `DISCONNECT_ST;
    RXStMachCurrState <= `DISCONNECT_ST;
 
                RXWaitCount <= 8'h00;
    RxBits <= 2'b00;
    RxBits <= 2'b00;
 
                connectState <= `DISCONNECT;
  end
  end
  else
        else
  begin
  begin
    connectState <= next_connectState;
 
    RXWaitCount <= next_RXWaitCount;
 
    RXStMachCurrState <= next_RXStMachCurrState;
    RXStMachCurrState <= next_RXStMachCurrState;
 
                RXWaitCount <= next_RXWaitCount;
    RxBits <= next_RxBits;
    RxBits <= next_RxBits;
 
                connectState <= next_connectState;
  end
  end
end
end
 
 
 
 

powered by: WebSVN 2.1.0

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