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

Subversion Repositories usbhostslave

[/] [usbhostslave/] [trunk/] [RTL/] [hostController/] [directcontrol.v] - Diff between revs 9 and 22

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 9 Rev 22
Line 1... Line 1...
 
 
 
// File        : ../RTL/hostController/directcontrol.v
 
// Generated   : 10/06/06 19:35:24
 
// From        : ../RTL/hostController/directcontrol.asf
 
// By          : FSM2VHDL ver. 5.0.0.9
 
 
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
////                                                              ////
////                                                              ////
//// directControl
//// directControl
////                                                              ////
////                                                              ////
//// 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"
`include "usbSerialInterfaceEngine_h.v"
`include "usbSerialInterfaceEngine_h.v"
 
 
module directControl (clk, directControlEn, directControlLineState, HCTxPortCntl, HCTxPortData, HCTxPortGnt, HCTxPortRdy, HCTxPortReq, HCTxPortWEn, rst);
module directControl (HCTxPortCntl, HCTxPortData, HCTxPortGnt, HCTxPortRdy, HCTxPortReq, HCTxPortWEn, clk, directControlEn, directControlLineState, rst);
 
input   HCTxPortGnt;
 
input   HCTxPortRdy;
input   clk;
input   clk;
input   directControlEn;
input   directControlEn;
input   [1:0]directControlLineState;
input   [1:0]directControlLineState;
input   HCTxPortGnt;
 
input   HCTxPortRdy;
 
input   rst;
input   rst;
output  [7:0]HCTxPortCntl;
output  [7:0]HCTxPortCntl;
output  [7:0]HCTxPortData;
output  [7:0]HCTxPortData;
output  HCTxPortReq;
output  HCTxPortReq;
output  HCTxPortWEn;
output  HCTxPortWEn;
 
 
wire    clk;
 
wire    directControlEn;
 
wire    [1:0]directControlLineState;
 
reg     [7:0]HCTxPortCntl, next_HCTxPortCntl;
reg     [7:0]HCTxPortCntl, next_HCTxPortCntl;
reg     [7:0]HCTxPortData, next_HCTxPortData;
reg     [7:0]HCTxPortData, next_HCTxPortData;
wire    HCTxPortGnt;
wire    HCTxPortGnt;
wire    HCTxPortRdy;
wire    HCTxPortRdy;
reg     HCTxPortReq, next_HCTxPortReq;
reg     HCTxPortReq, next_HCTxPortReq;
reg     HCTxPortWEn, next_HCTxPortWEn;
reg     HCTxPortWEn, next_HCTxPortWEn;
 
wire    clk;
 
wire    directControlEn;
 
wire    [1:0] directControlLineState;
wire    rst;
wire    rst;
 
 
// BINARY ENCODED state machine: drctCntl
// BINARY ENCODED state machine: drctCntl
// State codes definitions:
// State codes definitions:
`define START_DC 3'b000
`define START_DC 3'b000
Line 77... Line 82...
`define DRCT_CNTL_WAIT_RDY 3'b100
`define DRCT_CNTL_WAIT_RDY 3'b100
`define IDLE_FIN 3'b101
`define IDLE_FIN 3'b101
`define IDLE_WAIT_GNT 3'b110
`define IDLE_WAIT_GNT 3'b110
`define IDLE_WAIT_RDY 3'b111
`define IDLE_WAIT_RDY 3'b111
 
 
reg [2:0]CurrState_drctCntl, NextState_drctCntl;
reg [2:0] CurrState_drctCntl;
 
reg [2:0] NextState_drctCntl;
 
 
// Diagram actions (continuous assignments allowed only: assign ...)
// Diagram actions (continuous assignments allowed only: assign ...)
// diagram ACTION
 
 
 
 
// diagram ACTION
 
 
 
//--------------------------------------------------------------------
// Machine: drctCntl
// Machine: drctCntl
 
//--------------------------------------------------------------------
// NextState logic (combinatorial)
//----------------------------------
always @ (directControlEn or HCTxPortGnt or HCTxPortRdy or directControlLineState or HCTxPortCntl or HCTxPortData or HCTxPortWEn or HCTxPortReq or CurrState_drctCntl)
// Next State Logic (combinatorial)
begin
//----------------------------------
 
always @ (directControlLineState or directControlEn or HCTxPortGnt or HCTxPortRdy or HCTxPortReq or HCTxPortWEn or HCTxPortData or HCTxPortCntl or CurrState_drctCntl)
 
begin : drctCntl_NextState
  NextState_drctCntl <= CurrState_drctCntl;
  NextState_drctCntl <= CurrState_drctCntl;
  // Set default values for outputs and signals
  // Set default values for outputs and signals
  next_HCTxPortCntl <= HCTxPortCntl;
 
  next_HCTxPortData <= HCTxPortData;
 
  next_HCTxPortWEn <= HCTxPortWEn;
 
  next_HCTxPortReq <= HCTxPortReq;
  next_HCTxPortReq <= HCTxPortReq;
  case (CurrState_drctCntl)  // synopsys parallel_case full_case
        next_HCTxPortWEn <= HCTxPortWEn;
 
        next_HCTxPortData <= HCTxPortData;
 
        next_HCTxPortCntl <= HCTxPortCntl;
 
        case (CurrState_drctCntl)
    `START_DC:
    `START_DC:
    begin
 
      NextState_drctCntl <= `CHK_DRCT_CNTL;
      NextState_drctCntl <= `CHK_DRCT_CNTL;
    end
 
    `CHK_DRCT_CNTL:
    `CHK_DRCT_CNTL:
    begin
 
      if (directControlEn == 1'b1)
      if (directControlEn == 1'b1)
      begin
      begin
        NextState_drctCntl <= `DRCT_CNTL_WAIT_GNT;
        NextState_drctCntl <= `DRCT_CNTL_WAIT_GNT;
        next_HCTxPortReq <= 1'b1;
        next_HCTxPortReq <= 1'b1;
      end
      end
      else
      else
      begin
      begin
        NextState_drctCntl <= `IDLE_WAIT_GNT;
        NextState_drctCntl <= `IDLE_WAIT_GNT;
        next_HCTxPortReq <= 1'b1;
        next_HCTxPortReq <= 1'b1;
      end
      end
    end
 
    `DRCT_CNTL_WAIT_GNT:
    `DRCT_CNTL_WAIT_GNT:
    begin
 
      if (HCTxPortGnt == 1'b1)
      if (HCTxPortGnt == 1'b1)
      begin
 
        NextState_drctCntl <= `DRCT_CNTL_WAIT_RDY;
        NextState_drctCntl <= `DRCT_CNTL_WAIT_RDY;
      end
 
    end
 
    `DRCT_CNTL_CHK_LOOP:
    `DRCT_CNTL_CHK_LOOP:
    begin
    begin
      next_HCTxPortWEn <= 1'b0;
      next_HCTxPortWEn <= 1'b0;
      if (directControlEn == 1'b0)
      if (directControlEn == 1'b0)
      begin
      begin
        NextState_drctCntl <= `CHK_DRCT_CNTL;
        NextState_drctCntl <= `CHK_DRCT_CNTL;
        next_HCTxPortReq <= 1'b0;
        next_HCTxPortReq <= 1'b0;
      end
      end
      else
      else
      begin
 
        NextState_drctCntl <= `DRCT_CNTL_WAIT_RDY;
        NextState_drctCntl <= `DRCT_CNTL_WAIT_RDY;
      end
      end
    end
 
    `DRCT_CNTL_WAIT_RDY:
    `DRCT_CNTL_WAIT_RDY:
    begin
 
      if (HCTxPortRdy == 1'b1)
      if (HCTxPortRdy == 1'b1)
      begin
      begin
        NextState_drctCntl <= `DRCT_CNTL_CHK_LOOP;
        NextState_drctCntl <= `DRCT_CNTL_CHK_LOOP;
        next_HCTxPortWEn <= 1'b1;
        next_HCTxPortWEn <= 1'b1;
        next_HCTxPortData <= {6'b000000, directControlLineState};
        next_HCTxPortData <= {6'b000000, directControlLineState};
        next_HCTxPortCntl <= `TX_DIRECT_CONTROL;
        next_HCTxPortCntl <= `TX_DIRECT_CONTROL;
      end
      end
    end
 
    `IDLE_FIN:
    `IDLE_FIN:
    begin
    begin
      next_HCTxPortWEn <= 1'b0;
      next_HCTxPortWEn <= 1'b0;
      next_HCTxPortReq <= 1'b0;
      next_HCTxPortReq <= 1'b0;
      NextState_drctCntl <= `CHK_DRCT_CNTL;
      NextState_drctCntl <= `CHK_DRCT_CNTL;
    end
    end
    `IDLE_WAIT_GNT:
    `IDLE_WAIT_GNT:
    begin
 
      if (HCTxPortGnt == 1'b1)
      if (HCTxPortGnt == 1'b1)
      begin
 
        NextState_drctCntl <= `IDLE_WAIT_RDY;
        NextState_drctCntl <= `IDLE_WAIT_RDY;
      end
 
    end
 
    `IDLE_WAIT_RDY:
    `IDLE_WAIT_RDY:
    begin
 
      if (HCTxPortRdy == 1'b1)
      if (HCTxPortRdy == 1'b1)
      begin
      begin
        NextState_drctCntl <= `IDLE_FIN;
        NextState_drctCntl <= `IDLE_FIN;
        next_HCTxPortWEn <= 1'b1;
        next_HCTxPortWEn <= 1'b1;
        next_HCTxPortData <= 8'h00;
        next_HCTxPortData <= 8'h00;
        next_HCTxPortCntl <= `TX_IDLE;
        next_HCTxPortCntl <= `TX_IDLE;
      end
      end
    end
 
  endcase
  endcase
end
end
 
 
 
//----------------------------------
// Current State Logic (sequential)
// Current State Logic (sequential)
 
//----------------------------------
always @ (posedge clk)
always @ (posedge clk)
begin
begin : drctCntl_CurrentState
  if (rst)
  if (rst)
    CurrState_drctCntl <= `START_DC;
    CurrState_drctCntl <= `START_DC;
  else
  else
    CurrState_drctCntl <= NextState_drctCntl;
    CurrState_drctCntl <= NextState_drctCntl;
end
end
 
 
 
//----------------------------------
// Registered outputs logic
// Registered outputs logic
 
//----------------------------------
always @ (posedge clk)
always @ (posedge clk)
begin
begin : drctCntl_RegOutput
  if (rst)
  if (rst)
  begin
  begin
    HCTxPortCntl <= 8'h00;
    HCTxPortCntl <= 8'h00;
    HCTxPortData <= 8'h00;
    HCTxPortData <= 8'h00;
    HCTxPortWEn <= 1'b0;
    HCTxPortWEn <= 1'b0;

powered by: WebSVN 2.1.0

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