1010# 2. generate-matrix: Uses nox's JSON output to discover test sessions
1111# 3. tests-ahb: Runs all AHB-tagged tests in parallel (one job per test)
1212# 4. tests-axi: Runs all AXI-tagged tests in parallel (one job per test)
13- # 5. tests-axi-controller: Runs all AXI-Controller tests in parallel
14- # 6. test-results: Aggregates results from all test jobs
15- # 7. docs-build: Builds and deploys documentation (only after tests pass)
13+ # 5. tests-axi-controller-and-target: Runs all AXI-Controller tests in parallel
14+ # 6. tests-axi-controller-only: Runs all AXI-Controller only tests in parallel
15+ # 7. test-results: Aggregates results from all test jobs
16+ # 8. docs-build: Builds and deploys documentation (only after tests pass)
1617#
1718# Optional: Long-running tests (i3c_ahb_verify, i3c_axi_verify) can be split
1819# into individual parametrized runs by enabling SPLIT_TESTS in generate-matrix.
@@ -30,7 +31,7 @@ permissions:
3031
3132env :
3233 DEBIAN_FRONTEND : " noninteractive"
33- VERILATOR_VERSION : " v5.046 "
34+ VERILATOR_VERSION : " v5.050 "
3435 WAVES : " 0"
3536
3637jobs :
8990 outputs :
9091 ahb-matrix : ${{ steps.gen.outputs.ahb_matrix }}
9192 axi-matrix : ${{ steps.gen.outputs.axi_matrix }}
92- axi-controller-matrix : ${{ steps.gen.outputs.axi_controller_matrix }}
93+ axi-controller-and-target-matrix : ${{ steps.gen.outputs.axi_controller_and_target_matrix }}
94+ axi-controller-only-matrix : ${{ steps.gen.outputs.axi_controller_only_matrix }}
9395 steps :
9496 - name : Checkout repository
9597 uses : actions/checkout@v4
@@ -117,11 +119,16 @@ jobs:
117119 # Long-running tests that should be split into individual parametrized runs
118120 SPLIT_TESTS = {"i3c_ahb_verify", "i3c_axi_verify"}
119121
120- # Use nox's native JSON output to list all sessions
122+ # We set DUT_CONFIG to controller_and_target to force nox to
123+ # expose all tests, so we can route them ourselves based on tags.
121124 result = subprocess.run(
122125 ["nox", "-l", "--json", "-f", "noxfile.py"],
123126 capture_output=True, text=True,
124- env={**os.environ, "PYTHONDONTWRITEBYTECODE": "1"}
127+ env={
128+ **os.environ,
129+ "PYTHONDONTWRITEBYTECODE": "1",
130+ "DUT_CONFIG": "controller_and_target"
131+ }
125132 )
126133
127134 if result.returncode != 0:
@@ -142,45 +149,59 @@ jobs:
142149
143150 ahb_tests = set()
144151 axi_tests = set()
145- axi_controller_tests = set()
152+ axi_controller_and_target_tests = set()
153+ axi_controller_only_tests = set()
146154
147155 for session in sessions:
148156 tags = session.get("tags", [])
149157
150- # Only process test sessions (tagged with 'tests')
151158 if "tests" not in tags:
152159 continue
153160
154161 name = session["name"]
155- has_ahb = "ahb" in tags
156- has_axi = "axi" in tags
157- has_axi_controller = "axi-controller" in tags # Or "axi_controller" if your nox tags use underscores
158-
162+
159163 if name in SPLIT_TESTS:
160164 session_id = session["session"]
161165 else:
162166 session_id = name
163167
164- # Categorize tests by bus configuration
168+ # Check for specific role/bus tags
169+ has_ahb = "ahb" in tags
170+ has_axi = "axi" in tags
171+ has_controller = "controller" in tags
172+ has_target = "target" in tags
173+
165174 if has_ahb:
166175 ahb_tests.add(session_id)
176+
167177 if has_axi:
168- axi_tests.add(session_id)
169- if has_axi_controller:
170- axi_controller_tests.add(session_id)
178+ if has_controller:
179+ # If it has a controller tag, it always runs in the combined job
180+ axi_controller_and_target_tests.add(session_id)
181+
182+ # Exclude tests that also require a target from the controller_only job
183+ if not has_target:
184+ axi_controller_only_tests.add(session_id)
185+ else:
186+ # Standard AXI tests (target-only, no controller tag)
187+ axi_tests.add(session_id)
171188
172189 # Sort for consistent ordering
173190 ahb_tests = sorted(ahb_tests)
174191 axi_tests = sorted(axi_tests)
175- axi_controller_tests = sorted(axi_controller_tests)
192+ axi_controller_and_target_tests = sorted(axi_controller_and_target_tests)
193+ axi_controller_only_tests = sorted(axi_controller_only_tests)
176194
177- print(f"Discovered {len(ahb_tests)} AHB tests, {len(axi_tests)} AXI tests, and {len(axi_controller_tests)} AXI-Controller tests")
195+ print(f"Discovered {len(ahb_tests)} AHB tests")
196+ print(f"Discovered {len(axi_tests)} AXI (Target-Only) tests")
197+ print(f"Discovered {len(axi_controller_and_target_tests)} AXI-Controller+Target tests")
198+ print(f"Discovered {len(axi_controller_only_tests)} AXI-Controller-Only tests")
178199
179- # Output matrices for subsequent jobs
180200 with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
181201 f.write(f"ahb_matrix={json.dumps(ahb_tests)}\n")
182202 f.write(f"axi_matrix={json.dumps(axi_tests)}\n")
183- f.write(f"axi_controller_matrix={json.dumps(axi_controller_tests)}\n")
203+ f.write(f"axi_controller_and_target_matrix={json.dumps(axi_controller_and_target_tests)}\n")
204+ f.write(f"axi_controller_only_matrix={json.dumps(axi_controller_only_tests)}\n")
184205 EOF
185206
186207 lint-testplans :
@@ -256,7 +277,7 @@ jobs:
256277 TEST_SESSION : ${{ matrix.test }}
257278 run : |
258279 source activate.sh
259- make config CFG_NAME=ahb
280+ make config CFG_NAME=ahb_target_only
260281 cd verification/cocotb && python -m nox -R -s "$TEST_SESSION" --no-venv --forcecolor
261282
262283 - name : Display test logs on failure
@@ -339,7 +360,7 @@ jobs:
339360 TEST_SESSION : ${{ matrix.test }}
340361 run : |
341362 source activate.sh
342- make config CFG_NAME=axi
363+ make config CFG_NAME=axi_target_only
343364 cd verification/cocotb && python -m nox -R -s "$TEST_SESSION" --no-venv --forcecolor
344365
345366 - name : Display test logs on failure
@@ -367,16 +388,16 @@ jobs:
367388 verification/cocotb/**/*.log
368389
369390 # ===========================================================================
370- # Job: Run AXI-Controller Tests (Parallel)
391+ # Job: Run AXI-Controller and Target Tests (Parallel)
371392 # ===========================================================================
372- tests-axi-controller :
373- name : " AXI-Ctrl: ${{ matrix.test }}"
393+ tests-axi-controller-and-target :
394+ name : " AXI-Ctrl+Target : ${{ matrix.test }}"
374395 needs : [generate-matrix, lint-testplans]
375396 runs-on : ubuntu-latest
376397 strategy :
377398 fail-fast : false
378399 matrix :
379- test : ${{ fromJson(needs.generate-matrix.outputs.axi-controller-matrix) }}
400+ test : ${{ fromJson(needs.generate-matrix.outputs.axi-controller-and-target- matrix) }}
380401 steps :
381402 - name : Install system dependencies
382403 run : |
@@ -422,11 +443,12 @@ jobs:
422443 TEST_SESSION : ${{ matrix.test }}
423444 CONTROLLER_SUPPORT : " 1"
424445 TARGET_SUPPORT : " 1"
425- CFG_NAME : " axi-controller"
446+ DUT_CONFIG : " controller_and_target"
447+ CFG_NAME : " axi_controller_and_target_sim"
426448 I3C_ROOT_DIR : ${{ github.workspace }}
427449 run : |
428450 source activate.sh
429- make config CFG_NAME=axi-controller
451+ make config CFG_NAME=axi_controller_and_target_sim
430452 cd verification/cocotb && python -m nox -R -s "$TEST_SESSION" --no-venv --forcecolor
431453
432454 - name : Display test logs on failure
@@ -448,7 +470,100 @@ jobs:
448470 if : always()
449471 uses : actions/upload-artifact@v4
450472 with :
451- name : test-results-axi-controller-${{ steps.sanitize.outputs.name }}
473+ name : test-results-axi-controller-and-target-${{ steps.sanitize.outputs.name }}
474+ path : |
475+ verification/cocotb/**/*.xml
476+ verification/cocotb/**/*.log
477+
478+ # ===========================================================================
479+ # Job: Run AXI-Controller Only Tests (Parallel)
480+ # ===========================================================================
481+ tests-axi-controller-only :
482+ name : " AXI-Ctrl Only: ${{ matrix.test }}"
483+ needs : [generate-matrix, lint-testplans]
484+ runs-on : ubuntu-latest
485+ strategy :
486+ fail-fast : false
487+ matrix :
488+ test : ${{ fromJson(needs.generate-matrix.outputs.axi-controller-only-matrix) }}
489+ steps :
490+ - name : Install system dependencies
491+ run : |
492+ sudo apt -qqy update
493+ sudo apt -qqy --no-install-recommends install \
494+ help2man libfl-dev make g++ git bison flex gperf \
495+ libreadline-dev libbz2-dev autoconf
496+
497+ - name : Checkout repository
498+ uses : actions/checkout@v4
499+
500+ - name : Initialize submodules
501+ run : git submodule update --init --recursive
502+
503+ - name : Cache Verilator installation
504+ id : cache-verilator
505+ uses : actions/cache@v4
506+ with :
507+ path : ~/verilator-install
508+ key : verilator-install-${{ env.VERILATOR_VERSION }}-${{ runner.os }}
509+
510+ - name : Build Verilator (if not cached)
511+ if : steps.cache-verilator.outputs.cache-hit != 'true'
512+ run : |
513+ git clone https://github.com/verilator/verilator -b ${{ env.VERILATOR_VERSION }}
514+ cd verilator
515+ autoconf
516+ ./configure --prefix=$HOME/verilator-install
517+ make -j$(nproc)
518+ make install
519+
520+ - name : Add Verilator to PATH
521+ run : |
522+ echo "$HOME/verilator-install/bin" >> $GITHUB_PATH
523+ echo "VERILATOR_ROOT=$HOME/verilator-install/share/verilator" >> $GITHUB_ENV
524+
525+ - name : Setup Python environment (pyenv + dependencies)
526+ run : ./install.sh
527+
528+ - name : Configure RTL and run test
529+ id : run-test
530+ env :
531+ TEST_SESSION : ${{ matrix.test }}
532+ CONTROLLER_SUPPORT : " 1"
533+ TARGET_SUPPORT : " 0"
534+ DUT_CONFIG : " controller_only"
535+ CFG_NAME : " axi_controller_only_sim"
536+ I3C_ROOT_DIR : ${{ github.workspace }}
537+ run : |
538+ source activate.sh
539+ make config CFG_NAME=axi_controller_only_sim
540+ cd verification/cocotb && python -m nox -R -s "$TEST_SESSION" --no-venv --forcecolor
541+
542+ - name : Display test logs on failure
543+ if : failure() && steps.run-test.outcome == 'failure'
544+ run : |
545+ echo "=== Test failed - displaying log files ==="
546+ find verification/cocotb -name "*.log" -type f -exec sh -c \
547+ 'echo ""; echo "========================================"; echo "=== {} ==="; echo "========================================"; cat "{}"' \;
548+
549+ - name : Rename XML results to avoid collisions
550+ if : always()
551+ run : |
552+ find verification/cocotb -name "*.xml" -exec sh -c 'mv "$1" "${1%.xml}_ctrl_only.xml"' _ {} \;
553+
554+ - name : Sanitize artifact name
555+ if : always()
556+ id : sanitize
557+ run : |
558+ NAME='${{ matrix.test }}'
559+ SANITIZED=$(echo "$NAME" | sed "s/[()='\" ,]/_/g" | sed 's/__*/_/g' | sed 's/_$//')
560+ echo "name=$SANITIZED" >> $GITHUB_OUTPUT
561+
562+ - name : Upload test artifacts
563+ if : always()
564+ uses : actions/upload-artifact@v4
565+ with :
566+ name : test-results-axi-controller-only-${{ steps.sanitize.outputs.name }}
452567 path : |
453568 verification/cocotb/**/*.xml
454569 verification/cocotb/**/*.log
@@ -458,7 +573,7 @@ jobs:
458573 # ===========================================================================
459574 test-results :
460575 name : Aggregate test results
461- needs : [tests-ahb, tests-axi, tests-axi-controller]
576+ needs : [tests-ahb, tests-axi, tests-axi-controller-and-target, tests-axi-controller-only ]
462577 if : always()
463578 runs-on : ubuntu-latest
464579 steps :
@@ -487,11 +602,13 @@ jobs:
487602 run : |
488603 if [ "${{ needs.tests-ahb.result }}" != "success" ] || \
489604 [ "${{ needs.tests-axi.result }}" != "success" ] || \
490- [ "${{ needs.tests-axi-controller.result }}" != "success" ]; then
605+ [ "${{ needs.tests-axi-controller-and-target.result }}" != "success" ] || \
606+ [ "${{ needs.tests-axi-controller-only.result }}" != "success" ]; then
491607 echo "❌ Some tests failed!"
492608 echo " AHB tests: ${{ needs.tests-ahb.result }}"
493609 echo " AXI tests: ${{ needs.tests-axi.result }}"
494- echo " AXI-Ctrl tests: ${{ needs.tests-axi-controller.result }}"
610+ echo " AXI-Ctrl and Target tests: ${{ needs.tests-axi-controller-and-target.result }}"
611+ echo " AXI-Ctrl only tests: ${{ needs.tests-axi-controller-only.result }}"
495612 exit 1
496613 fi
497614 echo "✅ All tests passed!"
@@ -555,7 +672,11 @@ jobs:
555672 else
556673 echo "WARNING: No test results found to copy!"
557674 fi
558- echo "=== XML files in verification/cocotb ==="
675+ echo "Filtering out controller_only test results from documentation generation..."
676+ find verification/cocotb -name "*_ctrl_only.xml" -type f -delete
677+ find verification/cocotb -name "*_ctrl_only.log" -type f -delete
678+
679+ echo "=== Surviving XML files in verification/cocotb ==="
559680 find verification/cocotb -name "*.xml" -type f | head -10
560681
561682 XML_COUNT=$(find verification/cocotb -name "*.xml" -type f | wc -l)
0 commit comments