www.pudn.com > x86.rar > Register_XMM.v, change:2007-12-05,size:1243b


module Register_XMM(clk,reset,enable,read,write,opsize,data_in,data_out); 
parameter REG_SIZE = 127 ; 
parameter ZERO = 0 ; 
 
output	[REG_SIZE:ZERO] data_out ;  //data bus 
input	[REG_SIZE:ZERO] data_in ;   //data bus 
reg [127 :0] data_out; 
input	enable; 
input read; 
input write; 
input reset; 
input clk; 
input [1:0] opsize;//for 32/64/128 
wire    [127:0] tempzero; 
reg 	[127:0] content  ; 
 
assign     tempzero = 128'h0; 
//assign tempzero={128{1'b0}}; 
 
//Write at negative edge of the clock 
always @ (posedge reset or negedge clk) 
begin 
	if (reset == 1) 
	    begin 
		content  <= tempzero; 
		data_out <= 128'bz; 
	    end 
       else 
	 
	  if(write & enable ) 
               begin 
	   
                 case(opsize) 
                  2'b11:content <= {content[79:32] , data_in[31:0]}; // writing 32 bit 
		  2'b00:content <= {content[79:64] , data_in[63:0]}; // writing 64 bit 
		  2'b01:content <= data_in ;  // writing 128 bits 
                 endcase 
	       end 
	     
end 
 
//Read 
always @( read or enable or content ) 
begin 
	   if(read & enable) 
                data_out <= content; // writing contents to data_out line 128 bit. 
            else 
              	data_out <= 128'bz; 
end 
		 
endmodule