Ethernet MAC UVM Verification
Ethernet MAC UVM Verification
DV Engineer
Ethernet MAC 10G Verification: A Concise UVM Guide
Destination
Source Address Ethernet Type Data + Padding
Address
SOP EOP
6 Bytes 6 Bytes 2 Bytes
Min: 46 bytes Max: 1500
bytes
Fig:1
IPG→
Fig:2
1|Page
Prajwal N
Design Verification Engineer
github.com/Prajwal-N-6/RTL-Verification/tree/main/Ethernet_MAC_10G
Ethernet MAC 10G Verification: A Concise UVM Guide
1. Destination Address:
The Destination Address is a 48-bit (6 Bytes) field that specifies the intended recipient of the frame.
This address is unique to each device on the network and is typically assigned by the manufacturer. The
MAC address allows devices to identify each other on a local area network (LAN).
2. Source Address:
The Source Address is also a 48-bit (6 Bytes) field that identifies the sender of the frame. Like the
destination address, it is unique to each device and is used by the receiving device to know where the
data originated.
3. Ethernet Type:
The Ethernet Type field indicates which protocol is encapsulated in the payload of the frame. Common
values include:
❖ `0x0800` for IPv4
❖ `0x86DD` for IPv6
❖ `0x0806` for ARP
This field helps the receiving device determine how to process the incoming data.
4. Payload:
The Payload contains the actual data being transmitted. The size of this field can vary but must be
between 46 bytes and 1500 bytes for standard Ethernet frames. If the payload is less than 46 bytes,
padding of 0s or 1s is added to meet this minimum size requirement.
2. No Start of Packet (SOP) Case: This scenario tests how well the MAC handles frames that do not
signal their start correctly, which could lead to misinterpretation of incoming data.
3. No End of Packet (EOP) Case: This scenario tests how well the MAC handles frames received
without proper end signals, which could result in incomplete data processing.
2|Page
Prajwal N
Design Verification Engineer
github.com/Prajwal-N-6/RTL-Verification/tree/main/Ethernet_MAC_10G
Ethernet MAC 10G Verification: A Concise UVM Guide
4. Undersized Packet Case: This test checks how the MAC handles packets smaller than 45 bytes,
ensuring they are appropriately rejected or padded as per standards.
5. Oversized Packet Case: This scenario evaluates processing of packets larger than 1500 bytes, which
should be flagged as errors or dropped entirely.
6. No Inter-Packet Gap (IPG): This test assesses how well the MAC manages packets sent back-to-
back without required gaps, which could lead to collisions or data loss.
Fig:3
- Sequence_Item: Six `sequence_item` corresponding to each test case, utilizing `type_override` to
customize behavior as needed for each test case scenario.
3|Page
Prajwal N
Design Verification Engineer
github.com/Prajwal-N-6/RTL-Verification/tree/main/Ethernet_MAC_10G
Ethernet MAC 10G Verification: A Concise UVM Guide
- Sequences:
- Idle Sequence: Sends a continuous stream of zeros to simulate idle conditions on the bus. Utilizing
idle_seq.start() to start Idle Sequence.
- TX Data Sequence: Sends actual data packets based on defined parameters and scenarios. Utilizing
txdata_seq.start() to start TX Data Sequence.
TX Data Sequence:
Generates packets based on a payload size. Let's analyse the code step-by-step, particularly focusing on
the scenario where the payload size is 46 bytes. We will also detail each iteration of the loop that
constructs the packets.
5|Page
Prajwal N
Design Verification Engineer
github.com/Prajwal-N-6/RTL-Verification/tree/main/Ethernet_MAC_10G
Ethernet MAC 10G Verification: A Concise UVM Guide
• Modulus and Division Calculations: We compute modulus and division for the packet as
follows:
pkt_size_mod8 = pkt_size % 8; = 60 % 8 = 4
pkt_size_div8 = pkt_size / 8; = 60 / 8 = 7
no_of_itrs = pkt_size_mod8 == 0 ? pkt_size_div8 : pkt_size_div8 + 1; = 7 + 1 = 8.
last_full_row = pkt_size_mod8 == 0 ? no_of_itrs : no_of_itrs - 1; = 8 - 1 = 7.
• req.q_tx[0]: Contains the MAC destination address (6 bytes) and part of the source address (2
bytes).
• req.q_tx: Contains the remaining part of the source address (4 bytes), EtherType (2 bytes), and
the first two bytes of the payload.
• Iteration i = 2:
j = -6 + (2-1)*8; // j = -6 + 8 = 2;
req.q_tx[2] = {TWO, ZERO, req.payload[2], req.payload[3], req.payload[4], req.payload[5],
req.payload[6], req.payload[7], req.payload[8], req.payload[9]};
• Iteration i = 3:
j = -6 + (3-1)*8; // j = -6 + 16 = 10;
req.q_tx[3] = {TWO, ZERO, req.payload[10], req.payload[11], req.payload[12],
req.payload[13], req.payload[14], req.payload[15], req.payload[16], req.payload[17]};
6|Page
Prajwal N
Design Verification Engineer
github.com/Prajwal-N-6/RTL-Verification/tree/main/Ethernet_MAC_10G
Ethernet MAC 10G Verification: A Concise UVM Guide
• Iteration i = 4:
j = -6 + (4-1)*8; // j = -6 + 24 = 18;
req.q_tx[4] = {TWO, ZERO, req.payload[18], req.payload[19], req.payload[20],
req.payload[21], req.payload[22], req.payload[23], req.payload[24], req.payload[25]};
• Iteration i = 5:
j = -6 + (5-1)*8; // j = -6 + 32 = 26;
req.q_tx[5] = {TWO, ZERO, req.payload[26], req.payload[27], req.payload[28],
req.payload[29], req.payload[30], req.payload[31], req.payload[32], req.payload[33]};
• Iteration i = 6:
j = -6 + (6-1) * 8; // j = -6 + 40 = 34;
req.q_tx[6] = {TWO, ZERO, req.payload[34], req.payload[35], req.payload[36],
req.payload[37], req.payload[38], req.payload[39], req.payload[40], req.payload[41]};
NOTE:
The first field of each packet is designated to indicate the type of packet being constructed.
ONE: Represents the Start of Packet (SOP). This indicates that the packet being transmitted is the
beginning segment of a data transmission. It includes MAC address of Destination and Source.
7|Page
Prajwal N
Design Verification Engineer
github.com/Prajwal-N-6/RTL-Verification/tree/main/Ethernet_MAC_10G
Ethernet MAC 10G Verification: A Concise UVM Guide
TWO: Denotes the Middle of Packet (MOP). This signifies that the packet is part of a larger sequence,
continuing from a previous segment. It includes additional Source MAC address, Ethernet type, and
part of payload.
THREE: Signifies the End of Packet (EOP). This indicates that the current packet marks the conclusion
of a data transmission sequence. It includes final data bytes and any necessary padding to ensure that
the packet conforms to defined size constraints.
The second field, represented by constants ranging from ZERO to SEVEN, is used to manage padding
within the packet structure. These values indicate how many bits are padded with either 0s or 1s to
complete the remaining slots in an 8-byte frame format. This is crucial for adhering to protocol
specifications that require packets to be aligned to specific byte boundaries.
Visit my GitHub repository for the complete UVM verification code: https://github.com/Prajwal-N-
6/RTL-Verification/tree/main/Ethernet_MAC_10G
8|Page
Prajwal N
Design Verification Engineer
github.com/Prajwal-N-6/RTL-Verification/tree/main/Ethernet_MAC_10G