Register Map
This page specifies the required software-accessible hardware control registers and the control interface.
Each project has an XML configuration file that specifies the modules that it uses, and each module has a configuration file that specifies the registers that it provides. The register system (specifically, the nf_register_gen.pl script) reads a project's configuration file to identify the modules (and number of instances of each module), reads the individual module configuration files, allocates memory in the register address space to each module instance and its registers, and finally outputs Verilog, C, and Perl files with the register allocation.
The automatically-generated outputs files include:
- Verilog (Hardware): $NF_DESIGN_DIR/include/registers.v
- C (Software): $NF_DESIGN_DIR/lib/C/reg_defines_<project-name>.h
- Perl (software): $NF_DESIGN_DIR/lib/Perl5/reg_defines_<project-name>.pm
Note: These files will not exist until after you build or compile your hardware project. (The generator script is invoked automatically as part of the build process).
For further information on the format of the XML files that specify register configuration, refer to the following documents at the NetFPGA project site:
For information on how the register chain works, view the Register Interface page.
As an example on how to instantiate registers in a NetFPGA-compliant format,the official XML files for both the switch and router projects have been posted below. You should incorporate these elements into your own design. To do so, download the desired XML file and save it to the include/ directory in your project. Then, edit the include/project.xml file inside your current project. Locate the block labeled <nf:group name="udp">, and then add a new entry to that block corresponding to the correct XML file.
XML File | Line to Include File |
---|---|
ethernet_switch.xml | <nf:instance name="ethernet_switch" /> |
ip_router.xml | <nf:instance name="ip_router" /> |
Note: If you have problems incorporating the XML files, it might be helpful to ensure that your project name is consistent with the XML file name, i.e. "ethernet_switch" and "ip_router"
Registers
Only a subset of the full registers in the NetFPGA platform are described here. For the full list of all possible registers in your current project, along with their specific memory addresses and/or bit positions, refer to the definition files listed above.
MAC Queue Registers
These are registers for the 4 MAC Rx and 4 MAC Tx queues. An X in the register name can be a value between 0 and 3.
These registers are present in the initial NIC design
Register name | Register description |
---|---|
MAC_GRP_X_CONTROL_REG | Contains bits that can be used to change the state of the MAC queues. See MAC Control Bits. |
MAC_GRP_X_RX_QUEUE_NUM_PKTS_IN_QUEUE_REG | Number of packets in the RX queue |
MAC_GRP_X_RX_QUEUE_NUM_PKTS_STORED_REG | Number of RX packets stored |
MAC_GRP_X_RX_QUEUE_NUM_PKTS_DROPPED_FULL_REG |
Number of RX packets dropped because the queue was full
|
MAC_GRP_X_RX_QUEUE_NUM_PKTS_DROPPED_BAD_REG | Number of RX packets dropped because the packet was bad |
MAC_GRP_X_RX_QUEUE_NUM_PKTS_DEQUEUED_REG | Number of packets dequeud from the RX queue |
MAC_GRP_X_RX_QUEUE_NUM_WORDS_PUSHED_REG | Number of 64-bit words pushed out of the RX queue into the user data path |
MAC_GRP_X_RX_QUEUE_NUM_BYTES_PUSHED_REG | Number of bytes pushed out of the RX queue into the user data path |
MAC_GRP_X_TX_QUEUE_NUM_PKTS_IN_QUEUE_REG | Gives the number of packets that are currently waiting in the TX queue to be sent out to the Ethernet. |
MAC_GRP_X_TX_QUEUE_NUM_PKTS_ENQUEUED_REG | Gives the number of packets that have ever went into the TX queue to be sent out to the Ethernet. |
MAC_GRP_X_TX_QUEUE_NUM_PKTS_SENT_REG | Gives the number of packets that have been sent out to the Ethernet. |
MAC_GRP_X_TX_QUEUE_NUM_WORDS_PUSHED_REG | Gives the number of 64-bit words sent out to the Ethernet. |
MAC_GRP_X_TX_QUEUE_NUM_BYTES_PUSHED_REG | Gives the number of bytes that have been sent out of the TX queue to the Ethernet. |
Input Arbiter Registers
Module description: Round-robin input arbiter
The registers of the input arbiter can be very useful for debugging packet flow through the system.
These registers are present in the initial NIC design
Register name | Register description |
---|---|
IN_ARB_NUM_PKTS_SENT_REG | Number of packets that have been serviced by the input arbiter |
IN_ARB_LAST_PKT_WORD_0_LO_REG | Least significant 32 bits of the first 64-bit word of the last packet that passed through the input arbiter. |
IN_ARB_LAST_PKT_WORD_0_HI_REG | Most significant 32 bits of the first 64-bit word of the last packet that passed through the input arbiter. |
IN_ARB_LAST_PKT_CTRL_0_REG | First 8-bit control word of the last packet that passed through the input arbiter. |
IN_ARB_LAST_PKT_WORD_1_LO_REG | Least significant 32 bits of the second 64-bit word of the last packet that has passed through the input arbiter. |
IN_ARB_LAST_PKT_WORD_1_HI_REG | Most significant 32 bits of the second 64-bit word of the last packet that has passed through the input arbiter. |
IN_ARB_LAST_PKT_CTRL_1_REG | Second 8-bit ctrl word of the last packet that has passed through the input arbiter. |
IN_ARB_STATE_REG | Current state of the input arbiter in the state machine. |
Output Port Lookup Registers (for Ethernet switch)
These registers (except for the number of hits/misses) are accessed in the same way a table is accessed. (See Reading/Writing Tables)
Tip: To incorporate these registers into your Ethernet Switch project, you will need to incorporate the following XML code into your project: learning_cam_switch.xml
These registers need to be added in the Ethernet Switch project.
Register name **These registers are a table** | Register description |
---|---|
SWITCH_OP_LUT_PORTS_MAC_HI_REG |
Bit 31: 0 = Entry can be updated by the learning mechanism in the switch / 1=Switch will not update this entry. Bits 30-16: One-hot-encoded ports corresponding to the output ports of a packet with the destination MAC address specified in the entry Bits 15-0: 16 most significant bits of the MAC. |
SWITCH_OP_LUT_MAC_LO_REG | Least significant 32 bits of the MAC address |
SWITCH_OP_LUT_MAC_LUT_RD_ADDR_REG | Register to write the index of the entry to be read. A write here will update the data registers with the entry's values |
SWITCH_OP_LUT_MAC_LUT_WR_ADDR_REG | A write into the address will move the data in the data registers to the MAC table entry specified by the write. |
SWITCH_OP_LUT_NUM_HITS_REG | Number of hits when looking up destination addresses in the MAC table |
SWITCH_OP_LUT_NUM_MISSES_REG | Number of misses when looking up destination addresses in the MAC table |
Output Port Lookup Registers (for IP Router)
These define registers for accessing the hardware ARP cache, the Routing Table, setting IP and MAC addresses, statistics, and more. See Tables in the Router for more details.
For sections marked as a Table, see the Reading/Writing Tables section for more details.
Tip: To incorporate these registers into your IP Router project, you will need to incorporate the following XML code into your project: cam_router.xml
These registers need to be added in the Ethernet Router project.
Register name | Register description |
---|---|
ROUTER_OP_LUT_ROUTE_TABLE_DEPTH | This is not a register but a constant specifying the size of the routing table. |
ROUTER_OP_LUT_ARP_TABLE_DEPTH | This is not a register but a constant specifying the size of the ARP cache. |
ROUTER_OP_LUT_DST_IP_FILTER_TABLE_DEPTH | This is not a register but a constant specifying the size of the IP destination filter table. |
Router ARP Cache Registers **These registers are a table** |
|
ROUTER_OP_LUT_ARP_TABLE_ENTRY_MAC_HI_REG | High 16 bits of the next hop MAC address in the ARP table |
ROUTER_OP_LUT_ARP_TABLE_ENTRY_MAC_LO_REG | Low 32 bits of the next hop MAC address in the ARP table |
ROUTER_OP_LUT_ARP_TABLE_ENTRY_NEXT_HOP_IP_REG | Next hop's IP address (set to 0 to match the destination address) |
ROUTER_OP_LUT_ARP_TABLE_RD_ADDR_REG | Write the index of the entry to read from in the ARP table |
ROUTER_OP_LUT_ARP_TABLE_WR_ADDR_REG | Write the index of the entry to write to in the ARP table |
Routing Table Registers **These registers are a table** |
|
ROUTER_OP_LUT_ROUTE_TABLE_ENTRY_IP_REG | Subnet IP address to match in the Routing table |
ROUTER_OP_LUT_ROUTE_TABLE_ENTRY_MASK_REG | Subnet Mask in the router table |
ROUTER_OP_LUT_ROUTE_TABLE_ENTRY_NEXT_HOP_IP_REG | Next Hop IP in the router table |
ROUTER_OP_LUT_ROUTE_TABLE_ENTRY_OUTPUT_PORT_REG | One-hot-encoded output port in the routing table. |
ROUTER_OP_LUT_ROUTE_TABLE_RD_ADDR_REG | Write the index of the entry to read from in the Routing table |
ROUTER_OP_LUT_ROUTE_TABLE_WR_ADDR_REG | Write the index of the entry to write to in the Routing table |
Router IP Destination Filter Table **These registers are a table** |
|
ROUTER_OP_LUT_DST_IP_FILTER_TABLE_ENTRY_IP_REG | Destination IP address to filter out and send to the CPU in the Destination IP Filter table |
ROUTER_OP_LUT_DST_IP_FILTER_TABLE_RD_ADDR_REG | Index for reading into the destination IP filter table |
ROUTER_OP_LUT_DST_IP_FILTER_TABLE_WR_ADDR_REG | Index for writing into the destination IP filter table |
Router MAC Addresses | |
ROUTER_OP_LUT_MAC_0_HI_REG | High 16 bits of port 0's MAC address (upper 16 bits of this field are ignored) |
ROUTER_OP_LUT_MAC_0_LO_REG | Low 32 bits of port 0's MAC address |
ROUTER_OP_LUT_MAC_1_HI_REG | High 16 bits of port 1's MAC address (upper 16 bits of this field are ignored) |
ROUTER_OP_LUT_MAC_1_LO_REG | Low 32 bits of port 1's MAC address |
ROUTER_OP_LUT_MAC_2_HI_REG | High 16 bits of port 2's MAC address (upper 16 bits of this field are ignored) |
ROUTER_OP_LUT_MAC_2_LO_REG | Low 32 bits of port 2's MAC address |
ROUTER_OP_LUT_MAC_3_HI_REG | High 16 bits of port 3's MAC address (upper 16 bits of this field are ignored) |
ROUTER_OP_LUT_MAC_3_LO_REG | Low 32 bits of port 3's MAC address |
Router Statistics | |
ROUTER_OP_LUT_ARP_NUM_MISSES_REG | Total number of misses in the ARP table |
ROUTER_OP_LUT_LPM_NUM_MISSES_REG | Total number of misses in the LPM (routing) table |
ROUTER_OP_LUT_NUM_CPU_PKTS_SENT_REG | Total number of packets sent from the CPU |
ROUTER_OP_LUT_NUM_BAD_OPTS_VER_REG | Total number of pkts sent to the CPU because they have IP options or the IP version is not 4 |
ROUTER_OP_LUT_NUM_BAD_CHKSUMS_REG | Total number of packets dropped because of a checksum failure |
ROUTER_OP_LUT_NUM_BAD_TTLS_REG | Total number of packets sent to the CPU because the IP TTL field is 0 or 1 |
ROUTER_OP_LUT_NUM_NON_IP_RCVD_REG | Total number of non-IP packets received (which includes ARP) |
ROUTER_OP_LUT_NUM_PKTS_FORWARDED_REG | Total number of packets that have been forwarded by the hardware |
ROUTER_OP_LUT_NUM_WRONG_DEST_REG | Total number of packets dropped because the destination MAC address was neither a broadcast nor the port's address |
ROUTER_OP_LUT_NUM_FILTERED_PKTS_REG | Total number of packets sent to the CPU because the destination IP matched an IP in the Destination IP filter table |
Output Queues Registers
Module description: SRAM-based output queue using round-robin removal.
For the output queue register names, X can be a number between 0 and 7, representing the 4 MAC and 4 CPU output queues.
These registers are present in the initial NIC design
Register name | Register description |
---|---|
OQ_QUEUE_X_CTRL_REG | Control register for the output queue |
OQ_QUEUE_X_NUM_PKT_BYTES_STORED_REG | Total number of packet bytes stored in the queue |
OQ_QUEUE_X_NUM_OVERHEAD_BYTES_STORED_REG | Total number of bytes stored in the queue used by module headers |
OQ_QUEUE_X_NUM_PKT_BYTES_REMOVED_REG | Total number of bytes sent (i.e. removed) from the queue |
OQ_QUEUE_X_NUM_OVERHEAD_BYTES_REMOVED_REG | Total number of overhead (module header) bytes sent from the queue |
OQ_QUEUE_X_NUM_PKTS_STORED_REG | Total number of packets ever stored in the queue |
OQ_QUEUE_X_NUM_PKTS_DROPPED_REG | Total number of packets dropped from the queue because the queue was full on arrival |
OQ_QUEUE_X_NUM_PKTS_REMOVED_REG | Total number of packets sent from the queue |
OQ_QUEUE_X_ADDR_LO_REG | Gives/sets the low address of the circular buffer in memory |
OQ_QUEUE_X_ADDR_HI_REG | Gives/sets the high address of the circular buffer in memory. After changing this register or the corresponding OQ_QUEUE_X_ADDR_LO_REG you need to reinitialize the queue by using OQ_QUEUE_X_CTRL_REG. |
OQ_QUEUE_X_RD_ADDR_REG | The current read pointer |
OQ_QUEUE_X_WR_ADDR_REG | The current write pointer |
OQ_QUEUE_X_NUM_PKTS_IN_Q_REG | Number of packets currently in the queue waiting to be serviced |
OQ_QUEUE_X_MAX_PKTS_IN_Q_REG | Used to limit the number of packets that can be in the queue at any given time |
OQ_QUEUE_X_NUM_WORDS_IN_Q_REG | Number of 64-bit words currently waiting in the queue. |
OQ_QUEUE_X_NUM_WORDS_LEFT_REG | Number of 64-bit words of space left in the queue |
OQ_QUEUE_X_FULL_THRESH_REG | Used to limit the number of words used from the queue. |
DMA Registers
These registers show the current status of the DMA engine.
These registers are present in the initial NIC design
Register name | Register description |
---|---|
DMA_CTRL_REG | DMA Interface Control |
DMA_NUM_INGRESS_PKTS_REG | Number of ingress packets (host -> NetFPGA) |
DMA_NUM_INGRESS_BYTES_REG | Number of ingress DMA bytes (host -> NetFPGA) |
DMA_NUM_EGRESS_PKTS_REG | Number of egress DMA packets (NetFPGA -> host) |
DMA_NUM_EGRESS_BYTES_REG | Number of egress DMA bytes (NetFPGA -> host) |
DMA_NUM_TIMEOUTS_REG | Number of DMA timeouts |
Control Bits
MAC Control Bits
These are the bits in MAC_GRP_X_CONTROL_REG, and are used to change the state of the MAC queues.
Bit | Bit description |
---|---|
MAC_GRP_TX_QUEUE_DISABLE_BIT_NUM | Setting this bit to one disables sending any packets to the MAC. |
MAC_GRP_RX_QUEUE_DISABLE_BIT_NUM | Setting this bit to one disables sending any packets the user data path. |
MAC_GRP_RESET_MAC_BIT_NUM | Setting this bit to one resets the MAC queues and core. |
MAC_GRP_MAC_DISABLE_TX_BIT_NUM | Setting this bit to one prevents the MAC from sending any packets to the Ethernet. |
MAC_GRP_MAC_DISABLE_RX_BIT_NUM | Setting this bit to one prevents the MAC from receiving any packets. |
MAC_GRP_MAC_DIS_JUMBO_TX_BIT_NUM | Setting this bit to one causes the MAC to drop any Jumbo packets being sent. |
MAC_GRP_MAC_DIS_JUMBO_RX_BIT_NUM | Setting this bit to one causes the MAC to drop any Jumbo packets received. |
MAC_GRP_MAC_DIS_CRC_CHECK | Setting this bit to one causes the MAC to ignore checking the CRC on packets. |
MAC_GRP_MAC_DIS_CRC_GEN | Setting this bit to one disable CRC generation by the MAC. |
Tables in the Router
There are three tables in the Router: The ARP table, the Routing table, and the Destination IP filter table.
- The ARP table has the following data registers: ROUTER_OP_LUT_ARP_MAC_HI_REG, ROUTER_OP_LUT_ARP_MAC_LO_REG, and ROUTER_OP_LUT_ARP_NEXT_HOP_IP_REG. This table gives the MAC address of the next hop IP found in the Routing table.
- The Routing table has the following data registers: ROUTER_OP_LUT_RT_IP_REG, ROUTER_OP_LUT_RT_MASK_REG, ROUTER_OP_LUT_RT_NEXT_HOP_IP_REG, and ROUTER_OP_LUT_RT_OUTPUT_PORT_REG. The routing table does a LPM search to find the next hop's IP address and the output port on which a packet should be forwarded.
- WARNING: Entries should be ordered such that the longest subnet masks are at the lowest index into the table.
- The Destination IP filter table has the following data register: ROUTER_OP_LUT_DST_IP_FILTER_IP_REG. This table should have the IP addresses of the router's interfaces in addition to any IP that the router should forward to the CPU such as the PWOSPF multicast IP address.
Reading/Writing Tables
To read a table:
- Write the index of the entry to read
- Read the data
To write a table:
- Write the data to be stored
- Write the index of the entry to be written
The data can span multiple registers. The registers used to read and write data are the same for reads and writes, but the registers used to write the indices for reads and writes are different.
For example: to write an entry into the switch MAC table: index 3, MAC address aa:bb:cc:dd:ee:ff -> MAC port 2
- Write ((0x10<<16) | 0xaabb) into SWITCH_OP_LUT_PORTS_MAC_HI_REG (see below for details)
- Write 0xccddeeff into SWITCH_OP_LUT_MAC_LO_REG
- Write 3 into SWITCH_OP_LUT_MAC_LUT_WR_ADDR_REG
To read an entry from the MAC table at index 4:
- Write 4 into SWITCH_OP_LUT_MAC_LUT_RD_ADDR_REG
- Read SWITCH_OP_LUT_PORTS_MAC_HI_REG and SWITCH_OP_LUT_MAC_LO_REG