From 21fe9b4439d77ddb353cc47dc9ec3efb481ece1d Mon Sep 17 00:00:00 2001 From: Reinier van der Walle <walle@astron.nl> Date: Thu, 22 Feb 2024 16:56:24 +0100 Subject: [PATCH] processed review comments --- .../rdma_packetiser/cocotb/dp_bus.py | 34 ++++++++++++++++- .../rdma_packetiser/cocotb/mm_bus.py | 34 ++++++++++++++++- .../cocotb/tb_rdma_packetiser.py | 37 +++++++++++++++++++ 3 files changed, 101 insertions(+), 4 deletions(-) diff --git a/applications/rdma_demo/libraries/rdma_packetiser/cocotb/dp_bus.py b/applications/rdma_demo/libraries/rdma_packetiser/cocotb/dp_bus.py index 81e2c2de4e..b54687aeb7 100644 --- a/applications/rdma_demo/libraries/rdma_packetiser/cocotb/dp_bus.py +++ b/applications/rdma_demo/libraries/rdma_packetiser/cocotb/dp_bus.py @@ -1,3 +1,35 @@ +# ########################################################################## +# Copyright 2024 +# ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/> +# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ########################################################################## +# Author: +# . Reinier vd Walle +# +# Purpose: +# . Provide abstraction layer for using DP bus (sosi/siso) in cocotb. +# +# Description: +# . This file contains classes to create an abstraction layer for +# interacting with DP sosi/siso signals in cocotb testbenches. +# . The classes are copied from AvalonSTPkts in [1] and slightly adapted to +# use sosi/siso signals +# +# References: +# [1] - https://docs.cocotb.org/en/v1.5.1/_modules/cocotb_bus/drivers/avalon.html +# ########################################################################## from typing import Iterable, Union, Optional import cocotb @@ -8,8 +40,6 @@ from cocotb.result import TestError from cocotb_bus.drivers import ValidatedBusDriver from cocotb_bus.monitors import BusMonitor -# Note: Copied from AvalonSTPkts in [1] and slightly adapted to use sosi/siso signals -# [1] - https://docs.cocotb.org/en/v1.5.1/_modules/cocotb_bus/drivers/avalon.html class SosiDriver(ValidatedBusDriver): _optional_signals = ['valid', 'sop', 'eop', 'sync', 'bsn', 'data', 're', 'im', 'empty', 'channel', 'err'] _signals = [] diff --git a/applications/rdma_demo/libraries/rdma_packetiser/cocotb/mm_bus.py b/applications/rdma_demo/libraries/rdma_packetiser/cocotb/mm_bus.py index 89cdcb8576..992505c4f8 100644 --- a/applications/rdma_demo/libraries/rdma_packetiser/cocotb/mm_bus.py +++ b/applications/rdma_demo/libraries/rdma_packetiser/cocotb/mm_bus.py @@ -1,3 +1,35 @@ +# ########################################################################## +# Copyright 2024 +# ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/> +# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ########################################################################## +# Author: +# . Reinier vd Walle +# +# Purpose: +# . Provide abstraction layer for using MM bus (copi/cipo) in cocotb. +# +# Description: +# . This file contains classes to create an abstraction layer for +# interacting with MM copi/cipo signals in cocotb testbenches. +# . The classes are copied from AvalonMM in [1] and slightly adapted to +# use copi/cipo signals +# +# References: +# [1] - https://docs.cocotb.org/en/v1.5.1/_modules/cocotb_bus/drivers/avalon.html +# ########################################################################## from cocotb.log import SimLog from cocotb.triggers import RisingEdge, ReadOnly from cocotb.binary import BinaryValue @@ -5,8 +37,6 @@ from cocotb.result import TestError from cocotb_bus.drivers import BusDriver from cocotb.decorators import coroutine -# Note: Copied from AvalonMM in [1] and slightly adapted to use copi/cipo signals -# [1] - https://docs.cocotb.org/en/v1.5.1/_modules/cocotb_bus/drivers/avalon.html class CopiDriver(BusDriver): _signals = [] _optional_signals = ["rd", "wr", "wrdata", "address"] diff --git a/applications/rdma_demo/libraries/rdma_packetiser/cocotb/tb_rdma_packetiser.py b/applications/rdma_demo/libraries/rdma_packetiser/cocotb/tb_rdma_packetiser.py index f0389b0423..b58cb4822b 100644 --- a/applications/rdma_demo/libraries/rdma_packetiser/cocotb/tb_rdma_packetiser.py +++ b/applications/rdma_demo/libraries/rdma_packetiser/cocotb/tb_rdma_packetiser.py @@ -1,3 +1,40 @@ +# ########################################################################## +# Copyright 2024 +# ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/> +# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ########################################################################## +# Author: +# . Reinier vd Walle +# +# Purpose: +# . Test the rdma_packetiser HDL dut using cocotb. +# +# Description: +# The testbench performs the following actions +# . Write and read/verify the rdma_packetiser configuration and header values over MM. +# . Send a set of DP packets containing just data (no headers). +# . Verify the output DP packets, the following parts of the packet is verified. +# . Packet header (ETH + IP + UDP + RDMA) +# . Packet payload (should be identical to the input data) +# . RDMA icrc value +# +# Usage: +# . do tb_rdma_packetiser.do +# . as 5 +# . run -all +# ########################################################################## from zlib import crc32 import cocotb -- GitLab