FPGARelated.com
Forums

where is the IP address assigned to the fpga in Trimode Ethernet MAC Core???

Started by Ambreen Ashfaq Afridi June 10, 2008
I have to use the Trimode Ethernet MAC core for my FPGA project, which
will send and recieve data while connected to LAN though an Ethernet
cable. For that obviously some IP address should be assigned to the
FPGA, I couldn't find the part of code where this is happening ... Can
anyone help me identify that part of code where IP address assignment
is taking place?

I'm using Xilinx Application Notes, XAPP443.

http://www.xilinx.com/support/documentation/application_notes.htm

I really need help, immediately.
Ambreen Ashfaq Afridi wrote:
> I have to use the Trimode Ethernet MAC core for my FPGA project, which > will send and recieve data while connected to LAN though an Ethernet > cable. For that obviously some IP address should be assigned to the > FPGA, I couldn't find the part of code where this is happening ... Can > anyone help me identify that part of code where IP address assignment > is taking place?
From the description, it doesn't sound like it should have an IP address. Ethernet MAC addresses are 48 bit addresses, independent of IP addressing. Is it the MAC address you are trying to locate? You will need an IP stack as well as Ethernet to communicate via IP. RL
Ambreen Ashfaq Afridi wrote:

> I have to use the Trimode Ethernet MAC core for my FPGA project, which > will send and recieve data while connected to LAN though an Ethernet > cable. For that obviously some IP address should be assigned to the > FPGA, I couldn't find the part of code where this is happening ... Can > anyone help me identify that part of code where IP address assignment > is taking place?
Usually that would be done in software outside the FPGA. In some cases you can assign a static address, but DHCP would be nice. Much easier to do in software in a simple processor. It only needs to be done once (get a long lease from DHCP). Another way is putting an entry into ARP on another host with your hosts MAC address as the destination. Then all you need to do is accept any data coming in. You can exchange the MAC and IP addresses before sending the data back, easiest for UDP. -- glen
> I have to use the Trimode Ethernet MAC core for my FPGA project, which=
> will send and recieve data while connected to LAN though an Ethernet > cable. For that obviously some IP address should be assigned to the > FPGA, I couldn't find the part of code where this is happening ... Can=
> anyone help me identify that part of code where IP address assignment > is taking place?
An Ethernet MAC does not know about IP addresses, only Ethernet MAC = addresses. Ethernet sees IP packets as just data with a label that says = = "protocol=3DIP", it does not use the IP address in any way. Ethernet rou= ting = is based on the MAC address. Now your PC which is on Ethernet uses the ARP protocol to query the = network for "which is the MAC address of the machine with IP xx.xx.xx.xx= = ?", it is a broadcast packet that all machines receive and the one which= = feels concerned responds. So as a first step you can set an entry in the ARP cache on your PC (on= = Linux use command arp) to tell the PC that your FPGA's IP corresponds to= = its MAC address. You should chose the IP yourself, something like = 192.168.0.xx if your network is in the 192.168.0.xx form. Once you do that the PC will set the packets' destination address to th= e = right value and your FPGA's MAC will see it and understand that the = packets are targeted at it. Then use an IP stack with ARP to automate this process.
but i'm supposed to work until the 2nd layer i.e data link layer...so
i'll only be needing MAc addresses right?
>but i'm supposed to work until the 2nd layer i.e data link layer...so >i'll only be needing MAc addresses right? >
Assuming that they haven't been mis-edited recently, http://en.wikipedia.org/wiki/Address_Resolution_Protocol and the articles it references should tell you what you need to know...
PFC wrote:
(snip)

> An Ethernet MAC does not know about IP addresses, only Ethernet MAC > addresses. Ethernet sees IP packets as just data with a label that says > "protocol=IP", it does not use the IP address in any way. Ethernet > routing is based on the MAC address.
That is , a type of X'0800'
> Now your PC which is on Ethernet uses the ARP protocol to query the > network for "which is the MAC address of the machine with IP > xx.xx.xx.xx ?", it is a broadcast packet that all machines receive and > the one which feels concerned responds.
Yes, but when you construct a UDP packet with IP header you still have to get the IP address into the packet. It should be possible to do all that with FPGA logic (and a medium sized state machine). -- glen