From d46963a14391ba8c154db20c0dd255e3e731a988 Mon Sep 17 00:00:00 2001 From: Antoine van Gelder Date: Fri, 7 Jun 2024 16:58:01 +0200 Subject: [PATCH] gateware.cdc: add a test case that exercises cdc.synchronize() on Pin elements --- tests/test_cdc.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test_cdc.py b/tests/test_cdc.py index 2852ac25..628b792c 100644 --- a/tests/test_cdc.py +++ b/tests/test_cdc.py @@ -8,6 +8,7 @@ from unittest import TestCase from amaranth import Module, Record, Signal +from amaranth.lib.io import Pin from amaranth.hdl.rec import DIR_FANIN, DIR_FANOUT from luna.gateware.utils.cdc import synchronize, stretch_strobe_signal @@ -39,6 +40,17 @@ def test_nested_record(self): ]) synchronize(m, record) + def test_pins(self): + m = Module() + pins = { + "sig_in": Pin(1, "i"), + "sig_out": Pin(1, "o"), + } + record = Record([ + (f_name, f.layout) for (f_name, f) in pins.items() + ], fields=pins) + synchronize(m, record) + class StrobeStretcherTest(LunaGatewareTestCase): """ Test case for our strobe stretcher function. """