FPGARelated.com
Forums

Ethernet PHY and Endianness

Started by Gints August 3, 2009
Good Afternoon,

I am writing a simple UDP core to send data from a Xilinx S3E to PC
via Ethernet sending UDP packets, and have a query relating to
endianness and the PHY: LAN83c185: http://www.smsc.com/media/Downloads_Public/Data_Sheets/83c185.pdf

My understanding is that the byte order is Big Endian, thus the most
significant byte first: Thus an IP would be sent:
C0 then A8 then 00 then 01 for the IP 192.168.0.1

I also read that each byte must be sent with the LEAST SIGNIFICANT
NIBBLE first: Thus in terms of nibbles, that IP would be:
0 then C then 8 then A then 0then 0 then 1 then 0

My confusion comes from the interface to the PHY. It is a 4 bit bus,
so I obviously have to send one nibble at a time.  I understand this
should be the least significant nibble of every byte followed by the
more significant nibble. My question is the BIT ORDER of each of the
nibbles. I understand that ethernet bitstream is the LEAST SIGNIFICANT
BIT of each byte. Basically I am not sure if I should send the nibble
for the PHY in its normal format, or if I should bit reverse it:

ie: For nibble A, do i send: "1010" to PHY pins 3:0, or do I send
"0101" to PHY pins 3:0. I cannot find out whether the PHY handles the
bit order of each nibble in the way it handles all the NRZI stuff etc.

Sorry for the poor wording, but I find endianness is one of things so
hard to explain etc.
Gints