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

[ethmac] CRC appending




Recently when simulating the MAC i noticed a problem. I had the MAC set up
to NOT append FCS but it was appending it.  I started going through the code
and i think i found the problem to correct this.

In eth_txstatem.v you are assigning your StartFCS signal.  the line says

assign StartFCS = ~Collision & StateData[1] & TxEndFrm & (~Pad & CrcEn | Pad
& NibbleMinFl)
                | ~Collision & StatePAD & NibbleMinFl;

This, from what i can tell, is incorrect and here is why.  First of all to
anyalize this we can assume that we are not going to have a collision and
that both StateData[1] and TxEndFrm will be valid ('1') at some point and
therefore we dont need to look at them so we just concentrate on:
 
(~Pad & CrcEn | Pad & NibbleMinFl)| StatePAD & NibbleMinFl

So the behavior that we would want is that if i do not want to append a CRC
that StartFCS should never be a 1.  In my simulation i want to Pad so the
Pad signal will be a '1' and in the Mode register i tell it to not append
CRC and when i write the control register of the particular BD for Transmit
i also tell it to not append CRC.  This makes CrcEn a '0'  Now as you can
see from the above statement that if i am padding and i recive a packet
smaller than minimum packet length it will Make StartFCS a '1' when it
finishing padding (denoted by the NibbleMinFl varible that is only a '1' if
the packet is the minumum packet length).  This means that no matter what my
CrcEn is if i am padding and i recive a packet that needs to be padded i
will append an FCS.  To make this correct i belive it should be.

assign StartFCS = (~Collision & StateData[1] & TxEndFrm & (~Pad | Pad &
NibbleMinFl)
                | ~Collision & StatePAD & NibbleMinFl) & CrcEn;

This will only append the FCS if we have set the appropriate things to make
CrcEn a '1'.  I also wonder if you need the (| ~Collision & StatePAD &
NibbleMinFl) portion of that because it would seam that you said the same
thing with your Pad & NibbleMinFl statement, but i would have to investigate
that further to see if it is the truth.

Matt Lake
--
To unsubscribe from ethmac mailing list please visit http://www.opencores.org/mailinglists.shtml