cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
dhcp_client.hpp File Reference

: Dynamic Host Configuration Protocol (DHCP) client. More...

#include <hls_stream.h>
#include "ap_int.h"
Include dependency graph for dhcp_client.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  DhcpMetaRep
 
struct  DhcpMetaReq
 
struct  SocketAddr
 
struct  UdpWord
 
struct  UdpMeta
 

Typedefs

typedef ap_uint< 16 > UdpPLen
 
typedef ap_uint< 16 > UdpPort
 
typedef bool AxisAck
 
typedef ap_uint< 1 > SigOpn
 

Enumerations

enum  DhcpOperationCode { DHCPDISCOVER = 0x01 , DHCPOFFER = 0x02 , DHCPREQUEST = 0x03 , DHCPACK = 0x05 }
 

Functions

void dhcp_client (ap_uint< 1 > &piMMIO_This_Enable, ap_uint< 48 > &piMMIO_This_MacAddress, ap_uint< 32 > &poTHIS_Nts_IpAddress, stream< AxisAck > &siUDMX_This_OpnAck, stream< UdpPort > &soTHIS_Udmx_OpnReq, stream< UdpWord > &siUDMX_This_Data, stream< UdpMeta > &siUDMX_This_Meta, stream< UdpWord > &soTHIS_Udmx_Data, stream< UdpMeta > &soTHIS_Udmx_Meta, stream< UdpPLen > &soTHIS_Udmx_PLen)
 Main process of the DHCP-client. More...
 

Detailed Description

: Dynamic Host Configuration Protocol (DHCP) client.

Copyright 2016 – 2021 IBM Corporation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Copyright (c) 2015, Xilinx, Inc.

All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

System: : cloudFPGA Component : Shell, Network Transport Stack (NTS) Language : Vivado HLS

Definition in file dhcp_client.hpp.

Typedef Documentation

◆ AxisAck

typedef bool AxisAck

Generic Streaming Interfaces.

Definition at line 151 of file dhcp_client.hpp.

◆ SigOpn

typedef ap_uint<1> SigOpn

Other Constants and Definitions.

Definition at line 157 of file dhcp_client.hpp.

◆ UdpPLen

typedef ap_uint<16> UdpPLen

Definition at line 142 of file dhcp_client.hpp.

◆ UdpPort

typedef ap_uint<16> UdpPort

Definition at line 144 of file dhcp_client.hpp.

Enumeration Type Documentation

◆ DhcpOperationCode

DHCP Specific Message Formats.

Enumerator
DHCPDISCOVER 
DHCPOFFER 
DHCPREQUEST 
DHCPACK 

Definition at line 86 of file dhcp_client.hpp.

86  { // Specifies the general type of message.
87  DHCPDISCOVER = 0x01, // An odd value indicates a request message.
88  DHCPOFFER = 0x02, // An even value indicates a reply message.
89  DHCPREQUEST = 0x03,
90  DHCPACK = 0x05
91 };
@ DHCPACK
Definition: dhcp_client.hpp:90
@ DHCPOFFER
Definition: dhcp_client.hpp:88
@ DHCPREQUEST
Definition: dhcp_client.hpp:89
@ DHCPDISCOVER
Definition: dhcp_client.hpp:87

Function Documentation

◆ dhcp_client()

void dhcp_client ( ap_uint< 1 > &  piMMIO_This_Enable,
ap_uint< 48 > &  piMMIO_This_MacAddress,
ap_uint< 32 > &  poTHIS_Nts_IpAddress,
stream< AxisAck > &  siUDMX_This_OpnAck,
stream< UdpPort > &  soTHIS_Udmx_OpnReq,
stream< UdpWord > &  siUDMX_This_Data,
stream< UdpMeta > &  siUDMX_This_Meta,
stream< UdpWord > &  soTHIS_Udmx_Data,
stream< UdpMeta > &  soTHIS_Udmx_Meta,
stream< UdpPort > &  soTHIS_Udmx_PLen 
)

Main process of the DHCP-client.

Parameters
[in]piMMIO_This_EnableEnable signal from MMIO.
[in]piMMIO_This_MacAddressMAC address from MMIO.
[out]poTHIS_Nts_IpAddressIPv4 address from this DHCP.
[in]siUDMX_This_OpnAckOpen port acknowledgment from UDP-Mux.
[out]soTHIS_Udmx_OpnReqOpen port request to UDP-Mux.
[in]siUDMX_This_DataData path from the UDP-Mux.
[in]siUDMX_This_MetaMetadata from the UDP-Mux.
[out]soTHIS_Udmx_DataData path to the UDP-Mux.
[out]soTHIS_Udmx_MetaMetadata to the UDP-Mux.
[out]soTHIS_Udmx_PLenPayload length to the UDP-Mux.
Returns
Nothing.

Definition at line 474 of file dhcp_client.cpp.

