Did you use the correct reset value for the CRC (usaly 0xFFFFFFFF)?
I thing that the checksum that is included in the Ethernet packet is the
complement of thr CRC result, i.e. checksum = not CRC.
/Patrik
st wrote:
> [email protected] (Moti Cohen) wrote in message news:<[email protected] com>...
>
>>Hy all,
>>I'm currently implementing a receiver (vhdl) part of the ethernet mac
>>which is responsible for the MII interafce. I'm need an crc32
>>calculator (RTL) to check the FCS field. I've tried using the easics
>>crctoll in order to create the mechanism (for a 4 bit data input) but
>>it does not seems to work. does anyone have a working (rtl) vhdl
>>implementation for this block? or at least a detailed expalnation on
>>how to create it..?
>>Thanks in advance, Moti.
>
>
> Hi,
>
> I've developped, for my personnal needs, a crc software. I've took for
> inputs : g(x)=x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7
> + x5 + x4 + x2 + x + 1
> and 4 bits bus.
> The results are :
> -- x^32 + x^26 + x^23 + x^22 + x^16 + x^12 + x^11 + x^10 + x^8 + x^7
> + x^5 + x^4 + x^2 + x^1 + 1
> function fcrc(DIN : std_logic_vector(3 downto 0); CRC :
> std_logic_vector(31 downto 0))
> return std_logic_vector is
> variable RESUL : std_logic_vector(31 downto 0);
> begin
> RESUL( 0):=CRC(28) xor DIN(0);
> RESUL( 1):=CRC(28) xor CRC(29) xor DIN(0) xor DIN(1);
> RESUL( 2):=CRC(28) xor CRC(29) xor CRC(30) xor DIN(0) xor DIN(1)
> xor DIN(2);
> RESUL( 3):=CRC(29) xor CRC(30) xor CRC(31) xor DIN(1) xor DIN(2)
> xor DIN(3);
> RESUL( 4):=CRC(0) xor CRC(28) xor CRC(30) xor CRC(31) xor DIN(0)
> xor DIN(2) xor DIN(3);
> RESUL( 5):=CRC(1) xor CRC(28) xor CRC(29) xor CRC(31) xor DIN(0)
> xor DIN(1) xor DIN(3);
> RESUL( 6):=CRC(2) xor CRC(29) xor CRC(30) xor DIN(1) xor DIN(2);
> RESUL( 7):=CRC(3) xor CRC(28) xor CRC(30) xor CRC(31) xor DIN(0)
> xor DIN(2) xor DIN(3);
> RESUL( 8):=CRC(4) xor CRC(28) xor CRC(29) xor CRC(31) xor DIN(0)
> xor DIN(1) xor DIN(3);
> RESUL( 9):=CRC(5) xor CRC(29) xor CRC(30) xor DIN(1) xor DIN(2);
> RESUL(10):=CRC(6) xor CRC(28) xor CRC(30) xor CRC(31) xor DIN(0)
> xor DIN(2) xor DIN(3);
> RESUL(11):=CRC(7) xor CRC(28) xor CRC(29) xor CRC(31) xor DIN(0)
> xor DIN(1) xor DIN(3);
> RESUL(12):=CRC(8) xor CRC(28) xor CRC(29) xor CRC(30) xor DIN(0)
> xor DIN(1) xor DIN(2);
> RESUL(13):=CRC(9) xor CRC(29) xor CRC(30) xor CRC(31) xor DIN(1)
> xor DIN(2) xor DIN(3);
> RESUL(14):=CRC(10) xor CRC(30) xor CRC(31) xor DIN(2) xor DIN(3);
> RESUL(15):=CRC(11) xor CRC(31) xor DIN(3);
> RESUL(16):=CRC(12) xor CRC(28) xor DIN(0);
> RESUL(17):=CRC(13) xor CRC(29) xor DIN(1);
> RESUL(18):=CRC(14) xor CRC(30) xor DIN(2);
> RESUL(19):=CRC(15) xor CRC(31) xor DIN(3);
> RESUL(20):=CRC(16);
> RESUL(21):=CRC(17);
> RESUL(22):=CRC(18) xor CRC(28) xor DIN(0);
> RESUL(23):=CRC(19) xor CRC(28) xor CRC(29) xor DIN(0) xor DIN(1);
> RESUL(24):=CRC(20) xor CRC(29) xor CRC(30) xor DIN(1) xor DIN(2);
> RESUL(25):=CRC(21) xor CRC(30) xor CRC(31) xor DIN(2) xor DIN(3);
> RESUL(26):=CRC(22) xor CRC(28) xor CRC(31) xor DIN(0) xor DIN(3);
> RESUL(27):=CRC(23) xor CRC(29) xor DIN(1);
> RESUL(28):=CRC(24) xor CRC(30) xor DIN(2);
> RESUL(29):=CRC(25) xor CRC(31) xor DIN(3);
> RESUL(30):=CRC(26);
> RESUL(31):=CRC(27);
> return RESUL;
> end fcrc;
> Tell me (in the news group) if it's ok.
--
------
Patrik Eriksson