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


module FxamNumber(FxamOut, Op1_Tag2Fxam, Operand2Fxam,TagWordIn2Fxam); 
 
input [79:0] Operand2Fxam; 
input [15:0] TagWordIn2Fxam; 
input [2:0]  Op1_Tag2Fxam; 
output[2:0]  FxamOut; 
 
reg[2:0] FxamOut; 
 
reg [79:0] Operand2chkNAN; 
reg [1:0]  Opsize; 
wire[3:0]  ResOut; 
 
Check4Nans chkNAN(ResOut, Operand2chkNAN, Opsize); 
 
always@( Op1_Tag2Fxam or Operand2Fxam or TagWordIn2Fxam or ResOut ) 
begin 
 
	case(Op1_Tag2Fxam) 
 
	3'd0: 
		begin 
			if(TagWordIn2Fxam[1:0] == 2'b11) 
				FxamOut = 3'b101;				// The register is empty 
			else 
			if(TagWordIn2Fxam[1:0] == 2'b01) 
				FxamOut = 3'b100;				// The operand is zero 
			else 
			begin 
				Operand2chkNAN = Operand2Fxam; 
				Opsize = 2'd2; 
 
				if(ResOut == 4'd2 || ResOut == 4'd3)		// The value is Normal finite 
					FxamOut = 3'b010; 
				else if(ResOut == 4'd4 || ResOut == 4'd5)	// The value is denormal finite 
					FxamOut = 3'b110; 
				else if(ResOut == 4'd6 || ResOut == 4'd7)	// The value is infinity 
					FxamOut = 3'b011; 
				else if(ResOut == 4'd8 || ResOut == 4'd9 || ResOut == 4'd10)	// The value is NaN 
					FxamOut = 3'b001; 
				else if(ResOut == 4'd0 || ResOut == 4'd1)	// The value is zero 
					FxamOut = 3'b100; 
				else 
					FxamOut = 3'b000;		// The value is in unsupported format 
			end 
		end 
	3'd1: 
		begin 
			if(TagWordIn2Fxam[3:2] == 2'b11) 
				FxamOut = 3'b101; 
			else 
			if(TagWordIn2Fxam[3:2] == 2'b01) 
				FxamOut = 3'b100; 
			else 
			begin 
				Operand2chkNAN = Operand2Fxam; 
				Opsize = 2'd2; 
 
				if(ResOut == 4'd2 || ResOut == 4'd3)		// The value is Normal finite 
					FxamOut = 3'b010; 
				else if(ResOut == 4'd4 || ResOut == 4'd5)	// The value is denormal finite 
					FxamOut = 3'b110; 
				else if(ResOut == 4'd6 || ResOut == 4'd7)	// The value is infinity 
					FxamOut = 3'b011; 
				else if(ResOut == 4'd8 || ResOut == 4'd9 || ResOut == 4'd10)	// The value is NaN 
					FxamOut = 3'b001; 
				else if(ResOut == 4'd0 || ResOut == 4'd1)	// The value is zero 
					FxamOut = 3'b100; 
				else 
					FxamOut = 3'b000;		// The value is in unsupported format 
			end 
		end 
	3'd2: 
		begin 
			if(TagWordIn2Fxam[5:4] == 2'b11) 
				FxamOut = 3'b101; 
			else 
			if(TagWordIn2Fxam[5:4] == 2'b01) 
				FxamOut = 3'b100; 
			else 
			begin 
				Operand2chkNAN = Operand2Fxam; 
				Opsize = 2'd2; 
 
				if(ResOut == 4'd2 || ResOut == 4'd3)		// The value is Normal finite 
					FxamOut = 3'b010; 
				else if(ResOut == 4'd4 || ResOut == 4'd5)	// The value is denormal finite 
					FxamOut = 3'b110; 
				else if(ResOut == 4'd6 || ResOut == 4'd7)	// The value is infinity 
					FxamOut = 3'b011; 
				else if(ResOut == 4'd8 || ResOut == 4'd9 || ResOut == 4'd10)	// The value is NaN 
					FxamOut = 3'b001; 
				else if(ResOut == 4'd0 || ResOut == 4'd1)	// The value is zero 
					FxamOut = 3'b100; 
				else 
					FxamOut = 3'b000;		// The value is in unsupported format 
			end 
		end 
	3'd3: 
		begin 
			if(TagWordIn2Fxam[7:6] == 2'b11) 
				FxamOut = 3'b101; 
			else 
			if(TagWordIn2Fxam[7:6] == 2'b01) 
				FxamOut = 3'b100; 
			else 
			begin 
				Operand2chkNAN = Operand2Fxam; 
				Opsize = 2'd2; 
 
				if(ResOut == 4'd2 || ResOut == 4'd3)		// The value is Normal finite 
					FxamOut = 3'b010; 
				else if(ResOut == 4'd4 || ResOut == 4'd5)	// The value is denormal finite 
					FxamOut = 3'b110; 
				else if(ResOut == 4'd6 || ResOut == 4'd7)	// The value is infinity 
					FxamOut = 3'b011; 
				else if(ResOut == 4'd8 || ResOut == 4'd9 || ResOut == 4'd10)	// The value is NaN 
					FxamOut = 3'b001; 
				else if(ResOut == 4'd0 || ResOut == 4'd1)	// The value is zero 
					FxamOut = 3'b100; 
				else 
					FxamOut = 3'b000;		// The value is in unsupported format 
			end 
		end 
 
	3'd4: 
		begin 
			if(TagWordIn2Fxam[9:8] == 2'b11) 
				FxamOut = 3'b101; 
			else 
			if(TagWordIn2Fxam[9:8] == 2'b01) 
				FxamOut = 3'b100; 
			else 
			begin 
				Operand2chkNAN = Operand2Fxam; 
				Opsize = 2'd2; 
 
				if(ResOut == 4'd2 || ResOut == 4'd3)		// The value is Normal finite 
					FxamOut = 3'b010; 
				else if(ResOut == 4'd4 || ResOut == 4'd5)	// The value is denormal finite 
					FxamOut = 3'b110; 
				else if(ResOut == 4'd6 || ResOut == 4'd7)	// The value is infinity 
					FxamOut = 3'b011; 
				else if(ResOut == 4'd8 || ResOut == 4'd9 || ResOut == 4'd10)	// The value is NaN 
					FxamOut = 3'b001; 
				else if(ResOut == 4'd0 || ResOut == 4'd1)	// The value is zero 
					FxamOut = 3'b100; 
				else 
					FxamOut = 3'b000;		// The value is in unsupported format 
			end 
		end 
	3'd5: 
		begin 
			if(TagWordIn2Fxam[11:10] == 2'b11) 
				FxamOut = 3'b101; 
			else 
			if(TagWordIn2Fxam[11:10] == 2'b01) 
				FxamOut = 3'b100; 
			else 
			begin 
				Operand2chkNAN = Operand2Fxam; 
				Opsize = 2'd2; 
 
				if(ResOut == 4'd2 || ResOut == 4'd3)		// The value is Normal finite 
					FxamOut = 3'b010; 
				else if(ResOut == 4'd4 || ResOut == 4'd5)	// The value is denormal finite 
					FxamOut = 3'b110; 
				else if(ResOut == 4'd6 || ResOut == 4'd7)	// The value is infinity 
					FxamOut = 3'b011; 
				else if(ResOut == 4'd8 || ResOut == 4'd9 || ResOut == 4'd10)	// The value is NaN 
					FxamOut = 3'b001; 
				else if(ResOut == 4'd0 || ResOut == 4'd1)	// The value is zero 
					FxamOut = 3'b100; 
				else 
					FxamOut = 3'b000;		// The value is in unsupported format 
			end 
		end 
 
	3'd6: 
		begin 
			if(TagWordIn2Fxam[13:12] == 2'b11) 
				FxamOut = 3'b101; 
			else 
			if(TagWordIn2Fxam[13:12] == 2'b01) 
				FxamOut = 3'b100; 
			else 
			begin 
				Operand2chkNAN = Operand2Fxam; 
				Opsize = 2'd2; 
 
				if(ResOut == 4'd2 || ResOut == 4'd3)		// The value is Normal finite 
					FxamOut = 3'b010; 
				else if(ResOut == 4'd4 || ResOut == 4'd5)	// The value is denormal finite 
					FxamOut = 3'b110; 
				else if(ResOut == 4'd6 || ResOut == 4'd7)	// The value is infinity 
					FxamOut = 3'b011; 
				else if(ResOut == 4'd8 || ResOut == 4'd9 || ResOut == 4'd10)	// The value is NaN 
					FxamOut = 3'b001; 
				else if(ResOut == 4'd0 || ResOut == 4'd1)	// The value is zero 
					FxamOut = 3'b100; 
				else 
					FxamOut = 3'b000;		// The value is in unsupported format 
			end 
		end 
	3'd7: 
		begin 
			if(TagWordIn2Fxam[15:14] == 2'b11) 
				FxamOut = 3'b101; 
			else 
			if(TagWordIn2Fxam[15:14] == 2'b01) 
				FxamOut = 3'b100; 
			else 
			begin 
				Operand2chkNAN = Operand2Fxam; 
				Opsize = 2'd2; 
 
				if(ResOut == 4'd2 || ResOut == 4'd3)		// The value is Normal finite 
					FxamOut = 3'b010; 
				else if(ResOut == 4'd4 || ResOut == 4'd5)	// The value is denormal finite 
					FxamOut = 3'b110; 
				else if(ResOut == 4'd6 || ResOut == 4'd7)	// The value is infinity 
					FxamOut = 3'b011; 
				else if(ResOut == 4'd8 || ResOut == 4'd9 || ResOut == 4'd10)	// The value is NaN 
					FxamOut = 3'b001; 
				else if(ResOut == 4'd0 || ResOut == 4'd1)	// The value is zero 
					FxamOut = 3'b100; 
				else 
					FxamOut = 3'b000;		// The value is in unsupported format 
			end 
		end 
	default: 
		begin 
			Operand2chkNAN = Operand2Fxam; 
			Opsize = 2'd2; 
			if(ResOut == 4'd2 || ResOut == 4'd3)		// The value is Normal finite 
				FxamOut = 3'b010; 
			else if(ResOut == 4'd4 || ResOut == 4'd5)	// The value is denormal finite 
				FxamOut = 3'b110; 
			else if(ResOut == 4'd6 || ResOut == 4'd7)	// The value is infinity 
				FxamOut = 3'b011; 
			else if(ResOut == 4'd8 || ResOut == 4'd9 || ResOut == 4'd10)	// The value is NaN 
				FxamOut = 3'b001; 
			else if(ResOut == 4'd0 || ResOut == 4'd1)	// The value is zero 
				FxamOut = 3'b100; 
			else 
				FxamOut = 3'b000;		// The value is in unsupported format 
			 
		end 
	endcase 
end 
endmodule