1+ # SPDX-License-Identifier: BSD-2-Clause
2+ from amaranth import Module
3+ from amaranth .lib import wiring
4+ from amaranth .lib .wiring import In , Out , flipped , connect
5+
6+ from chipflow_lib .platforms import InputPinSignature , OutputPinSignature , BidirPinSignature
7+
8+ __all__ = ["MockTop" ]
9+
10+ TestSignature1 = wiring .Signature ({
11+ "a" : In (InputPinSignature (1 )),
12+ "b" : In (InputPinSignature (5 )),
13+ "c" : Out (OutputPinSignature (1 )),
14+ "d" : Out (OutputPinSignature (10 )),
15+ "e" : In (BidirPinSignature (1 )),
16+ "f" : In (BidirPinSignature (7 )),
17+ })
18+
19+ TestSignature2 = wiring .Signature ({
20+ "a" : Out (OutputPinSignature (1 )),
21+ "b" : Out (OutputPinSignature (5 )),
22+ "c" : In (InputPinSignature (1 )),
23+ "d" : In (InputPinSignature (10 )),
24+ "e" : Out (BidirPinSignature (1 )),
25+ "f" : Out (BidirPinSignature (7 )),
26+ })
27+
28+
29+ # ---------
30+
31+ class MockTop (wiring .Component ):
32+ def __init__ (self ):
33+ # Top level interfaces
34+
35+ interfaces = {
36+ "test1" : Out (TestSignature1 ),
37+ "test2" : Out (TestSignature2 )
38+ }
39+
40+ super ().__init__ (interfaces )
41+
42+ def elaborate (self , platform ):
43+ m = Module ()
44+ for inpin , outpin in zip (self .test1 .members , self .test2 .members ):
45+ m .d .comb += inpin .eq (outpin )
46+
47+ return m
0 commit comments