Changes to ethernet.v:

    parameter UDP_PORT_AE4JY_SNDP = 16'd48321;      // Simple Network Discovery Protocol by AE4JY

    // Our name and serial number for use by the AE4JY Simple Network Discovery protocol
    parameter SNDP_NAME     = {56'd0, "1", "v", "-", "R", "D", "S", "Q", "i", "H"}; // Note byte reversal
    parameter SNDP_SERIAL   = {96'd0, "0", "0", "0", "1"}; // Note byte reversal

    parameter sRxSndpA      = 8'd100;   // Simple Network Discovery Protocol by AE4JY
    parameter sRxSndpB      = 8'd101;
    parameter sRxSndpC      = 8'd102;
    parameter sRxSndpD      = 8'd103;
    parameter sRxSndpE      = 8'd104;

	parameter ETH_BUF_SIZE	= 108;				// size in bytes of the buffer; must be even by 4

///////// Use these registers instead of the parameters IP_ADDRESS and MAC_ADDRESS
    reg [31:0] ip_address;   // Our IP address
    reg [47:0] mac_address;  // Our MAC address
	initial
	begin
		ip_address = {IP4, IP3, IP2, IP1};
        mac_address = {MAC6, MAC5, MAC4, MAC3, MAC2, MAC1};
	end


			sRxPacketD:	// END LOOP; examine packet in buffer
			begin
				return_state <= sIdle;
				send_is_adc <= 1'd0;		
				if (rx_status[15] == 1)		// error bit
					state <= sRxSkip;
				else if (rx_status[13] == 1 &&		// broadcast packet
                        `EthType == 16'h0806)		// type 0x0806 is ARP
						state <= sRxArp;
				else if (`EthType == 16'h0800 &&		// type 0x0800 is IP
						`EthIpVer == 8'h45)
					state <= sRxIp;
				else
					state <= sRxSkip;
			end


			sRxIpA:
			begin
				ip_in_buffer <= (ip_end_byte <= ETH_BUF_SIZE);
				return_state <= sIdle;			
				if (checksum[15:0] == 16'hFFFF)		// checksum succeeds
				begin
					if (`EthIpProtocol == 8'h01 &&     // IP protocol 0x01 is ICMP
						`EthIpDest == ip_address)
						state <= sRxIcmp;
					else if (`EthIpProtocol == 8'h11 &&     // IP protocol 0x11 is UDP
						`EthIpDest == ip_address)
						state <= sRxUdp;
					else if (`EthIpProtocol == 8'h11 &&             // IP protocol 0x11 is UDP
                        rx_status[13] == 1 &&       	        	// broadcast packet
				        `EthUdpDestPort == UDP_PORT_AE4JY_SNDP)     // check UDP port
						state <= sRxSndpA;
					else
						state <= sRxSkip;
				end
				else
				begin
					state <= sRxSkip;
				end
			end			


			sRxIcmpA:
			begin
				eth_buf_data[8 * 36 +: 16] <= ~ checksum[15:0];
				return_state <= sSendIp;
				state <= sRxSkip;					
			end
            sRxSndpA:		// We have a UDP packet with the broadcast address ending at udp_end_byte
            begin
                if ( ! ip_in_buffer)     // packet does not fit in buffer
				begin
					return_state <= sIdle;					
					state <= sRxSkip;
				end
                else if (eth_buf_data[8 * 44 +: 8] == 8'h5A && eth_buf_data[8 * 45 +: 8] == 8'hA5)   // required key
				begin		// calculate checksum
					checksum <= 16'h1100 + eth_buf_data[8 * 38 +: 16];
					eth_buf_addr <= 26;				
					eth_buf_addr2 <= udp_end_byte[ETH_BUF_ABITS-1:0];
					return_state <= sRxSndpB;					
					state <= sBufChecksum;		
				end
				else
				begin
					return_state <= sIdle;					
					state <= sIdle;
				end
            end
			sRxSndpB:
			begin
				if ( ! (checksum[15:0] == 16'hFFFF || checksum[15:0] == 16'h0000))	// checksum fails
					state <= sIdle;			
                else if (eth_buf_data[8 * 46 +: 8] == 8'd0)
                    state <= sRxSndpC;
                else if (eth_buf_data[8 * 46 +: 8] == 8'd2)
                    state <= sRxSndpD;
				else				
					state <= sIdle;			
			end
			sRxSndpC:       // operation is request
			begin
                if ( ! (eth_buf_data[8 * 47 +: 8] == 8'd0 || eth_buf_data[8 * 47 +: 128] == SNDP_NAME))
					state <= sIdle;			
                else if ( ! (eth_buf_data[8 * 63 +: 8] == 8'd0 || eth_buf_data[8 * 63 +: 128] == SNDP_SERIAL))
					state <= sIdle;			
                else
                begin
                    eth_buf_data[8 * 46 +: 8] <= 8'd1;
                    eth_buf_data[8 * 47 +: 128] <= SNDP_NAME;
                    eth_buf_data[8 * 63 +: 128] <= SNDP_SERIAL;
                    eth_buf_data[8 * 79 +: 128] <= {96'd0, ip_address[7:0], ip_address[15:8], ip_address[23:16], ip_address[31:24]};
                    eth_buf_data[8 * 95 +: 16] <= UDP_PORT_ADC;
                    eth_buf_data[8 * 97 +: 8] <= 8'd0;
					state <= sRxSndpE;			
                end
			end
			sRxSndpD:       // Operation is set
			begin
                if ( ! (eth_buf_data[8 * 47 +: 128] == SNDP_NAME))
					state <= sIdle;			
                else if ( ! (eth_buf_data[8 * 63 +: 128] == SNDP_SERIAL))
					state <= sIdle;			
                else
                begin
                    eth_buf_data[8 * 46 +: 8] <= 8'd1;
                    eth_buf_data[8 * 47 +: 128] <= SNDP_NAME;
                    eth_buf_data[8 * 63 +: 128] <= SNDP_SERIAL;
		            ip_address[31:24] <= eth_buf_data[8 * 79 +: 8];
		            ip_address[23:16] <= eth_buf_data[8 * 80 +: 8];
		            ip_address[15:8] <= eth_buf_data[8 * 81 +: 8];
		            ip_address[7:0] <= eth_buf_data[8 * 82 +: 8];
                    eth_buf_data[8 * 95 +: 16] <= UDP_PORT_ADC;
                    eth_buf_data[8 * 97 +: 8] <= 8'd0;
					state <= sRxSndpE;			
                end
			end
			sRxSndpE:       // Send back our response
			begin
				`EthUdpDestPort <= `EthUdpSourcePort;
				`EthMacDest <= `EthMacSource;	// reverse MAC and IP addresses
				`EthIpDest <= `EthIpSource;
				`EthUdpSourcePort <= UDP_PORT_AE4JY_SNDP;
				send_size <= udp_end_byte[ETH_BUF_ABITS-1:0];
				state <= sSendUdp;
			end
			sRxUdp:		// We have a UDP packet with our address ending at udp_end_byte	
