46 Commits

Author SHA1 Message Date
Arnav Sacheti
f0f25a6d92 update devcontainer extensions 2025-11-12 07:20:11 +00:00
Arnav Sacheti
a9653c8497 Tests/cocotb (#19)
* wip

* reorg

* update sv int

* apb4 working

* apb3 working

* version bump + ignore runner warning

* remove redundant check

* adding log on failure

* cleaning up verilator version issue

* devcontainer

* Fix missing libpython in GitHub Actions CI environment (#21)

* Initial plan

* Install libpython in GitHub Actions for cocotb tests

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
v0.5.0
2025-11-10 23:00:28 -08:00
Copilot
d7481e71ba Fix max_decode_depth to control decoder hierarchy and port generation (#18)
* Initial plan

* Fix max_decode_depth to properly control decoder hierarchy and port generation

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Fix test that relied on old depth behavior

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Update documentation for max_decode_depth parameter

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* fix format

* Add variable_depth RDL file and smoke tests for max_decode_depth parameter

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Add variable depth tests for APB3 and AXI4-Lite CPUIFs

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* fix

* fix

* bump

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>
v0.4.0
2025-10-28 23:38:54 -07:00
Arnav Sacheti
858a7870ad version bump v0.3.0 2025-10-28 22:06:49 -07:00
Copilot
3d823572cc Fix nonconstant index errors in Questa by using unpacked structs and interface array intermediates (#17)
* Initial plan

* Fix nonconstant index error by using unpacked structs and arrays

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Add comprehensive tests for Questa compatibility with instance arrays

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Add intermediate signals for interface array fanin to fix Questa compatibility

Questa simulator rejects indexing interface arrays with non-constant variables in procedural blocks (always_comb). This fix creates intermediate unpacked array signals that are assigned from interface arrays using generate loops (with genvar), then references those intermediates in the fanin logic.

Changes:
- Added fanin_intermediate_gen.py to generate intermediate signals
- Modified APB3/APB4/AXI4-Lite cpuif classes to use intermediates for interface arrays
- Updated templates to include intermediate signal section
- Intermediate signals use genvar indexing (legal) instead of variable indexing (illegal in Questa)

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Fix type checking and formatting issues in fanin intermediate generator

- Added proper null checks for node.array_dimensions to avoid type errors
- Used getattr() to safely access is_interface and _interface attributes
- Added early returns when interface is None to prevent errors
- Fixed formatting issues in fanin_intermediate_gen.py
- All type checks now pass (only pre-existing errors remain in other files)
- All 67 tests still pass

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Fix test collection when cocotb is not installed

The cocotb test files (test_runner.py) have imports that fail at module level when cocotb is not installed, causing pytest collection to fail. This prevents running tests in environments without cocotb dependencies.

Solution: Updated conftest.py to conditionally ignore cocotb tests when cocotb is not available, allowing tests to pass in both environments (with and without cocotb).

- When cocotb is available: only ignore test_register_access.py files (existing behavior)
- When cocotb is not available: ignore all files under cocotb/** directories

This allows CI to run all 67 non-simulation tests successfully without requiring cocotb/verilator dependencies for basic testing.

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* add default for unpacked struct

* cocotb is test dependancy

* Refactor fanin intermediate signal logic to cpuif level

Moved the interface-specific signal assignment logic from fanin_intermediate_gen.py to individual cpuif classes (APB3Cpuif, APB4Cpuif, AXI4LiteCpuif). This follows better architecture principles where each cpuif knows which signals it needs.

Changes:
- Added fanin_intermediate_assignments() method to BaseCpuif
- Implemented fanin_intermediate_assignments() in APB3Cpuif, APB4Cpuif, and AXI4LiteCpuif
- Updated FaninIntermediateGenerator to call the cpuif method instead of checking interface type
- Removed interface type checking logic from fanin_intermediate_gen.py

This makes the code more maintainable and follows the single responsibility principle - each cpuif class knows its own signal requirements.

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>
2025-10-28 22:03:57 -07:00
Arnav Sacheti
f829e3894f format xargs 2025-10-27 20:34:41 -07:00
Arnav Sacheti
74eb2344b1 change to pypi gh action 2025-10-26 19:53:13 -07:00
Arnav Sacheti
ae17384b3b version bump v0.2.0 2025-10-26 19:06:29 -07:00
Copilot
b80f166997 Export master interface address widths in package parameters (#16)
* Initial plan

* Add master address width parameters to exported package

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>
2025-10-26 19:05:45 -07:00
Copilot
95fda3abaa Refactor cpuif classes to use Interface abstraction (#14)
* Initial plan

* Refactor cpuif classes to use Interface abstraction

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Fix type annotation consistency in Interface.signal()

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Add runtime validation and documentation for indexer types

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Remove unused variable in SVInterface.signal()

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Fix master port directions in APB3 and APB4 flat interfaces

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Fix AXI4LiteCpuifFlat and apply code formatting

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* PSELx -> PSEL

* cleanup marker warnings

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>
2025-10-26 18:47:11 -07:00
Arnav Sacheti
1eababe1ab remove cocotb -sim.yml 2025-10-26 18:00:53 -07:00
Arnav Sacheti
b1f1bf983a Refactor tests (better grouping + cocotb support) (#15)
* initial refactor

* fix cocotb tests

* fix typecheck

* install verilator
2025-10-26 17:56:35 -07:00
Arnav Sacheti
93276ff616 fix (#13)
* fix

* fix pyrefly

* remove tests

* Update tests/unit/test_exporter.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/peakrdl_busdecoder/listener.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update tests/unit/test_exporter.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix iter

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-26 14:40:03 -07:00
Copilot
c9addd6ac2 Fix decoder generation for external nested addressable components and add max-decode-depth parameter (#12)
* Initial plan

* Fix bus decoder to skip external nested components

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Optimize external children check using generator expressions

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Add max-decode-depth CLI argument

Added --max-decode-depth argument that:
- Is added to CLI arguments in __peakrdl__.py
- Piped into design state via ExporterKwargs and DesignStateKwargs
- Used to control max depth in listener.py
- All 66 tests pass including new test for the parameter

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>
2025-10-25 19:56:49 -07:00
Copilot
04971bdb8e Fix non-synthesizable code generation for nested addrmaps with arrays (#11)
* Initial plan

* Fix non-synthesizable code for nested addrmaps with arrays

Fixed bug where array dimensions were used instead of strides in decode logic.
For nested addrmaps with arrays like inner[4] @ 0x0 += 0x100, the generated
code was incorrectly using the dimension (4) instead of the stride (0x100).
This resulted in non-synthesizable SystemVerilog with incorrect address decoding.

The fix calculates proper strides for each dimension, including support for
multi-dimensional arrays like [2][3] where each dimension has a different stride.

Added comprehensive tests to prevent regression.

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Improve code comments for stride calculation clarity

Added more detailed comments explaining the stride calculation logic,
including a concrete example showing how strides are calculated for
multi-dimensional arrays.

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>
2025-10-24 10:35:28 -07:00
Copilot
9b6dbc30e2 Fix APB4 assertion syntax for Questa 2025 compatibility (#10)
* Initial plan

* Fix APB4 assertion syntax for Questa 2025 compatibility

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>
2025-10-24 09:00:32 -07:00
Copilot
4dc61d24ca Add cocotb testbench for validating generated bus decoder RTL across APB3, APB4, and AXI4-Lite interfaces (#9)
* Initial plan

* Add cocotb test infrastructure and testbenches for APB3, APB4, and AXI4-Lite

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Add integration tests, examples, and documentation for cocotb testbenches

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Address code review feedback: use relative imports and update installation docs

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Add implementation summary document

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Merge cocotb dependencies into test group

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Add optional cocotb simulation workflow with Icarus Verilog

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>
2025-10-23 23:46:51 -07:00
Arnav Sacheti
0b98165ccc update tmpl 2025-10-23 23:42:17 -07:00
Copilot
6489f49873 Update documentation to use correct repository name PeakRDL-BusDecoder and clarify project purpose (#7)
* Initial plan

* Update documentation to use correct repository name PeakRDL-BusDecoder

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Update CONTRIBUTING.md and GitHub templates with correct repository name

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Update author to arnavsacheti and clarify bus decoder purpose in documentation

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Update author to 'Arnav Sacheti' and revise UDP documentation to reflect no current UDP support

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>
v0.1.0
2025-10-23 23:23:10 -07:00
Copilot
8cfd2a86c1 Fix status checks: lint, format, typecheck, and tests (#8)
* Initial plan

* Initial assessment - identifying issues to fix

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Fix type check and test issues to pass all status checks

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Add coverage.xml to .gitignore and remove from tracking

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Use more specific pattern for coverage.xml in .gitignore

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>
2025-10-23 23:22:09 -07:00
Arnav Sacheti
26a69a2286 no more docs on PRs 2025-10-23 23:04:52 -07:00
Arnav Sacheti
2d235f885d splti github actions up 2025-10-23 22:44:00 -07:00
Arnav Sacheti
3380e68b9b export axi4 lite cpuif 2025-10-23 22:38:53 -07:00
Arnav Sacheti
0ce469eb73 fix lint 2025-10-23 22:33:36 -07:00
Copilot
4b87556135 Add comprehensive test suite for PeakRDL-BusDecoder with sub-block and integration tests (#6)
* Initial plan

* Add comprehensive test suite for PeakRDL-BusDecoder

- Added tests for utility functions (clog2, is_pow2, roundup_pow2, get_indexed_path)
- Added tests for body classes (Body, ForLoopBody, IfBody, CombinationalBody, StructBody)
- Added tests for code generators (DecodeLogicGenerator, StructGenerator)
- Added tests for DesignState configuration
- Added integration tests for BusDecoderExporter
- Added tests for APB4 interface generation
- Fixed conftest to properly handle RDLCompiler and temporary files
- All 56 tests passing

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Format test files with ruff

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>
2025-10-23 22:26:03 -07:00
Copilot
2ca1ce4e27 Fix --unroll CLI argument to properly unroll arrays instead of repeating them (#5)
* Initial plan

* Fix --unroll CLI argument to properly unroll arrays

Updated check_is_array() method and all CPUIF implementations to correctly detect and handle unrolled array elements. When unroll=True, each array element is now treated as an individual instance instead of being repeated as an array.

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

* Add comprehensive tests for --unroll functionality

Created tests to verify that array elements are correctly unrolled into individual instances when --unroll flag is used. Also fixed conftest.py fixture to keep temp files for later reference.

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>
2025-10-23 22:23:49 -07:00
Copilot
516da7a43b Fix broken APB3 and APB4 flat bus decoder implementations (#4)
* Initial plan

* Fix APB3 and APB4 flat bus decoder implementations by adding missing fanout, fanin, and readback methods

Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: arnavsacheti <36746504+arnavsacheti@users.noreply.github.com>
2025-10-23 22:21:10 -07:00
Arnav Sacheti
740d4a84ac added apb3 and axi4_lite 2025-10-21 22:29:10 -07:00
Arnav Sacheti
395f584f52 apb4 if working? 2025-10-20 22:09:25 -07:00
Arnav Sacheti
f956232a62 fanout/fainin wip 2025-10-20 07:15:47 -07:00
Arnav Sacheti
e210167f2e typecheck + fanout/fanin 2025-10-19 22:26:13 -07:00
Arnav Sacheti
eb5e64b151 format 2025-10-19 21:52:12 -07:00
Arnav Sacheti
bafebf8595 refactor to use base listener for busdecoder 2025-10-19 21:35:17 -07:00
Arnav Sacheti
be116def83 Merge pull request #1 from arnavsacheti/codex/refactor-tests-directory-for-unit-tests
Replace simulator-driven tests with pytest unit scaffolding
2025-10-19 16:49:36 -07:00
Arnav Sacheti
cca98098da Simplify test suite to pytest unit scaffolding 2025-10-19 16:48:25 -07:00
Arnav Sacheti
bb1ac6bde9 decoder compiles 2025-10-19 00:06:45 -07:00
Arnav Sacheti
0c66453ba0 adding decoder logic 2025-10-16 22:35:36 -07:00
Arnav Sacheti
2937624ee7 fix links 2025-10-14 20:42:40 -07:00
Arnav Sacheti
066d9ca99e format + module update 2025-10-13 22:06:51 -07:00
Arnav Sacheti
54a199ca9c uvx format 2025-10-13 20:14:46 -07:00
Arnav Sacheti
3eee8b9cdd nvm composite action doesnt work 2025-10-13 19:48:58 -07:00
Arnav Sacheti
4492adb618 forgot runs-on 2025-10-13 19:32:20 -07:00
Arnav Sacheti
ff237150f4 consolidate common action setup + migrate to ruff and pyrefly 2025-10-13 19:31:39 -07:00
Arnav Sacheti
35015d7051 "updt" 2025-10-13 18:39:19 -07:00
Arnav Sacheti
b4f9eaff71 regblock -> busdecoder 2025-10-10 22:30:59 -07:00
Arnav Sacheti
9bf5cd1e68 Initial Commit - Forked from PeakRDL-regblock @ a440cc19769069be831d267505da4f3789a26695 2025-10-10 22:28:36 -07:00