cocotb-framework 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. cocotb_framework-0.1.0/LICENSE +21 -0
  2. cocotb_framework-0.1.0/PKG-INFO +333 -0
  3. cocotb_framework-0.1.0/README.md +287 -0
  4. cocotb_framework-0.1.0/pyproject.toml +83 -0
  5. cocotb_framework-0.1.0/setup.cfg +4 -0
  6. cocotb_framework-0.1.0/src/CocoTBFramework/__init__.py +3 -0
  7. cocotb_framework-0.1.0/src/CocoTBFramework/components/__init__.py +0 -0
  8. cocotb_framework-0.1.0/src/CocoTBFramework/components/apb/__init__.py +0 -0
  9. cocotb_framework-0.1.0/src/CocoTBFramework/components/apb/apb_components.py +476 -0
  10. cocotb_framework-0.1.0/src/CocoTBFramework/components/apb/apb_factories.py +426 -0
  11. cocotb_framework-0.1.0/src/CocoTBFramework/components/apb/apb_packet.py +417 -0
  12. cocotb_framework-0.1.0/src/CocoTBFramework/components/apb/apb_sequence.py +206 -0
  13. cocotb_framework-0.1.0/src/CocoTBFramework/components/apb5/__init__.py +38 -0
  14. cocotb_framework-0.1.0/src/CocoTBFramework/components/apb5/apb5_components.py +554 -0
  15. cocotb_framework-0.1.0/src/CocoTBFramework/components/apb5/apb5_factories.py +219 -0
  16. cocotb_framework-0.1.0/src/CocoTBFramework/components/apb5/apb5_packet.py +628 -0
  17. cocotb_framework-0.1.0/src/CocoTBFramework/components/axi4/__init__.py +0 -0
  18. cocotb_framework-0.1.0/src/CocoTBFramework/components/axi4/axi4_compliance_checker.py +591 -0
  19. cocotb_framework-0.1.0/src/CocoTBFramework/components/axi4/axi4_factories.py +484 -0
  20. cocotb_framework-0.1.0/src/CocoTBFramework/components/axi4/axi4_field_configs.py +585 -0
  21. cocotb_framework-0.1.0/src/CocoTBFramework/components/axi4/axi4_interfaces.py +1393 -0
  22. cocotb_framework-0.1.0/src/CocoTBFramework/components/axi4/axi4_packet.py +398 -0
  23. cocotb_framework-0.1.0/src/CocoTBFramework/components/axi4/axi4_packet_utils.py +365 -0
  24. cocotb_framework-0.1.0/src/CocoTBFramework/components/axi4/axi4_randomization_config.py +689 -0
  25. cocotb_framework-0.1.0/src/CocoTBFramework/components/axi4/axi4_randomization_manager.py +339 -0
  26. cocotb_framework-0.1.0/src/CocoTBFramework/components/axi4/axi4_timing_config.py +103 -0
  27. cocotb_framework-0.1.0/src/CocoTBFramework/components/axi4/axi4_transaction.py +99 -0
  28. cocotb_framework-0.1.0/src/CocoTBFramework/components/axi5/__init__.py +260 -0
  29. cocotb_framework-0.1.0/src/CocoTBFramework/components/axi5/axi5_compliance_checker.py +758 -0
  30. cocotb_framework-0.1.0/src/CocoTBFramework/components/axi5/axi5_factories.py +419 -0
  31. cocotb_framework-0.1.0/src/CocoTBFramework/components/axi5/axi5_field_configs.py +989 -0
  32. cocotb_framework-0.1.0/src/CocoTBFramework/components/axi5/axi5_interfaces.py +1188 -0
  33. cocotb_framework-0.1.0/src/CocoTBFramework/components/axi5/axi5_packet.py +619 -0
  34. cocotb_framework-0.1.0/src/CocoTBFramework/components/axi5/axi5_packet_utils.py +628 -0
  35. cocotb_framework-0.1.0/src/CocoTBFramework/components/axi5/axi5_randomization_config.py +718 -0
  36. cocotb_framework-0.1.0/src/CocoTBFramework/components/axi5/axi5_randomization_manager.py +478 -0
  37. cocotb_framework-0.1.0/src/CocoTBFramework/components/axi5/axi5_timing_config.py +227 -0
  38. cocotb_framework-0.1.0/src/CocoTBFramework/components/axi5/axi5_transaction.py +336 -0
  39. cocotb_framework-0.1.0/src/CocoTBFramework/components/axil4/__init__.py +0 -0
  40. cocotb_framework-0.1.0/src/CocoTBFramework/components/axil4/axil4_compliance_checker.py +731 -0
  41. cocotb_framework-0.1.0/src/CocoTBFramework/components/axil4/axil4_factories.py +607 -0
  42. cocotb_framework-0.1.0/src/CocoTBFramework/components/axil4/axil4_field_configs.py +282 -0
  43. cocotb_framework-0.1.0/src/CocoTBFramework/components/axil4/axil4_interfaces.py +728 -0
  44. cocotb_framework-0.1.0/src/CocoTBFramework/components/axil4/axil4_packet.py +322 -0
  45. cocotb_framework-0.1.0/src/CocoTBFramework/components/axil4/axil4_packet_utils.py +439 -0
  46. cocotb_framework-0.1.0/src/CocoTBFramework/components/axis4/__init__.py +75 -0
  47. cocotb_framework-0.1.0/src/CocoTBFramework/components/axis4/axis_example_usage.py +409 -0
  48. cocotb_framework-0.1.0/src/CocoTBFramework/components/axis4/axis_factories.py +475 -0
  49. cocotb_framework-0.1.0/src/CocoTBFramework/components/axis4/axis_field_configs.py +172 -0
  50. cocotb_framework-0.1.0/src/CocoTBFramework/components/axis4/axis_master.py +361 -0
  51. cocotb_framework-0.1.0/src/CocoTBFramework/components/axis4/axis_monitor.py +366 -0
  52. cocotb_framework-0.1.0/src/CocoTBFramework/components/axis4/axis_packet.py +236 -0
  53. cocotb_framework-0.1.0/src/CocoTBFramework/components/axis4/axis_slave.py +341 -0
  54. cocotb_framework-0.1.0/src/CocoTBFramework/components/axis5/__init__.py +88 -0
  55. cocotb_framework-0.1.0/src/CocoTBFramework/components/axis5/axis5_factories.py +537 -0
  56. cocotb_framework-0.1.0/src/CocoTBFramework/components/axis5/axis5_field_configs.py +262 -0
  57. cocotb_framework-0.1.0/src/CocoTBFramework/components/axis5/axis5_master.py +327 -0
  58. cocotb_framework-0.1.0/src/CocoTBFramework/components/axis5/axis5_monitor.py +381 -0
  59. cocotb_framework-0.1.0/src/CocoTBFramework/components/axis5/axis5_packet.py +425 -0
  60. cocotb_framework-0.1.0/src/CocoTBFramework/components/axis5/axis5_slave.py +295 -0
  61. cocotb_framework-0.1.0/src/CocoTBFramework/components/fifo/__init__.py +0 -0
  62. cocotb_framework-0.1.0/src/CocoTBFramework/components/fifo/fifo_command_handler.py +263 -0
  63. cocotb_framework-0.1.0/src/CocoTBFramework/components/fifo/fifo_component_base.py +342 -0
  64. cocotb_framework-0.1.0/src/CocoTBFramework/components/fifo/fifo_factories.py +606 -0
  65. cocotb_framework-0.1.0/src/CocoTBFramework/components/fifo/fifo_master.py +373 -0
  66. cocotb_framework-0.1.0/src/CocoTBFramework/components/fifo/fifo_monitor.py +320 -0
  67. cocotb_framework-0.1.0/src/CocoTBFramework/components/fifo/fifo_monitor_base.py +251 -0
  68. cocotb_framework-0.1.0/src/CocoTBFramework/components/fifo/fifo_packet.py +84 -0
  69. cocotb_framework-0.1.0/src/CocoTBFramework/components/fifo/fifo_sequence.py +551 -0
  70. cocotb_framework-0.1.0/src/CocoTBFramework/components/fifo/fifo_slave.py +297 -0
  71. cocotb_framework-0.1.0/src/CocoTBFramework/components/gaxi/__init__.py +21 -0
  72. cocotb_framework-0.1.0/src/CocoTBFramework/components/gaxi/coverage_hooks.py +317 -0
  73. cocotb_framework-0.1.0/src/CocoTBFramework/components/gaxi/gaxi_command_handler.py +720 -0
  74. cocotb_framework-0.1.0/src/CocoTBFramework/components/gaxi/gaxi_component_base.py +433 -0
  75. cocotb_framework-0.1.0/src/CocoTBFramework/components/gaxi/gaxi_factories.py +480 -0
  76. cocotb_framework-0.1.0/src/CocoTBFramework/components/gaxi/gaxi_master.py +542 -0
  77. cocotb_framework-0.1.0/src/CocoTBFramework/components/gaxi/gaxi_monitor.py +236 -0
  78. cocotb_framework-0.1.0/src/CocoTBFramework/components/gaxi/gaxi_monitor_base.py +266 -0
  79. cocotb_framework-0.1.0/src/CocoTBFramework/components/gaxi/gaxi_packet.py +84 -0
  80. cocotb_framework-0.1.0/src/CocoTBFramework/components/gaxi/gaxi_sequence.py +568 -0
  81. cocotb_framework-0.1.0/src/CocoTBFramework/components/gaxi/gaxi_slave.py +498 -0
  82. cocotb_framework-0.1.0/src/CocoTBFramework/components/shared/__init__.py +0 -0
  83. cocotb_framework-0.1.0/src/CocoTBFramework/components/shared/arbiter_compliance.py +1093 -0
  84. cocotb_framework-0.1.0/src/CocoTBFramework/components/shared/arbiter_master.py +1133 -0
  85. cocotb_framework-0.1.0/src/CocoTBFramework/components/shared/arbiter_monitor.py +1461 -0
  86. cocotb_framework-0.1.0/src/CocoTBFramework/components/shared/data_strategies.py +578 -0
  87. cocotb_framework-0.1.0/src/CocoTBFramework/components/shared/debug_object.py +90 -0
  88. cocotb_framework-0.1.0/src/CocoTBFramework/components/shared/field_config.py +829 -0
  89. cocotb_framework-0.1.0/src/CocoTBFramework/components/shared/flex_config_gen.py +413 -0
  90. cocotb_framework-0.1.0/src/CocoTBFramework/components/shared/flex_randomizer.py +700 -0
  91. cocotb_framework-0.1.0/src/CocoTBFramework/components/shared/master_statistics.py +427 -0
  92. cocotb_framework-0.1.0/src/CocoTBFramework/components/shared/memory_model.py +531 -0
  93. cocotb_framework-0.1.0/src/CocoTBFramework/components/shared/monitor_statistics.py +69 -0
  94. cocotb_framework-0.1.0/src/CocoTBFramework/components/shared/packet.py +648 -0
  95. cocotb_framework-0.1.0/src/CocoTBFramework/components/shared/packet_factory.py +403 -0
  96. cocotb_framework-0.1.0/src/CocoTBFramework/components/shared/protocol_error_handler.py +131 -0
  97. cocotb_framework-0.1.0/src/CocoTBFramework/components/shared/randomization_config.py +498 -0
  98. cocotb_framework-0.1.0/src/CocoTBFramework/components/shared/signal_mapping_helper.py +1770 -0
  99. cocotb_framework-0.1.0/src/CocoTBFramework/components/smbus/__init__.py +45 -0
  100. cocotb_framework-0.1.0/src/CocoTBFramework/components/smbus/smbus_components.py +1086 -0
  101. cocotb_framework-0.1.0/src/CocoTBFramework/components/smbus/smbus_packet.py +252 -0
  102. cocotb_framework-0.1.0/src/CocoTBFramework/components/uart/__init__.py +66 -0
  103. cocotb_framework-0.1.0/src/CocoTBFramework/components/uart/uart_components.py +411 -0
  104. cocotb_framework-0.1.0/src/CocoTBFramework/components/uart/uart_packet.py +116 -0
  105. cocotb_framework-0.1.0/src/CocoTBFramework/components/wavedrom/__init__.py +0 -0
  106. cocotb_framework-0.1.0/src/CocoTBFramework/components/wavedrom/constraint_solver.py +1639 -0
  107. cocotb_framework-0.1.0/src/CocoTBFramework/components/wavedrom/signal_binder.py +195 -0
  108. cocotb_framework-0.1.0/src/CocoTBFramework/components/wavedrom/utility.py +874 -0
  109. cocotb_framework-0.1.0/src/CocoTBFramework/components/wavedrom/wavejson_gen.py +1027 -0
  110. cocotb_framework-0.1.0/src/CocoTBFramework/scoreboards/__init__.py +0 -0
  111. cocotb_framework-0.1.0/src/CocoTBFramework/scoreboards/apb_gaxi_scoreboard.py +538 -0
  112. cocotb_framework-0.1.0/src/CocoTBFramework/scoreboards/apb_gaxi_transformer.py +320 -0
  113. cocotb_framework-0.1.0/src/CocoTBFramework/scoreboards/apb_scoreboard.py +285 -0
  114. cocotb_framework-0.1.0/src/CocoTBFramework/scoreboards/axi4/__init__.py +0 -0
  115. cocotb_framework-0.1.0/src/CocoTBFramework/scoreboards/axi4/axi4_dwidth_converter_scoreboard.py +145 -0
  116. cocotb_framework-0.1.0/src/CocoTBFramework/scoreboards/axi4_scoreboard.py +423 -0
  117. cocotb_framework-0.1.0/src/CocoTBFramework/scoreboards/base_scoreboard.py +202 -0
  118. cocotb_framework-0.1.0/src/CocoTBFramework/scoreboards/fifo_scoreboard.py +152 -0
  119. cocotb_framework-0.1.0/src/CocoTBFramework/scoreboards/gaxi_scoreboard.py +277 -0
  120. cocotb_framework-0.1.0/src/cocotb_framework.egg-info/PKG-INFO +333 -0
  121. cocotb_framework-0.1.0/src/cocotb_framework.egg-info/SOURCES.txt +122 -0
  122. cocotb_framework-0.1.0/src/cocotb_framework.egg-info/dependency_links.txt +1 -0
  123. cocotb_framework-0.1.0/src/cocotb_framework.egg-info/requires.txt +25 -0
  124. cocotb_framework-0.1.0/src/cocotb_framework.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 sean galloway
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,333 @@
1
+ Metadata-Version: 2.4
2
+ Name: cocotb-framework
3
+ Version: 0.1.0
4
+ Summary: Reusable CocoTB verification infrastructure for RTL testing — BFMs, testbenches, and scoreboards for AMBA protocols and more
5
+ Author: sean galloway
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://sean-galloway.github.io/RTLDesignSherpa-DV/
8
+ Project-URL: Documentation, https://sean-galloway.github.io/RTLDesignSherpa-DV/
9
+ Project-URL: Repository, https://github.com/sean-galloway/RTLDesignSherpa-DV
10
+ Project-URL: Issues, https://github.com/sean-galloway/RTLDesignSherpa-DV/issues
11
+ Keywords: cocotb,verification,rtl,fpga,asic,axi,apb,amba,bfm,testbench
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Framework :: cocotb
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: cocotb>=1.9.0
26
+ Requires-Dist: cocotb-bus>=0.2.1
27
+ Requires-Dist: cocotb-coverage>=1.2.0
28
+ Requires-Dist: psutil>=5.9.0
29
+ Requires-Dist: rich>=14.0.0
30
+ Requires-Dist: numpy>=2.0.0
31
+ Provides-Extra: wavedrom
32
+ Requires-Dist: ortools>=9.12.0; extra == "wavedrom"
33
+ Provides-Extra: crc
34
+ Requires-Dist: crc>=7.0.0; extra == "crc"
35
+ Provides-Extra: all
36
+ Requires-Dist: ortools>=9.12.0; extra == "all"
37
+ Requires-Dist: crc>=7.0.0; extra == "all"
38
+ Provides-Extra: dev
39
+ Requires-Dist: pytest>=8.0; extra == "dev"
40
+ Requires-Dist: pytest-cov>=5.0; extra == "dev"
41
+ Requires-Dist: ruff>=0.8.0; extra == "dev"
42
+ Provides-Extra: docs
43
+ Requires-Dist: mkdocs-material>=9.5; extra == "docs"
44
+ Requires-Dist: pymdown-extensions>=10.0; extra == "docs"
45
+ Dynamic: license-file
46
+
47
+ # CocoTB Framework
48
+
49
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
50
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
51
+
52
+ Reusable CocoTB verification infrastructure for RTL testing. Provides protocol-specific Bus Functional Models (BFMs), transaction scoreboards, and shared utilities for AMBA and other standard interfaces.
53
+
54
+ Extracted from the [RTLDesignSherpa](https://github.com/sean-galloway/RTLDesignSherpa) project as a standalone, pip-installable package.
55
+
56
+ ---
57
+
58
+ ## Installation
59
+
60
+ ```bash
61
+ pip install cocotb-framework
62
+ ```
63
+
64
+ With all optional dependencies:
65
+
66
+ ```bash
67
+ pip install cocotb-framework[all]
68
+ ```
69
+
70
+ For development:
71
+
72
+ ```bash
73
+ git clone https://github.com/sean-galloway/RTLDesignSherpa-DV.git
74
+ cd RTLDesignSherpa-DV
75
+ pip install -e ".[dev,all]"
76
+ ```
77
+
78
+ ---
79
+
80
+ ## Package Structure
81
+
82
+ ```
83
+ CocoTBFramework/
84
+ ├── components/ # Protocol-specific BFMs and drivers
85
+ │ ├── axi4/ # AXI4 full protocol
86
+ │ ├── axi5/ # AXI5 (AMBA5) protocol
87
+ │ ├── axil4/ # AXI4-Lite
88
+ │ ├── apb/ # APB protocol
89
+ │ ├── apb5/ # APB5 protocol
90
+ │ ├── axis4/ # AXI-Stream
91
+ │ ├── axis5/ # AXI-Stream v5
92
+ │ ├── fifo/ # Generic FIFO
93
+ │ ├── gaxi/ # GAXI — validate FIFO-based interfaces on small blocks
94
+ │ ├── smbus/ # System Management Bus
95
+ │ ├── uart/ # UART serial
96
+ │ ├── wavedrom/ # Waveform visualization
97
+ │ └── shared/ # Common utilities
98
+ └── scoreboards/ # Transaction verification
99
+ ├── base_scoreboard # Base class for all scoreboards
100
+ └── axi4/ # AXI4-specific scoreboards
101
+ ```
102
+
103
+ ---
104
+
105
+ ## Protocol BFMs
106
+
107
+ Each protocol package provides a complete set of verification components: **masters** (drivers), **slaves** (responders), **monitors** (passive observers), and **packets** (transaction representations).
108
+
109
+ ### AMBA Protocols
110
+
111
+ #### AXI4 (Advanced eXtensible Interface)
112
+
113
+ Full AXI4 protocol implementation with compliance checking and constrained randomization.
114
+
115
+ ```python
116
+ from CocoTBFramework.components.axi4.axi4_interfaces import AXI4MasterRead, AXI4MasterWrite
117
+ from CocoTBFramework.components.axi4.axi4_interfaces import AXI4SlaveRead, AXI4SlaveWrite
118
+ from CocoTBFramework.components.axi4.axi4_packet import AXI4Packet
119
+ from CocoTBFramework.components.axi4.axi4_compliance_checker import AXI4ComplianceChecker
120
+ from CocoTBFramework.components.axi4.axi4_randomization_manager import AXI4RandomizationManager
121
+ ```
122
+
123
+ **Key classes:**
124
+ - `AXI4MasterRead` / `AXI4MasterWrite` — Full-duplex master with integrated compliance
125
+ - `AXI4SlaveRead` / `AXI4SlaveWrite` — Slave responder with configurable timing
126
+ - `AXI4ComplianceChecker` — Protocol violation detection and tracking
127
+ - `AXI4RandomizationManager` — Constrained-random transaction generation
128
+ - `AXI4Packet` — Complete transaction representation with field formatting
129
+
130
+ #### AXI5
131
+
132
+ AMBA5-generation AXI with extended signals and features. Same class structure as AXI4.
133
+
134
+ ```python
135
+ from CocoTBFramework.components.axi5.axi5_interfaces import AXI5MasterRead, AXI5MasterWrite
136
+ from CocoTBFramework.components.axi5.axi5_compliance_checker import AXI5ComplianceChecker
137
+ ```
138
+
139
+ #### AXI4-Lite
140
+
141
+ Simplified AXI for register-mapped peripherals.
142
+
143
+ ```python
144
+ from CocoTBFramework.components.axil4.axil4_interfaces import AXIL4MasterRead, AXIL4MasterWrite
145
+ from CocoTBFramework.components.axil4.axil4_compliance_checker import AXIL4ComplianceChecker
146
+ ```
147
+
148
+ #### APB / APB5 (Advanced Peripheral Bus)
149
+
150
+ Simple bus protocol for low-bandwidth peripherals.
151
+
152
+ ```python
153
+ from CocoTBFramework.components.apb.apb_components import APBMaster, APBSlave, APBMonitor
154
+ from CocoTBFramework.components.apb.apb_packet import APBPacket
155
+ from CocoTBFramework.components.apb.apb_sequence import APBSequence
156
+ from CocoTBFramework.components.apb.apb_factories import create_apb_monitor, create_apb_scoreboard
157
+ ```
158
+
159
+ #### AXI-Stream (AXIS4 / AXIS5)
160
+
161
+ Unidirectional streaming with handshake.
162
+
163
+ ```python
164
+ from CocoTBFramework.components.axis4.axis_master import AXISMaster
165
+ from CocoTBFramework.components.axis4.axis_slave import AXISSlave
166
+ from CocoTBFramework.components.axis4.axis_monitor import AXISMonitor
167
+ from CocoTBFramework.components.axis4.axis_packet import AXISPacket
168
+ ```
169
+
170
+ ### Generic AXI (GAXI)
171
+
172
+ Lightweight valid/ready handshake protocol for validating individual FIFO-based interfaces on very small internal blocks. Interfaces can carry data packed into fields within a single bus, or have many discrete signals. Includes built-in coverage hooks and statistics tracking.
173
+
174
+ ```python
175
+ from CocoTBFramework.components.gaxi import GAXIMaster, GAXISlave, GAXIMonitor
176
+ from CocoTBFramework.components.gaxi import GaxiCoverageHook, register_coverage_hooks
177
+ from CocoTBFramework.components.gaxi.gaxi_packet import GAXIPacket
178
+ from CocoTBFramework.components.gaxi.gaxi_sequence import GAXISequence
179
+ ```
180
+
181
+ ### Other Protocols
182
+
183
+ #### FIFO
184
+
185
+ Generic FIFO verification with masters, slaves, monitors, and command handling.
186
+
187
+ ```python
188
+ from CocoTBFramework.components.fifo.fifo_master import FIFOMaster
189
+ from CocoTBFramework.components.fifo.fifo_slave import FIFOSlave
190
+ from CocoTBFramework.components.fifo.fifo_monitor import FIFOMonitor
191
+ ```
192
+
193
+ #### SMBus (System Management Bus)
194
+
195
+ SMBus/I2C protocol verification with open-drain tristate signal handling and CRC-8 PEC.
196
+
197
+ ```python
198
+ from CocoTBFramework.components.smbus.smbus_components import SMBusMaster, SMBusSlave, SMBusMonitor
199
+ ```
200
+
201
+ #### UART
202
+
203
+ Serial UART protocol at the bit level.
204
+
205
+ ```python
206
+ from CocoTBFramework.components.uart.uart_components import UARTMaster, UARTSlave, UARTMonitor
207
+ ```
208
+
209
+ ---
210
+
211
+ ## Shared Utilities
212
+
213
+ Common infrastructure used across all protocol implementations.
214
+
215
+ ```python
216
+ from CocoTBFramework.components.shared.packet import Packet
217
+ from CocoTBFramework.components.shared.field_config import FieldConfig, FieldDefinition
218
+ from CocoTBFramework.components.shared.memory_model import MemoryModel
219
+ from CocoTBFramework.components.shared.flex_randomizer import FlexRandomizer
220
+ from CocoTBFramework.components.shared.packet_factory import PacketFactory
221
+ ```
222
+
223
+ | Module | Purpose |
224
+ |--------|---------|
225
+ | `packet.py` | Base class for all protocol packets with thread-safe field caching |
226
+ | `field_config.py` | Type-safe field configuration and definition system |
227
+ | `memory_model.py` | High-performance memory model with NumPy backend and region management |
228
+ | `flex_randomizer.py` | Constrained randomization with ranges, sequences, and function-based generators |
229
+ | `packet_factory.py` | Generic factory for creating packets across any protocol |
230
+ | `master_statistics.py` | Master component metrics (throughput, latency, violations) |
231
+ | `monitor_statistics.py` | Passive monitor statistics collection |
232
+ | `arbiter_master.py` | Universal arbiter master with weighted/unweighted support |
233
+ | `arbiter_monitor.py` | Round-robin and weighted arbitration monitoring |
234
+ | `arbiter_compliance.py` | Arbiter protocol correctness validation |
235
+ | `data_strategies.py` | Data collection and driving strategies |
236
+ | `signal_mapping_helper.py` | Signal-to-field mapping and resolution |
237
+ | `debug_object.py` | Base debugging utilities |
238
+ | `protocol_error_handler.py` | Protocol error handling and reporting |
239
+
240
+ ---
241
+
242
+ ## Scoreboards
243
+
244
+ Queue-based transaction verification with protocol-specific comparators and cross-protocol adapters.
245
+
246
+ ```python
247
+ from CocoTBFramework.scoreboards.base_scoreboard import BaseScoreboard
248
+ from CocoTBFramework.scoreboards.gaxi_scoreboard import GAXIScoreboard
249
+ from CocoTBFramework.scoreboards.fifo_scoreboard import FIFOScoreboard
250
+ from CocoTBFramework.scoreboards.apb_scoreboard import APBScoreboard
251
+ from CocoTBFramework.scoreboards.apb_gaxi_scoreboard import APBGAXIScoreboard
252
+ ```
253
+
254
+ | Scoreboard | Purpose |
255
+ |------------|---------|
256
+ | `BaseScoreboard` | Foundation with queue-based expected vs actual comparison |
257
+ | `GAXIScoreboard` | GAXI transaction verification with field configuration |
258
+ | `APBScoreboard` | APB transaction verification |
259
+ | `APBGAXIScoreboard` | APB-to-GAXI cross-protocol transformation verification |
260
+ | `FIFOScoreboard` | FIFO transaction verification with memory adapters |
261
+ | `AXI4DWidthConverterScoreboard` | AXI4 data width converter validation |
262
+
263
+ ### Cross-Protocol Adapters
264
+
265
+ ```python
266
+ from CocoTBFramework.scoreboards.apb_gaxi_transformer import APBtoGAXITransformer
267
+ ```
268
+
269
+ The scoreboard system includes transformers and adapters for verifying protocol bridges and converters (APB ↔ GAXI, GAXI ↔ Memory, etc.).
270
+
271
+ ---
272
+
273
+ ## Waveform Visualization
274
+
275
+ Generate WaveJSON timing diagrams from simulation signals.
276
+
277
+ ```python
278
+ from CocoTBFramework.components.wavedrom.wavejson_gen import WaveJSONGenerator
279
+ from CocoTBFramework.components.wavedrom.signal_binder import SignalBinder
280
+ from CocoTBFramework.components.wavedrom.constraint_solver import ConstraintSolver
281
+ ```
282
+
283
+ ---
284
+
285
+ ## Dependencies
286
+
287
+ ### Required
288
+
289
+ | Package | Purpose |
290
+ |---------|---------|
291
+ | `cocotb>=1.9.0` | Core simulation framework |
292
+ | `cocotb-bus>=0.2.1` | BusDriver/BusMonitor base classes |
293
+ | `cocotb-coverage>=1.2.0` | Coverage-driven verification |
294
+ | `psutil>=5.9.0` | System resource monitoring |
295
+ | `rich>=14.0.0` | Table display and formatting |
296
+ | `numpy>=2.0.0` | High-performance memory model backend |
297
+
298
+ ### Optional Extras
299
+
300
+ ```bash
301
+ pip install cocotb-framework[wavedrom] # OR-Tools for constraint solving
302
+ pip install cocotb-framework[crc] # CRC computation
303
+ pip install cocotb-framework[all] # All optional dependencies
304
+ ```
305
+
306
+ ---
307
+
308
+ ## Development
309
+
310
+ ```bash
311
+ # Install in development mode
312
+ pip install -e ".[dev,all]"
313
+
314
+ # Lint
315
+ ruff check src/
316
+
317
+ # Build distributable
318
+ python -m build
319
+ ```
320
+
321
+ ---
322
+
323
+ ## Related Projects
324
+
325
+ - [RTLDesignSherpa](https://github.com/sean-galloway/RTLDesignSherpa) — Parent project with 350+ RTL modules, testbenches, and verification infrastructure
326
+ - [cocotb](https://github.com/cocotb/cocotb) — Coroutine-based cosimulation framework
327
+ - [cocotb-bus](https://github.com/cocotb/cocotb-bus) — Bus driver and monitor base classes
328
+
329
+ ---
330
+
331
+ ## License
332
+
333
+ MIT License. See [LICENSE](LICENSE) for details.
@@ -0,0 +1,287 @@
1
+ # CocoTB Framework
2
+
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
5
+
6
+ Reusable CocoTB verification infrastructure for RTL testing. Provides protocol-specific Bus Functional Models (BFMs), transaction scoreboards, and shared utilities for AMBA and other standard interfaces.
7
+
8
+ Extracted from the [RTLDesignSherpa](https://github.com/sean-galloway/RTLDesignSherpa) project as a standalone, pip-installable package.
9
+
10
+ ---
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ pip install cocotb-framework
16
+ ```
17
+
18
+ With all optional dependencies:
19
+
20
+ ```bash
21
+ pip install cocotb-framework[all]
22
+ ```
23
+
24
+ For development:
25
+
26
+ ```bash
27
+ git clone https://github.com/sean-galloway/RTLDesignSherpa-DV.git
28
+ cd RTLDesignSherpa-DV
29
+ pip install -e ".[dev,all]"
30
+ ```
31
+
32
+ ---
33
+
34
+ ## Package Structure
35
+
36
+ ```
37
+ CocoTBFramework/
38
+ ├── components/ # Protocol-specific BFMs and drivers
39
+ │ ├── axi4/ # AXI4 full protocol
40
+ │ ├── axi5/ # AXI5 (AMBA5) protocol
41
+ │ ├── axil4/ # AXI4-Lite
42
+ │ ├── apb/ # APB protocol
43
+ │ ├── apb5/ # APB5 protocol
44
+ │ ├── axis4/ # AXI-Stream
45
+ │ ├── axis5/ # AXI-Stream v5
46
+ │ ├── fifo/ # Generic FIFO
47
+ │ ├── gaxi/ # GAXI — validate FIFO-based interfaces on small blocks
48
+ │ ├── smbus/ # System Management Bus
49
+ │ ├── uart/ # UART serial
50
+ │ ├── wavedrom/ # Waveform visualization
51
+ │ └── shared/ # Common utilities
52
+ └── scoreboards/ # Transaction verification
53
+ ├── base_scoreboard # Base class for all scoreboards
54
+ └── axi4/ # AXI4-specific scoreboards
55
+ ```
56
+
57
+ ---
58
+
59
+ ## Protocol BFMs
60
+
61
+ Each protocol package provides a complete set of verification components: **masters** (drivers), **slaves** (responders), **monitors** (passive observers), and **packets** (transaction representations).
62
+
63
+ ### AMBA Protocols
64
+
65
+ #### AXI4 (Advanced eXtensible Interface)
66
+
67
+ Full AXI4 protocol implementation with compliance checking and constrained randomization.
68
+
69
+ ```python
70
+ from CocoTBFramework.components.axi4.axi4_interfaces import AXI4MasterRead, AXI4MasterWrite
71
+ from CocoTBFramework.components.axi4.axi4_interfaces import AXI4SlaveRead, AXI4SlaveWrite
72
+ from CocoTBFramework.components.axi4.axi4_packet import AXI4Packet
73
+ from CocoTBFramework.components.axi4.axi4_compliance_checker import AXI4ComplianceChecker
74
+ from CocoTBFramework.components.axi4.axi4_randomization_manager import AXI4RandomizationManager
75
+ ```
76
+
77
+ **Key classes:**
78
+ - `AXI4MasterRead` / `AXI4MasterWrite` — Full-duplex master with integrated compliance
79
+ - `AXI4SlaveRead` / `AXI4SlaveWrite` — Slave responder with configurable timing
80
+ - `AXI4ComplianceChecker` — Protocol violation detection and tracking
81
+ - `AXI4RandomizationManager` — Constrained-random transaction generation
82
+ - `AXI4Packet` — Complete transaction representation with field formatting
83
+
84
+ #### AXI5
85
+
86
+ AMBA5-generation AXI with extended signals and features. Same class structure as AXI4.
87
+
88
+ ```python
89
+ from CocoTBFramework.components.axi5.axi5_interfaces import AXI5MasterRead, AXI5MasterWrite
90
+ from CocoTBFramework.components.axi5.axi5_compliance_checker import AXI5ComplianceChecker
91
+ ```
92
+
93
+ #### AXI4-Lite
94
+
95
+ Simplified AXI for register-mapped peripherals.
96
+
97
+ ```python
98
+ from CocoTBFramework.components.axil4.axil4_interfaces import AXIL4MasterRead, AXIL4MasterWrite
99
+ from CocoTBFramework.components.axil4.axil4_compliance_checker import AXIL4ComplianceChecker
100
+ ```
101
+
102
+ #### APB / APB5 (Advanced Peripheral Bus)
103
+
104
+ Simple bus protocol for low-bandwidth peripherals.
105
+
106
+ ```python
107
+ from CocoTBFramework.components.apb.apb_components import APBMaster, APBSlave, APBMonitor
108
+ from CocoTBFramework.components.apb.apb_packet import APBPacket
109
+ from CocoTBFramework.components.apb.apb_sequence import APBSequence
110
+ from CocoTBFramework.components.apb.apb_factories import create_apb_monitor, create_apb_scoreboard
111
+ ```
112
+
113
+ #### AXI-Stream (AXIS4 / AXIS5)
114
+
115
+ Unidirectional streaming with handshake.
116
+
117
+ ```python
118
+ from CocoTBFramework.components.axis4.axis_master import AXISMaster
119
+ from CocoTBFramework.components.axis4.axis_slave import AXISSlave
120
+ from CocoTBFramework.components.axis4.axis_monitor import AXISMonitor
121
+ from CocoTBFramework.components.axis4.axis_packet import AXISPacket
122
+ ```
123
+
124
+ ### Generic AXI (GAXI)
125
+
126
+ Lightweight valid/ready handshake protocol for validating individual FIFO-based interfaces on very small internal blocks. Interfaces can carry data packed into fields within a single bus, or have many discrete signals. Includes built-in coverage hooks and statistics tracking.
127
+
128
+ ```python
129
+ from CocoTBFramework.components.gaxi import GAXIMaster, GAXISlave, GAXIMonitor
130
+ from CocoTBFramework.components.gaxi import GaxiCoverageHook, register_coverage_hooks
131
+ from CocoTBFramework.components.gaxi.gaxi_packet import GAXIPacket
132
+ from CocoTBFramework.components.gaxi.gaxi_sequence import GAXISequence
133
+ ```
134
+
135
+ ### Other Protocols
136
+
137
+ #### FIFO
138
+
139
+ Generic FIFO verification with masters, slaves, monitors, and command handling.
140
+
141
+ ```python
142
+ from CocoTBFramework.components.fifo.fifo_master import FIFOMaster
143
+ from CocoTBFramework.components.fifo.fifo_slave import FIFOSlave
144
+ from CocoTBFramework.components.fifo.fifo_monitor import FIFOMonitor
145
+ ```
146
+
147
+ #### SMBus (System Management Bus)
148
+
149
+ SMBus/I2C protocol verification with open-drain tristate signal handling and CRC-8 PEC.
150
+
151
+ ```python
152
+ from CocoTBFramework.components.smbus.smbus_components import SMBusMaster, SMBusSlave, SMBusMonitor
153
+ ```
154
+
155
+ #### UART
156
+
157
+ Serial UART protocol at the bit level.
158
+
159
+ ```python
160
+ from CocoTBFramework.components.uart.uart_components import UARTMaster, UARTSlave, UARTMonitor
161
+ ```
162
+
163
+ ---
164
+
165
+ ## Shared Utilities
166
+
167
+ Common infrastructure used across all protocol implementations.
168
+
169
+ ```python
170
+ from CocoTBFramework.components.shared.packet import Packet
171
+ from CocoTBFramework.components.shared.field_config import FieldConfig, FieldDefinition
172
+ from CocoTBFramework.components.shared.memory_model import MemoryModel
173
+ from CocoTBFramework.components.shared.flex_randomizer import FlexRandomizer
174
+ from CocoTBFramework.components.shared.packet_factory import PacketFactory
175
+ ```
176
+
177
+ | Module | Purpose |
178
+ |--------|---------|
179
+ | `packet.py` | Base class for all protocol packets with thread-safe field caching |
180
+ | `field_config.py` | Type-safe field configuration and definition system |
181
+ | `memory_model.py` | High-performance memory model with NumPy backend and region management |
182
+ | `flex_randomizer.py` | Constrained randomization with ranges, sequences, and function-based generators |
183
+ | `packet_factory.py` | Generic factory for creating packets across any protocol |
184
+ | `master_statistics.py` | Master component metrics (throughput, latency, violations) |
185
+ | `monitor_statistics.py` | Passive monitor statistics collection |
186
+ | `arbiter_master.py` | Universal arbiter master with weighted/unweighted support |
187
+ | `arbiter_monitor.py` | Round-robin and weighted arbitration monitoring |
188
+ | `arbiter_compliance.py` | Arbiter protocol correctness validation |
189
+ | `data_strategies.py` | Data collection and driving strategies |
190
+ | `signal_mapping_helper.py` | Signal-to-field mapping and resolution |
191
+ | `debug_object.py` | Base debugging utilities |
192
+ | `protocol_error_handler.py` | Protocol error handling and reporting |
193
+
194
+ ---
195
+
196
+ ## Scoreboards
197
+
198
+ Queue-based transaction verification with protocol-specific comparators and cross-protocol adapters.
199
+
200
+ ```python
201
+ from CocoTBFramework.scoreboards.base_scoreboard import BaseScoreboard
202
+ from CocoTBFramework.scoreboards.gaxi_scoreboard import GAXIScoreboard
203
+ from CocoTBFramework.scoreboards.fifo_scoreboard import FIFOScoreboard
204
+ from CocoTBFramework.scoreboards.apb_scoreboard import APBScoreboard
205
+ from CocoTBFramework.scoreboards.apb_gaxi_scoreboard import APBGAXIScoreboard
206
+ ```
207
+
208
+ | Scoreboard | Purpose |
209
+ |------------|---------|
210
+ | `BaseScoreboard` | Foundation with queue-based expected vs actual comparison |
211
+ | `GAXIScoreboard` | GAXI transaction verification with field configuration |
212
+ | `APBScoreboard` | APB transaction verification |
213
+ | `APBGAXIScoreboard` | APB-to-GAXI cross-protocol transformation verification |
214
+ | `FIFOScoreboard` | FIFO transaction verification with memory adapters |
215
+ | `AXI4DWidthConverterScoreboard` | AXI4 data width converter validation |
216
+
217
+ ### Cross-Protocol Adapters
218
+
219
+ ```python
220
+ from CocoTBFramework.scoreboards.apb_gaxi_transformer import APBtoGAXITransformer
221
+ ```
222
+
223
+ The scoreboard system includes transformers and adapters for verifying protocol bridges and converters (APB ↔ GAXI, GAXI ↔ Memory, etc.).
224
+
225
+ ---
226
+
227
+ ## Waveform Visualization
228
+
229
+ Generate WaveJSON timing diagrams from simulation signals.
230
+
231
+ ```python
232
+ from CocoTBFramework.components.wavedrom.wavejson_gen import WaveJSONGenerator
233
+ from CocoTBFramework.components.wavedrom.signal_binder import SignalBinder
234
+ from CocoTBFramework.components.wavedrom.constraint_solver import ConstraintSolver
235
+ ```
236
+
237
+ ---
238
+
239
+ ## Dependencies
240
+
241
+ ### Required
242
+
243
+ | Package | Purpose |
244
+ |---------|---------|
245
+ | `cocotb>=1.9.0` | Core simulation framework |
246
+ | `cocotb-bus>=0.2.1` | BusDriver/BusMonitor base classes |
247
+ | `cocotb-coverage>=1.2.0` | Coverage-driven verification |
248
+ | `psutil>=5.9.0` | System resource monitoring |
249
+ | `rich>=14.0.0` | Table display and formatting |
250
+ | `numpy>=2.0.0` | High-performance memory model backend |
251
+
252
+ ### Optional Extras
253
+
254
+ ```bash
255
+ pip install cocotb-framework[wavedrom] # OR-Tools for constraint solving
256
+ pip install cocotb-framework[crc] # CRC computation
257
+ pip install cocotb-framework[all] # All optional dependencies
258
+ ```
259
+
260
+ ---
261
+
262
+ ## Development
263
+
264
+ ```bash
265
+ # Install in development mode
266
+ pip install -e ".[dev,all]"
267
+
268
+ # Lint
269
+ ruff check src/
270
+
271
+ # Build distributable
272
+ python -m build
273
+ ```
274
+
275
+ ---
276
+
277
+ ## Related Projects
278
+
279
+ - [RTLDesignSherpa](https://github.com/sean-galloway/RTLDesignSherpa) — Parent project with 350+ RTL modules, testbenches, and verification infrastructure
280
+ - [cocotb](https://github.com/cocotb/cocotb) — Coroutine-based cosimulation framework
281
+ - [cocotb-bus](https://github.com/cocotb/cocotb-bus) — Bus driver and monitor base classes
282
+
283
+ ---
284
+
285
+ ## License
286
+
287
+ MIT License. See [LICENSE](LICENSE) for details.