From 650d59b62a89d5c0ac44d88190da5a678875a7d2 Mon Sep 17 00:00:00 2001
From: Eric Kooistra <kooistra@astron.nl>
Date: Wed, 26 Oct 2022 16:41:51 +0200
Subject: [PATCH] Add peripheral_name: eth_tester_offload_hdr_dat.

---
 libraries/io/eth/eth.peripheral.yaml | 47 ++++++++++++++++++++++++++--
 1 file changed, 45 insertions(+), 2 deletions(-)

diff --git a/libraries/io/eth/eth.peripheral.yaml b/libraries/io/eth/eth.peripheral.yaml
index b887db3198..083ec80cfb 100644
--- a/libraries/io/eth/eth.peripheral.yaml
+++ b/libraries/io/eth/eth.peripheral.yaml
@@ -233,5 +233,48 @@ peripherals:
               number_of_fields: 1024    # = c_eth_ram_nof_words in eth_pkg.vhd
               access_mode: RO
 
-         
-    
+  - peripheral_name: eth_tester_offload_hdr_dat
+    peripheral_description: "UDP offload header for the eth tester [1]."
+    mm_ports:
+      # MM port for eth_tester.vhd / dp_offload_tx_v3.vhd
+      - mm_port_name: REG_DP_OFFLOAD_TX_HDR_DAT
+        mm_port_type: REG
+        mm_port_span: 32 * MM_BUS_SIZE
+        mm_port_description: |
+          "The ETH/IP/UDP/application header fields for the 1GbE eth_tester offload UDP packets.
+
+           The RO value reads the MM value, not the used data path value. Therefore simply use access
+           mode RW for all fields. Whether the write RW MM value is used in the packet header depends
+           on the c_eth_tester_hdr_field_sel bit selection setting in eth_tester_pkg.vhd.
+
+           [1] https://support.astron.nl/confluence/display/L2M/L6+FWLIB+Design+Document%3A+ETH+tester+unit+for+1GbE
+          "
+        fields:
+          # eth field group
+          - - { field_name: word_align,             mm_width: 16,                                access_mode: RW, address_offset: 0x64 }
+          - - { field_name: eth_destination_mac,    mm_width: 32, user_width: 48, radix: uint64, access_mode: RW, address_offset: 0x5c }
+          - - { field_name: eth_source_mac,         mm_width: 32, user_width: 48, radix: uint64, access_mode: RW, address_offset: 0x54 }
+          - - { field_name: eth_type,               mm_width: 16,                                access_mode: RW, address_offset: 0x50 }
+          # ip field group
+          - - { field_name: ip_version,             mm_width:  4,                                access_mode: RW, address_offset: 0x4c }
+          - - { field_name: ip_header_length,       mm_width:  4,                                access_mode: RW, address_offset: 0x48 }
+          - - { field_name: ip_services,            mm_width:  8,                                access_mode: RW, address_offset: 0x44 }
+          - - { field_name: ip_total_length,        mm_width: 16,                                access_mode: RW, address_offset: 0x40 }
+          - - { field_name: ip_identification,      mm_width: 16,                                access_mode: RW, address_offset: 0x3c }
+          - - { field_name: ip_flags,               mm_width:  3,                                access_mode: RW, address_offset: 0x38 }
+          - - { field_name: ip_fragment_offset,     mm_width: 13,                                access_mode: RW, address_offset: 0x34 }
+          - - { field_name: ip_time_to_live,        mm_width:  8,                                access_mode: RW, address_offset: 0x30 }
+          - - { field_name: ip_protocol,            mm_width:  8,                                access_mode: RW, address_offset: 0x2c }
+          - - { field_name: ip_header_checksum,     mm_width: 16,                                access_mode: RW, address_offset: 0x28 }
+          - - { field_name: ip_source_address,      mm_width: 32,                                access_mode: RW, address_offset: 0x24 }
+          - - { field_name: ip_destination_address, mm_width: 32,                                access_mode: RW, address_offset: 0x20 }
+          # udp field group
+          - - { field_name: udp_source_port,        mm_width: 16,                                access_mode: RW, address_offset: 0x1c }
+          - - { field_name: udp_destination_port,   mm_width: 16,                                access_mode: RW, address_offset: 0x18 }
+          - - { field_name: udp_length,             mm_width: 16,                                access_mode: RW, address_offset: 0x14 }
+          - - { field_name: udp_checksum,           mm_width: 16,                                access_mode: RW, address_offset: 0x10 }
+          # application field group
+          - - { field_name: dp_reserved,            mm_width: 31,                                access_mode: RW, address_offset: 0xC }
+          - - { field_name: dp_sync,                mm_width:  1,                                access_mode: RW, address_offset: 0x8 }
+          - - { field_name: dp_bsn,                 mm_width: 32, user_width: 64, radix: uint64, access_mode: RW, address_offset: 0x0 }
+
-- 
GitLab