501 {
502 
503  //-- DIRECTIVES FOR THE INTERFACES ----------------------------------------
504  #pragma HLS INTERFACE ap_ctrl_none port=return
505 
506 
507 
508 
509 
511 #if defined(USE_DEPRECATED_DIRECTIVES)
512 
513  #pragma HLS INTERFACE ap_stable port=piMMIO_This_Enable
514  #pragma HLS INTERFACE ap_stable port=piMMIO_This_MacAddress
515 
516  #pragma HLS INTERFACE ap_none register port=poTHIS_Nts_IpAddress
517 
518  #pragma HLS resource core=AXI4Stream variable=siUDMX_This_OpnAck metadata="-bus_bundle siUDMX_This_OpnAck"
519  #pragma HLS resource core=AXI4Stream variable=soTHIS_Udmx_OpnReq metadata="-bus_bundle soTHIS_Udmx_OpnReq"
520 
521  #pragma HLS resource core=AXI4Stream variable=siUDMX_This_Data metadata="-bus_bundle siUDMX_This_Data"
522  #pragma HLS resource core=AXI4Stream variable=siUDMX_This_Meta metadata="-bus_bundle siUDMX_This_Meta"
523  #pragma HLS DATA_PACK variable=siUDMX_This_Meta
524 
525  #pragma HLS resource core=AXI4Stream variable=soTHIS_Udmx_Data metadata="-bus_bundle soTHIS_Udmx_Data"
526  #pragma HLS resource core=AXI4Stream variable=soTHIS_Udmx_Meta metadata="-bus_bundle soTHIS_Udmx_Meta"
527  #pragma HLS DATA_PACK variable=soTHIS_Udmx_Meta
528  #pragma HLS resource core=AXI4Stream variable=soTHIS_Udmx_PLen metadata="-bus_bundle soTHIS_Udmx_PLen"
529 
530 #else
531 
532  #pragma HLS INTERFACE ap_stable port=piMMIO_This_Enable
533  #pragma HLS INTERFACE ap_stable port=piMMIO_This_MacAddress
534 
535  #pragma HLS INTERFACE ap_none register port=poTHIS_Nts_IpAddress
536 
537  #pragma HLS INTERFACE axis register both port=siUDMX_This_OpnAck
538  #pragma HLS INTERFACE axis register both port=soTHIS_Udmx_OpnReq
539 
540  #pragma HLS INTERFACE axis register both port=siUDMX_This_Data
541  #pragma HLS INTERFACE axis register both port=siUDMX_This_Meta
542  #pragma HLS DATA_PACK variable=siUDMX_This_Meta instance=siUDMX_This_Meta
543 
544  #pragma HLS INTERFACE axis register both port=soTHIS_Udmx_Data
545  #pragma HLS INTERFACE axis register both port=soTHIS_Udmx_Meta
546  #pragma HLS DATA_PACK variable=soTHIS_Udmx_Meta instance=soTHIS_Udmx_Meta
547  #pragma HLS INTERFACE axis register both port=soTHIS_Udmx_PLen
548 
549 #endif
550 
551  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
552  #pragma HLS DATAFLOW
553 
554  //-- LOCAL STREAMS --------------------------------------------------------
555  static stream<SigOpn> sOpnToFsm_Signal ("sOpnToFsm_Signal");
556 
557  static stream<DhcpMetaRep> sRcvToFsm_MetaRepFifo ("sRcvToFsm_MetaRepFifo");
558  #pragma HLS stream variable=sRcvToFsm_MetaRepFifo depth=4
559  #pragma HLS DATA_PACK variable=sRcvToFsm_MetaRepFifo
560 
561  static stream<DhcpMetaReq> sFsmToSnd_MetaReqFifo ("sFsmToSnd_MetaReqFifo");
562  #pragma HLS stream variable=sFsmToSnd_MetaReqFifo depth=4
563  #pragma HLS DATA_PACK variable=sFsmToSnd_MetaReqFifo
564 
565  //-- PROCESS FUNCTIONS ----------------------------------------------------
566 
567  pOpnComm(piMMIO_This_Enable,
568  soTHIS_Udmx_OpnReq, siUDMX_This_OpnAck,
569  sOpnToFsm_Signal);
570 
571  pRcvMessage(siUDMX_This_Data, siUDMX_This_Meta,
572  sRcvToFsm_MetaRepFifo, piMMIO_This_MacAddress);
573 
574  pFsmCtrl(sOpnToFsm_Signal, piMMIO_This_Enable,
575  sRcvToFsm_MetaRepFifo, sFsmToSnd_MetaReqFifo,
576  poTHIS_Nts_IpAddress);
577 
578  pSndMessage(sFsmToSnd_MetaReqFifo,
579  soTHIS_Udmx_Data, soTHIS_Udmx_Meta, soTHIS_Udmx_PLen,
580  piMMIO_This_MacAddress);
581 }
void pFsmCtrl(stream< SigOpn > &siOpn_Signal, ap_uint< 1 > &piMMIO_Enable, stream< DhcpMetaRep > &siRcv_MsgFifo, stream< DhcpMetaReq > &soSnd_MsgFifo, ap_uint< 32 > &poNts_IpAddress)
Final state machine that controls the sending and reception of DHCP messages. to the.
void pSndMessage(stream< DhcpMetaReq > &siFsm_MetaReqFifo, stream< UdpWord > &soUDMX_Data, stream< UdpMeta > &soUDMX_Meta, stream< UdpPLen > &soUDMX_PLen, ap_uint< 48 > piMMIO_MacAddr)
Build a DHCP message from a meta-request information and send it out to the DHCP server.
void pRcvMessage(stream< UdpWord > &siUDMX_Data, stream< UdpMeta > &siUDMX_Meta, stream< DhcpMetaRep > &soFsm_MetaRepFifo, ap_uint< 48 > piMMIO_MacAddr)
Receive a message from the DHCP server and generate a meta-reply information for the FSM control proc...
void pOpnComm(ap_uint< 1 > &piMMIO_Enable, stream< ap_uint< 16 > > &soUDMX_OpnReq, stream< bool > &siUDMX_OpnAck, stream< SigOpn > &soFsm_Signal)
Open a communication end point. This corresponds somehow to the creation of a UDP socket at the clien...
Definition: dhcp_client.cpp:77
Here is the call graph for this function:
Here is the caller graph for this function: