Skip to content

Add cocotb unit tests for protocols/line-codes#1390

Merged
bengineerd merged 14 commits intopre-releasefrom
line-codes-tests
Apr 13, 2026
Merged

Add cocotb unit tests for protocols/line-codes#1390
bengineerd merged 14 commits intopre-releasefrom
line-codes-tests

Conversation

@bengineerd
Copy link
Copy Markdown
Contributor

Description

Rewrite the protocols/line-codes regression suite into a cleaner package/entity/integration layout, add direct encoder/decoder coverage for all three line-code families, preserve package-level disparity-seed testing with checked-in wrappers, and expand nearby AXI/DMA verification updates already present on verification-2. This branch also drops the temporary planning artifacts under docs/_meta so the PR stays focused on executable verification changes instead of handoff notes.

Details

The line-code test suite is restructured around a shared helper at tests/protocols/line_codes/line_code_test_utils.py with three explicit layers:

  • package-surface benches using checked-in wrappers:
    • protocols/line-codes/wrappers/Code8b10bPkgWrapper.vhd
    • protocols/line-codes/wrappers/Code10b12bPkgWrapper.vhd
    • protocols/line-codes/wrappers/Code12b14bPkgWrapper.vhd
  • direct entity benches:
    • tests/protocols/line_codes/test_Encoder8b10b.py
    • tests/protocols/line_codes/test_Decoder8b10b.py
    • tests/protocols/line_codes/test_Encoder10b12b.py
    • tests/protocols/line_codes/test_Decoder10b12b.py
    • tests/protocols/line_codes/test_Encoder12b14b.py
    • tests/protocols/line_codes/test_Decoder12b14b.py
  • small family integration smokes:
    • tests/protocols/line_codes/test_LineCode8b10bIntegration.py
    • tests/protocols/line_codes/test_LineCode10b12bIntegration.py
    • tests/protocols/line_codes/test_LineCode12b14bIntegration.py

The old duplicated LineCode*Wrapper.vhd adapters and test_LineCode*.py wrapper benches are removed in favor of the cleaner split above.

The new package-level coverage exposed and fixes an illegal-K disparity edge case in protocols/line-codes/rtl/Code12b14bPkg.vhd.

@ruck314 ruck314 mentioned this pull request Apr 3, 2026
@ruck314 ruck314 mentioned this pull request Apr 13, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restructures the protocols/line-codes regression suite into clearer package/entity/integration layers, adds direct encoder/decoder coverage for each line-code family, and fixes an illegal-K disparity edge case in the 12b14b package.

Changes:

  • Replaced legacy wrapper-based line-code tests with a layered suite (package wrappers + entity benches + small integration smokes).
  • Added shared cocotb utilities in line_code_test_utils.py to standardize reset/clocking, encode/decode shims, and test runners.
  • Fixed Code12b14bPkg.encode12b14b to avoid using an uninitialized disparity term on illegal-K requests.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/protocols/line_codes/test_LineCode8b10bIntegration.py Adds small end-to-end smoke coverage using the existing LineCode8b10bTb.
tests/protocols/line_codes/test_LineCode8b10b.py Removes legacy wrapper-based round-trip sweep test.
tests/protocols/line_codes/test_LineCode12b14bIntegration.py Adds small end-to-end smoke coverage (including a short training prefix) using LineCode12b14bTb.
tests/protocols/line_codes/test_LineCode12b14b.py Removes legacy wrapper-based exhaustive round-trip test.
tests/protocols/line_codes/test_LineCode10b12bIntegration.py Adds small end-to-end smoke coverage using LineCode10b12bTb.
tests/protocols/line_codes/test_LineCode10b12b.py Removes legacy wrapper-based round-trip sweep test.
tests/protocols/line_codes/test_Encoder8b10b.py Adds encoder entity tests covering flow-control hold and clkEn gating across width/reset variants.
tests/protocols/line_codes/test_Encoder10b12b.py Adds encoder entity tests covering flow-control hold and clkEn gating across reset variants.
tests/protocols/line_codes/test_Encoder12b14b.py Adds encoder entity tests covering flow-control hold and debug disparity behavior across reset variants.
tests/protocols/line_codes/test_Decoder8b10b.py Adds decoder entity tests for malformed symbol error flagging and clkEn gating.
tests/protocols/line_codes/test_Decoder10b12b.py Adds decoder entity tests for malformed symbol error flagging and clkEn gating.
tests/protocols/line_codes/test_Decoder12b14b.py Adds decoder entity tests for malformed symbol error flagging and clkEn gating (incl. debug disparity modes).
tests/protocols/line_codes/test_Code8b10bPkg.py Adds package-level encode/decode coverage using a checked-in wrapper across disparity seeds.
tests/protocols/line_codes/test_Code10b12bPkg.py Adds package-level encode/decode coverage using a checked-in wrapper across disparity seeds.
tests/protocols/line_codes/test_Code12b14bPkg.py Adds package-level encode/decode coverage including illegal-K (invalidK) checks and transition/training sequences.
tests/protocols/line_codes/line_code_test_utils.py Introduces shared test helpers for reset/clocking, package/entity/integration runners, and common assertions.
protocols/line-codes/wrappers/LineCode8b10bWrapper.vhd Removes legacy cocotb-facing wrapper for 8b10b round-trip testing.
protocols/line-codes/wrappers/LineCode10b12bWrapper.vhd Removes legacy cocotb-facing wrapper for 10b12b round-trip testing.
protocols/line-codes/wrappers/LineCode12b14bWrapper.vhd Removes legacy cocotb-facing wrapper for 12b14b round-trip testing.
protocols/line-codes/wrappers/Code8b10bPkgWrapper.vhd Adds checked-in package wrapper to exercise Code8b10bPkg encode/decode procedures directly.
protocols/line-codes/wrappers/Code10b12bPkgWrapper.vhd Adds checked-in package wrapper to exercise Code10b12bPkg encode/decode procedures directly.
protocols/line-codes/wrappers/Code12b14bPkgWrapper.vhd Adds checked-in package wrapper to exercise Code12b14bPkg encode/decode directly, including invalidK.
protocols/line-codes/rtl/Code12b14bPkg.vhd Fixes illegal-K handling to avoid uninitialized disparity usage and preserve dispOut on invalid K.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread protocols/line-codes/wrappers/Code8b10bPkgWrapper.vhd
Comment thread protocols/line-codes/wrappers/Code10b12bPkgWrapper.vhd
Comment thread tests/protocols/line_codes/test_Code8b10bPkg.py Outdated
Comment thread tests/protocols/line_codes/test_Code10b12bPkg.py Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/protocols/line_codes/test_Code12b14bPkg.py
Comment thread tests/protocols/line_codes/line_code_test_utils.py
@bengineerd bengineerd changed the title Line codes tests Add cocotb unit tests for protocols/line-codes Apr 13, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread protocols/line-codes/rtl/Code12b14bPkg.vhd
@bengineerd bengineerd merged commit 58dc39c into pre-release Apr 13, 2026
5 checks passed
@bengineerd bengineerd deleted the line-codes-tests branch April 13, 2026 20:53
@ruck314 ruck314 mentioned this pull request Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants