[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ethmac] control frame address check issue



I think I find a bug.
Please see eth_receivecontrol.v,section about AddressOk.
If DA is 48'h0180C2000001 or local MAC address,it is a valid control 
frame.
Think of the following exmple:
Suppose the local MAC address is 48'h00123456789a,But if the 
ingressive DA is 48'h008034007801.
AddressOk is asserted!  Isn't is?
We need to check the reserved multicast address and the local MAC 
address individually.

The following code will fix this bug.

//////////////////////////////////////////////////////////////////
//RMAddrOk:Reserved Multicast address OK
//
always @ (posedge MRxClk or posedge RxReset)
begin
  if(RxReset)
    begin
    	RMAddrOk    <= #Tp 1'b0;
    	LocalAddrOk <= #Tp 1'b0;
    	AddressOK   <= #Tp 1'b0;
    end
  else
  if(DetectionWindow & ByteCntEq0)
    begin
    	RMAddrOk    <= #Tp RxData[7:0] == ReservedMulticast[47:40];
    	LocalAddrOk <= #Tp RxData[7:0] == MAC[47:40];
    end 
  else
  if(DetectionWindow & ByteCntEq1)
    begin
    	RMAddrOk    <= #Tp RxData[7:0] == ReservedMulticast[39:32] 
& RMAddrOk;
    	LocalAddrOk <= #Tp RxData[7:0] == MAC[39:32] & 
LocalAddrOk;
    end    
  else
  if(DetectionWindow & ByteCntEq2)
    begin
    	RMAddrOk    <= #Tp RxData[7:0] == ReservedMulticast[31:24] 
& RMAddrOk;
    	LocalAddrOk <= #Tp RxData[7:0] == MAC[31:24] & 
LocalAddrOk;
    end    
  else
  if(DetectionWindow & ByteCntEq3)
    begin
    	RMAddrOk    <= #Tp RxData[7:0] == ReservedMulticast[23:16] 
& RMAddrOk;
    	LocalAddrOk <= #Tp RxData[7:0] == MAC[23:16] & 
LocalAddrOk;
    end     
  else
  if(DetectionWindow & ByteCntEq4)
    begin
    	RMAddrOk    <= #Tp RxData[7:0] == ReservedMulticast[15:8] 
& RMAddrOk;
    	LocalAddrOk <= #Tp RxData[7:0] == MAC[15:8] & LocalAddrOk;
    end    
  else
  if(DetectionWindow & ByteCntEq5)
    begin
    	RMAddrOk    <= #Tp RxData[7:0] == ReservedMulticast[7:0] & 
RMAddrOk;
    	LocalAddrOk <= #Tp RxData[7:0] == MAC[7:0] & LocalAddrOk;
    	AddressOK   <= #Tp RxData[7:0] == ReservedMulticast[7:0] & 
RMAddrOk  | RxData[7:0] == MAC[7:0] & LocalAddrOk;
    end    
  else
  if(ReceiveEnd)
    begin
    	RMAddrOk    <= #Tp 1'b0;
    	LocalAddrOk <= #Tp 1'b0;
    	AddressOK   <= #Tp 1'b0;
    end
end
--
To unsubscribe from ethmac mailing list please visit http://www.opencores.org/mailinglists.shtml