/////// Back-Off Calculation for GMAC /////////
if ( back_off_enable )
begin
// 32 bit crc polynomial...lfsr
// taps for lfsr [32,26,23,22,16,12,11,10,8,7,5,4,2,1,0] as per IEEE 802.3
lfsr_32[0] = lfsr_32[31];
lfsr_32[1] = lfsr_32[0] ^ lfsr_32[31];
lfsr_32[2] = lfsr_32[1] ^ lfsr_32[31];
lfsr_32[3] = lfsr_32[2];
lfsr_32[4] = lfsr_32[3] ^ lfsr_32[31];
lfsr_32[5] = lfsr_32[4] ^ lfsr_32[31];
lfsr_32[6] = lfsr_32[5] ;
lfsr_32[7] = lfsr_32[6] ^ lfsr_32[31];
lfsr_32[8] = lfsr_32[7] ^ lfsr_32[31];
lfsr_32[9] = lfsr_32[8];
lfsr_32[10] = lfsr_32[9] ^ lfsr_32[31];
lfsr_32[11] = lfsr_32[10] ^ lfsr_32[31];
lfsr_32[12] = lfsr_32[11] ^ lfsr_32[31];
lfsr_32[13:15] = lfsr_32[12:14];
lfsr_32[16] = lfsr_32[15] ^ lfsr_32[31];
lfsr_32[17:21] = lfsr_32[16:20];
lfsr_32[22] = lfsr_32[21] ^ lfsr_32[31];
lfsr_32[23] = lfsr_32[22] ^ lfsr_32[31];
lfsr_32[24:25] = lfsr_32[23:24];
lfsr_32[26] = lfsr_32[25] ^ lfsr_32[31];
lfsr_32[27:31] = lfsr_32[26:30];
end
end
end
always @ ( retrans_atempt or lfsr_32 )
begin : backoff_time
case( retxn_atmpt )
5'd1 : begin
back_off_time_tmp[9] = lfsr_32[0];
back_off_time_tmp[8:0] = 9'd 0;
end
5'd2 : begin
back_off_time_tmp[8:9] = lfsr_32[0:1];
back_off_time_tmp[7:0] = 8'd 0;
end
5'd3 : begin
back_off_time_tmp [7:9] = lfsr_32[0:2];
back_off_time_tmp[6:0] = 7'd 0;
end
5'd4 : begin
back_off_time_tmp[6:9] = lfsr_32[0:3];
back_off_time_tmp[5:0] = 6'd 0;
end
5'd5 : begin
back_off_time_tmp[5:9] = lfsr_32[0:4];
back_off_time_tmp[4:0] = 5'd 0;
end
5'd6 : begin
back_off_time_tmp[4:9] = lfsr_32[0:5];
back_off_time_tmp[3:0] = 4'd 0;
end
5'd7 : begin
back_off_time_tmp[3:9] = lfsr_32[0:6];
back_off_time_tmp[2:0] = 3'd 0;
end
5'd8 : begin
back_off_time_tmp[2:9] = lfsr_32[0:7];
back_off_time_tmp[1:0] = 2'd 0;
end
5'd9 : begin
back_off_time_tmp[1:9] = lfsr_32[0:8];
back_off_time_tmp[0] = 1'd 0;
end
5'd10,5'd11,5'd12,5'd13,5'd14,5'd15,
5'd16: back_off_time_tmp [9:0] = lfsr_32[9:0];
default : back_off_time_tmp [9:0] = 10'd 0;
endcase
end