Ethernet
Overview
The RVComp Ethernet controller is a 10/100 Mbps controller integrated into the SoC. It handles Ethernet frame transmission and reception in hardware, including destination-MAC filtering and FCS generation/checking.
The controller connects to the board PHY as follows:
Board |
PHY Interface |
Data width |
Clock |
|---|---|---|---|
Nexys 4 DDR |
RMII |
2-bit |
50 MHz reference clock output from SoC |
Arty A7 |
MII |
4-bit |
SoC outputs a 25 MHz reference clock required by the PHY |
The RX and TX buffer regions have fixed base addresses:
RX buffer base:
0x1800_0000TX buffer base:
0x1C00_0000
Their sizes are selected at synthesis time through ETHER_RXBUF_SIZE and ETHER_TXBUF_SIZE in src/config.vh.
Frame Format
┌──────────┬─────────────────┬─────────────────┬───────────┬──────────────────────┬──────────┬──────────────┐
│ Preamble │ Destination MAC │ Source MAC │ EtherType │ Payload │ FCS │ IFG │
│ 8 bytes │ 6 bytes │ 6 bytes │ 2 bytes │ 46–1500 bytes │ 4 bytes │ 12 bytes │
└──────────┴─────────────────┴─────────────────┴───────────┴──────────────────────┴──────────┴──────────────┘
Preamble, FCS, and IFG (Inter-Frame Gap) are handled entirely in hardware and are invisible to software.
MAC Address Configuration
The default MAC address is AA:BB:CC:DD:EE:FF. To change it, both of the following must be updated manually:
src/config.vh— update theETH_MAC_ADDR_*bytes used for hardware filteringbootrom/rvcomp.dts— update thelocal-mac-addressproperty used by Linux
GUI configuration (make menuconfig) does not support MAC address changes.
External Pins
Exact pin assignments are defined in the constraint files under constr/.
RMII pins (Nexys 4 DDR)
Signal |
Direction |
Description |
|---|---|---|
|
Output |
50 MHz PHY reference clock |
|
Input |
Carrier sense / receive data valid |
|
Input |
Receive error |
|
Input |
Receive data |
|
Output |
Transmit enable |
|
Output |
Transmit data |
|
Output |
PHY reset (active low) |
|
Inout |
Reserved for future PHY management |
|
Output |
Reserved for future PHY management |
|
Input |
Reserved PHY interrupt pin |
MII pins (Arty A7)
Signal |
Direction |
Description |
|---|---|---|
|
Input |
Receive clock from PHY |
|
Input |
Transmit clock from PHY |
|
Input |
Receive data valid |
|
Input |
Receive error |
|
Input |
Receive data |
|
Output |
Transmit enable |
|
Output |
Transmit data |
|
Output |
Reference clock generated by the SoC |
|
Output |
PHY reset (active low) |
|
Inout |
Reserved for future PHY management |
|
Output |
Reserved for future PHY management |
Hardware Features
MAC Filtering
The receive path compares the destination MAC address of incoming frames against the six ETH_MAC_ADDR_* bytes in src/config.vh. Frames that do not match are discarded in hardware.
FCS (Frame Check Sequence)
FCS handling is performed entirely in hardware:
Receive path: verifies the incoming CRC-32 and drops frames with an invalid FCS
Transmit path: appends the FCS automatically
The software driver does not need to calculate or strip the FCS.
CSR Map
All CSRs are 32-bit wide and are accessed in the Ethernet CSR region starting at 0x1400_0000.
Offset |
Name |
Access |
Description |
|---|---|---|---|
0x00 |
|
R/W |
RX read pointer. Software advances this after consuming data. |
0x04 |
|
R |
RX write pointer updated by hardware when a frame arrives. |
0x08 |
|
W |
Software-visible latch reserved for byte-count acknowledgement; current drivers advance |
0x10 |
|
R |
Bit 0 is set while the TX ring contains pending data. |
0x14 |
|
R |
Current TX read pointer maintained by hardware. |
0x18 |
|
R/W |
TX write pointer. Software writes the new end pointer after appending a frame record. |
Module Hierarchy
ether_rmii (ether/ether_rmii.v) # Nexys 4 DDR (RMII)
├── ether_rx_rmii (ether/ether_rx_rmii.v) # RMII receive path
├── ether_tx_rmii (ether/ether_tx_rmii.v) # RMII transmit path
└── sdp_2_clock_ram (ether/sdp_2_clock_ram.v) ×2
ether_mii (ether/ether_mii.v) # Arty A7 (MII)
├── ether_rx_mii (ether/ether_rx_mii.v) # MII receive path
├── ether_tx_mii (ether/ether_tx_mii.v) # MII transmit path
└── sdp_2_clock_ram (ether/sdp_2_clock_ram.v) ×2
Frame Reception
RTL:
Receives dibits (RMII) or nibbles (MII) from the PHY
Strips the preamble and SFD
Checks the destination MAC against
ETH_MAC_ADDR_*insrc/config.vh; discards the frame if it does not matchVerifies the FCS; discards the frame if invalid
Writes the frame payload to the RX buffer and advances
RECEIVE_ADDR_END
If the RX buffer is full, incoming frames are silently dropped by hardware.
CPU:
Poll until
RECEIVE_ADDR_END != RECEIVE_ADDR_STARTRead the frame bytes from the RX buffer at
0x1800_0000Advance
RECEIVE_ADDR_STARTafter the frame has been consumed
Frame Transmission
CPU:
Read
TX_BUFFER_STARTandTX_BUFFER_ENDCheck that enough space is available in the TX buffer before writing; software is responsible for not overwriting unread data
Write a 32-bit frame-length header into the TX buffer at
0x1C00_0000Write the frame payload, padded to a 4-byte boundary
Write the new end pointer to
TX_BUFFER_END
RTL:
Reads the frame record from the TX buffer
Prepends the preamble and SFD
Appends the FCS
Sends dibits (RMII) or nibbles (MII) to the PHY
Protocol Notes
The Ethernet controller operates at OSI Layer 2. Hardware handles:
preamble/SFD processing
destination MAC filtering
FCS generation and verification
Higher-layer protocols such as IP, ARP, TCP, and UDP are handled entirely in software by Linux.
Software Support
For the Linux kernel driver and bare-metal helpers, see Device Drivers.