csfiforptr.v 2.33 KB
/**************************************************************************
 *                                                                        *
 *               Copyright (C) 1994, Silicon Graphics, Inc.               *
 *                                                                        *
 *  These coded instructions, statements, and computer programs  contain  *
 *  unpublished  proprietary  information of Silicon Graphics, Inc., and  *
 *  are protected by Federal copyright  law.  They  may not be disclosed  *
 *  to  third  parties  or copied or duplicated in any form, in whole or  *
 *  in part, without the prior written consent of Silicon Graphics, Inc.  *
 *                                                                        *
 *************************************************************************/
// $Id: csfiforptr.v,v 1.1 2002/03/28 00:26:13 berndt Exp $
   /////////////////////////////////////////////////////////////////////////
   //
   // Project Reality
   //
   // module:      csfiforptr
   // description: contails logic clocked by gclk.  Rams are not included
   //   
   //
   // designer:    Mike M. Cai   8/11/94
   //
   /////////////////////////////////////////////////////////////////////////
module csfiforptr(   // outputs
      	       	     read_adrs,
	       	     base_adrs,
      	       	     // inputs
	       	     update_rptr,
	       	     one_word_cmd,
	       	     cmd_size,
	       	     reset_l, gclk
	       	     );
output [5:0]   read_adrs;
output [4:0]   base_adrs;
input 	       update_rptr, one_word_cmd;
input [4:0]    cmd_size;
input 	       reset_l, gclk;

reg [5:0]      read_adrs_reg;
wire [4:0]     base_adrs;
wire [5:0]     read_adrs;
reg [5:0]      r_addr_inc;

always @(posedge gclk or negedge reset_l)
      if (reset_l == 0)
      	 read_adrs_reg <= 6'h0;
      else
      	 begin
      	    // read pointer
	    r_addr_inc = one_word_cmd ? (read_adrs_reg + 6'h1) : 
	       	     	   (read_adrs_reg + {1'h0,cmd_size});
	    read_adrs_reg <= update_rptr ? r_addr_inc : read_adrs_reg;
/*     	    if (update_rptr)
      	       r_addr_inc = one_word_cmd ? 5'h1 : cmd_size;
      	    else
      	       r_addr_inc = 5'h0;
      	    read_adrs <= read_adrs + {1'h0, r_addr_inc};
*/
	 end

assign  base_adrs = read_adrs_reg[4:0];
assign  read_adrs = read_adrs_reg[5:0];

endmodule  //  csfiforptr