Fakernet - FPGA gateware for TCP/IP data source and UDP control

General Information

Fakernet is a fast FPGA-based TCP/IP data source with UDP control channels.
The FPGA board needs a PHY interface. No special kernel/OS drivers are needed.
The network connection to a controlling computer uses ordinary Ethernet equipment.
Typical use case: data acquisition.

Type
Special-purpose gateware and software.
Language
Gateware: VHDL. Helper library: C.
License
Fakernet is free software; distributed under the 3-clause BSD license.
See the accompanying LICENSE file.
Main developers
Håkan T. Johansson and Anders Furufors, Chalmers University of Technology, Sweden. Discussions: Philipp Klenze, Technische Universität München,
Distributor
Experimental subatomic physics group, Chalmers University of Technology, Sweden.
Acknowledgment
The research leading to these results was supported by the Swedish Research Council: the Scientific Council for Natural and Engineering Sciences under grant 2017-03839 and the Council for Research infrastructure under grant 822-2014-6644.
Reference
The recommended way to refer to Fakernet, when used for work that is published in a research article, is to cite the following paper:
H. T. Johansson, A. Furufors and P. Klenze, Fakernet - small and fast FPGA-based TCP and UDP communication. Pre-print (2020) at arXiv:2003.12527

Download

Location
http://fy.chalmers.se/~f96hajo/fakernet/fakernet-0.9.7.tar.gz
Contact
Håkan T. Johansson (f96hajo@chalmers.se)
Version
0.9.7 (CHANGELOG)
Support
No formal support.
Repository
https://gitlab.com/inkdot7/fakernet

Documentation

See README (included with download).

A short slide-show presentation.

Another short slide-show presentation.

Testing with a Arty A7-35 board (100 Mbps).

NTP server with a Arty A7-35 board and GPS.

0.5 ns signal sampler with a Arty A7-35 board.

Direct LMD data generation for DAQ or analysis consumption.

Testing with a ALINX AX7101 board (1 Gbps).

Interfaces

FPGA module in VHDL
The Fakernet module receive and deliver packet data from and to the PHY.
The UDP control interface exposes a register read-write interface.
Data to be transmitted over TCP is committed to an internal buffer.
entity fakernet_module is
  generic (-- Size of output (TCP) data buffer
           data_bufsize_addrbits : natural);
  port (clk            : in  std_logic;
        -- Config
        cfg_macaddr    : in  std_logic_vector (47 downto 0);
        cfg_ipaddr     : in  std_logic_vector (31 downto 0);
        -- Input network traffic
        in_word        : in  std_logic_vector(15 downto 0);
        in_got_word    : in  std_logic;
        in_new_packet  : in  std_logic;
        -- Output network traffic
        out_word       : out std_logic_vector(15 downto 0);
        out_ena        : out std_logic;
        out_payload    : out std_logic;
        out_taken      : in  std_logic;
        -- Register access interface (UDP access)
        reg_addr       : out std_logic_vector(24 downto 0);
        reg_data_wr    : out std_logic_vector(31 downto 0);
        reg_data_rd    : in  std_logic_vector(31 downto 0);
        reg_write      : out std_logic;
        reg_read       : out std_logic;
        reg_done       : in  std_logic;
        reg_cnt        : out std_logic_vector(3 downto 0);
        -- Data input interface (for TCP stream)
        data_word      : in  std_logic_vector(31 downto 0);
        data_offset    : in  std_logic_vector;
        data_write     : in  std_logic;
        data_commit_len: in  std_logic_vector;
        data_commit    : in  std_logic;
        data_free      : out std_logic;
        tcp_reset      : out std_logic;
        -- Signals to drive RTT estimate and timeouts
        slow_clock_tick     : in std_logic;
        timeout_tick        : in std_logic;
        );
end;
UDP communication functions in C
The most important functions, with their major arguments:
/* Establish UDP connection. */
struct fnet_ctrl_client *
  fnet_ctrl_connect(const char *server,
                    int reliable);

/* Close connection. */
int
  fnet_ctrl_close(struct fnet_ctrl_client *client);

/* Retrieve pointers to prepare UDP register access. */
void
  fnet_ctrl_get_send_recv_bufs(struct fnet_ctrl_client *client,
                               fakernet_reg_acc_item **send,
                               fakernet_reg_acc_item **recv);

/* Perform UDP register access. */
int
  fnet_ctrl_send_recv_regacc(struct fnet_ctrl_client *client,
                             int num_items);

/* Reset TCP connection (done via UDP). */
int
  fnet_ctrl_reset_tcp(struct fnet_ctrl_client *client);
TCP stream reading
The data stream is read using normal read() calls, pseudo-code:
fd = socket(TCP);
connect(fd, ip4_addr);
for ( ; ; )
 read(fd, buffer, n);

Comments? f96hajo@chalmers.se

Last modified: Sun Dec 18 23:25:18 CET 2022