/******************************************************************************/ 
/*                                                                            */ 
/* Copyright (c) 1999 Sun Microsystems, Inc. All rights reserved.             */ 
/*                                                                            */ 
/* The contents of this file are subject to the current version of the Sun    */ 
/* Community Source License, microSPARCII ("the License"). You may not use    */ 
/* this file except in compliance with the License.  You may obtain a copy    */ 
/* of the License by searching for "Sun Community Source License" on the      */ 
/* World Wide Web at http://www.sun.com. See the License for the rights,      */ 
/* obligations, and limitations governing use of the contents of this file.   */ 
/*                                                                            */ 
/* Sun Microsystems, Inc. has intellectual property rights relating to the    */ 
/* technology embodied in these files. In particular, and without limitation, */ 
/* these intellectual property rights may include one or more U.S. patents,   */ 
/* foreign patents, or pending applications.                                  */ 
/*                                                                            */ 
/* Sun, Sun Microsystems, the Sun logo, all Sun-based trademarks and logos,   */ 
/* Solaris, Java and all Java-based trademarks and logos are trademarks or    */ 
/* registered trademarks of Sun Microsystems, Inc. in the United States and   */ 
/* other countries. microSPARC is a trademark or registered trademark of      */ 
/* SPARC International, Inc. All SPARC trademarks are used under license and  */ 
/* are trademarks or registered trademarks of SPARC International, Inc. in    */ 
/* the United States and other countries. Products bearing SPARC trademarks   */ 
/* are based upon an architecture developed by Sun Microsystems, Inc.         */ 
/*                                                                            */ 
/******************************************************************************/ 
/****************************************************************************
 * @(#)pack_sm.v	1.7 2/19/96
 * pack_sm.v
 *
 *      Description:
 *              This is the afxmaster write packing state machine for the 
 *		Falcon pci bridge.  It packs 32-bit DMA write data into 
 *		double-word (64-bit) data for efficient bursting on AFX bus.
 *		It keeps packing until either trcv's are full or pci slave 
 *		is done receiving posted write data.
 *
 *
 *              This module is instantiated by the afxmaster.v module.
 *              
 *
 *
 ****************************************************************************/
`define PACK_IDLE  2'b00
`define DO_PACK	   2'b01
`define PACK_DONE  2'b11
`timescale      1ns/1ns
module pack_sm
 (pack_idle, pack_done, 
		gclk, reset_l, start_pack, trcv_full, 
		pci_mem_wrt_g, cmd_start_g, xfer_done);
    output pack_idle
;   		// data packing state machine idle
    output pack_done
;   		// data packing done, write proceed
    input gclk
;         		// gclk
    input reset_l
;      		// system or PCI reset_l
    input start_pack
;      		// rcv_fifo_empty & pack_idle
    input trcv_full
;      		// trcv1_full | trcv2_full 
    input pci_mem_wrt_g
;      		// it's a DMA write in progress on PCI 
    input cmd_start_g
;      		// PCI command still in progress
    input xfer_done
;      		// write done afxm_sm just went idle
    wire  [1:0] pack_state
;			// curr state of packer sm
function [1:0] packer_sm;
    input  [1:0] pack_state;
    input start_pack;
    input trcv_full;
    input pci_mem_wrt_g;
    input cmd_start_g;
    input xfer_done;
    input reset_l;
    reg  [1:0] pack_ns;		// next_state
    begin
      if (~reset_l) begin
        pack_ns = `PACK_IDLE;
      end
      else begin
        pack_ns = pack_state;
   	case (pack_state)
	    `PACK_IDLE: begin
                  if (start_pack)
                      pack_ns = `DO_PACK;  
                  else
                      pack_ns = `PACK_IDLE;  
		  end
	    `DO_PACK: begin
                  if (~trcv_full & 
                      pci_mem_wrt_g & cmd_start_g) 
                      pack_ns = `DO_PACK;  
                  else 
                      pack_ns = `PACK_DONE;   
		end
	    `PACK_DONE: begin
		  if (xfer_done) 
                      pack_ns = `PACK_IDLE;   
                  else 
                      pack_ns = `PACK_DONE;   
		end
	    default: begin
                      pack_ns = `PACK_IDLE;   
		//synopsys translate_off
		if (reset_l) $display("pack_sm:  Error!");
		//synopsys translate_on
	        end
   	endcase 
     end
     packer_sm = pack_ns;
    end
endfunction
reg  [1:0] sm_output
;
always @(posedge gclk) begin
    sm_output <= #1 packer_sm(pack_state, start_pack, trcv_full,
			pci_mem_wrt_g, cmd_start_g, xfer_done, reset_l);
end
assign pack_state = sm_output;
wire pack_idle = (pack_state==`PACK_IDLE);
wire pack_done = (pack_state==`PACK_DONE);
endmodule
 | This page: | 
  Created: | Thu Aug 19 12:01:36 1999 | 
   | From: | 
../../../sparc_v8/ssparc/pcic/afxmaster/rtl/pack_sm.v
 |