A peek under the hood: implementing a basic network cross-connect
This tutorial implements the simplest possible XISA program: a port cross-connect that forwards packets from an ingress port to a configurable egress port without modifying them. The Parser halts immediately; the Match-Action Processor (MAP) reads the egress queue ID preloaded from the built-in Ingress Port table and sends the packet out — five instructions in total.
Ever wonder about the fundamental mechanisms that drive network switches? While configuring high-level networking might seem abstract, the core of packet forwarding often relies on low-level microcode (uCode) instructions. This is a simplified look at that, based on Xsight Labs' exposed X-Switch Instruction Set Architecture (XISA), using a very basic use case: a simple cross-connect between two ports.
A simple cross-connect forwards incoming packets from an ingress port to a corresponding egress port without modifying the packet. The control plane program populates an Ingress Port lookup table that maps an ingress port to a specific egress queue on the desired egress port, making the association configurable at run time rather than pre-determined.
To send a packet out of a given egress port, we direct it to one of the egress queues associated with that port. X-Switch ports typically have multiple egress queues to facilitate packet prioritization. To determine the appropriate egress queue number for a packet received on a specific ingress port, a lookup mechanism is necessary. We could build a custom table for this, but we can instead leverage the special Ingress Port table inherently available on the device. In that table the ingress port acts as the key, and the corresponding egress queue number is the value. The control plane populates it with the desired egress queue number for each ingress port.
Once a packet reaches the Match-Action Processor (MAP), the result of the lookup in the Ingress Port table is automatically available in MAP register R1. The MAP microcode retrieves the egress queue number ID (QID) from that result. The QID indicates to the hardware where to send the packet.

Figure 1. Simple uni-directional cross-connect example
Ingress Port table (example population)
Packet switching is processed via the XISA, first via the Parser, then via the MAP.
For a simple cross-connect example, the Parser processing is simply to HALT.
Figure 2. Parser code
{ special_entry_points ingress: entry_point_ethernet}entry_point_ethernet:HALTThe MAP uCode prepares information needed for sending out, using MAP registers. Once the registers are prepped, a send instruction ferries the packet descriptor to an egress queue.
Note: There are 14 MAP registers (R0 to R13), each holding four 32-bit words (0–3), supporting big-endian architecture. For example, R1.3 specifies the fourth word of the R1 MAP register, bits 0 to 31.
In the microcode example below, lines 2 to 4 prepare the registers for the egress SENDOUT instruction in line 5. The 16-bit QID field (part of the Ingress Port Entry result value) will have been preloaded into MAP Register R1 Word 0 (R1.0), at offset 16, by the HW accelerator.
The SENDOUT instruction uses two registers as its operands.
Lines 2 and 3 prepare SENDOUT's first operand; line 4 prepares its second operand.
Figure 3. MAP assembly code
0 ingress:12 MOVI R1.2, 03 CONCAT.CD R1.3, 0, R1.0, 16, 164 MOVI.CD R0.3, 05 SENDOUT.H R1, R0, 0While this cross-connect example demonstrates a fundamental operation in a clear and concise manner, XISA is capable of handling much more sophisticated networking tasks. Any standard routing or bridging feature, and more importantly any unique or customer-driven feature, can be implemented due to the X-Switch's extreme flexibility and programmability. For more information, contact us.
This is the first tutorial in the series. Next: simple IPv4 forwarding, where the Parser starts identifying headers and the MAP performs its first table lookup.
XISA (the X-Switch Instruction Set Architecture) is Xsight Labs' open instruction set for programming packet processing on the X-Switch family, published under the Mozilla Public License version 2. Programs run across two stages: a Programmable Parser that identifies packet headers, and a Match-Action Processor (MAP) that performs lookups, edits and forwarding.