Skip to content

Remove the decode_read_value and encode_write_value public API. #967

Remove the decode_read_value and encode_write_value public API.

Remove the decode_read_value and encode_write_value public API. #967

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: CI
permissions:
contents: read
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches:
- main
- 'release/**'
schedule:
- cron: '00 6 1 * *'
release:
types:
- published
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .
python -m pip install -U pylint
- name: Run Main code Lint
run: pylint src/peakrdl_python
- name: Install dependencies for unit tests
run: |
python -m pip install .[unit_test] -U
- name: Run unit tests Lint
run: pylint src/peakrdl_python tests/unit_tests
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .
python -m pip install -U mypy
- name: Type Check
run: mypy src/peakrdl_python
unit_tests:
needs:
- mypy
- lint
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.9, "3.10", "3.11", "3.12", "3.13", "3.14" ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# the unit tests need the development version of installer as tomllib may be needed
# for older versions of python
python -m pip install .[unit_test]
- name: Run Unit Tests
run: |
python -m unittest discover -s tests/unit_tests -t .
dev_runner:
needs:
- mypy
- lint
- unit_tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.9, "3.10", "3.11", "3.12", "3.13", "3.14" ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[dev]
# the generate_and_test script is intended to run directly from source rather than from
# the installed package
python -m pip uninstall peakrdl-python -y
# peakrdl-ipxact is needed for some of the test cases so is imported by the
# generate_and_test script
PYTHONPATH=/src
# retrieve the example code from the systemRDL compiler
wget -L https://raw.githubusercontent.com/SystemRDL/systemrdl-compiler/main/examples/accelera-generic_example.rdl -O tests/testcases/accelera-generic_example.rdl
- name: Test Development Runner
run: |
python -m generate_and_test --RDL_source_file tests/testcases/simulator_test.rdl --root_node simulator_test
sleep 10
python -m generate_and_test --RDL_source_file tests/testcases/simulator_test.rdl --root_node simulator_test --async
sleep 10
python -m generate_and_test --RDL_source_file tests/testcases/accelera-generic_example.rdl --root_node some_register_map
sleep 10
python -m generate_and_test --RDL_source_file tests/testcases/accelera-generic_example.rdl --root_node some_register_map --legacy_block_access
sleep 10
python -m generate_and_test --RDL_source_file tests/testcases/accelera-generic_example.rdl --root_node some_register_map --legacy_enum_type
sleep 10
python -m generate_and_test --RDL_source_file tests/testcases/accelera-generic_example.rdl --root_node some_register_map --copy_libraries
sleep 10
python -m generate_and_test --RDL_source_file tests/testcases/accelera-generic_example.rdl --root_node some_register_map --hashing_mode PYTHONHASH
sleep 10
python -m generate_and_test --RDL_source_file tests/testcases/accelera-generic_example.rdl --root_node some_register_map --hashing_mode SHA256
sleep 10
python -m generate_and_test --RDL_source_file tests/testcases/user_defined_properties.rdl --root_node user_defined_properties --udp bool_property_to_include
sleep 10
python -m generate_and_test --RDL_source_file tests/testcases/user_defined_properties.rdl --root_node user_defined_properties --udp bool_property_to_include enum_property_to_include
sleep 10
python -m generate_and_test --RDL_source_file tests/testcases/user_defined_properties.rdl --root_node user_defined_properties --udp bool_property_to_include enum_property_to_include int_property_to_include
sleep 10
python -m generate_and_test --RDL_source_file tests/testcases/user_defined_properties.rdl --root_node user_defined_properties --udp bool_property_to_include enum_property_to_include int_property_to_include str_property_to_include
sleep 10
python -m generate_and_test --RDL_source_file tests/testcases/user_defined_properties.rdl --root_node user_defined_properties --udp bool_property_to_include enum_property_to_include int_property_to_include str_property_to_include struct_property_to_include double_layer_struct_property_to_include
sleep 10
python -m generate_and_test --RDL_source_file tests/testcases/user_defined_properties.rdl --root_node user_defined_properties --udp_regex "bool_property_to_include|enum_property_to_include|int_property_to_include|str_property_to_include|struct_property_to_include|double_layer_struct_property_to_include"
sleep 10
python -m generate_and_test --RDL_source_file tests/testcases/reserved_elements.rdl --root_node reserved_elements --hide_regex "(?:[\w_\[\]]+\.)+RSVD"
sleep 10
python -m generate_and_test --RDL_source_file tests/testcases/name_desc_all_levels.rdl --root_node name_desc_all_levels --skip_systemrdl_name_and_desc_properties
sleep 10
peakrdl_integration:
needs:
- mypy
- lint
- unit_tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.9, "3.10", "3.11", "3.12", "3.13", "3.14" ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[peakrdl]
- name: Run PeakRDL Case
run: |
peakrdl python tests/testcases/basic.rdl -o peakrdl_out/raw/
peakrdl python tests/testcases/hidden_property.rdl -o peakrdl_out/raw/
peakrdl python tests/testcases/hidden_property.rdl -o peakrdl_out/raw/show_hidden/ --show_hidden
peakrdl python tests/testcases/simple.xml tests/testcases/multifile.rdl -o peakrdl_out/raw
peakrdl python tests/testcases/extended_memories.rdl -o peakrdl_out/raw/
peakrdl python tests/testcases/user_defined_properties.rdl -o peakrdl_out/raw/list/ --udp bool_property_to_include enum_property_to_include struct_property_to_include str_property_to_include
peakrdl python tests/testcases/user_defined_properties.rdl -o peakrdl_out/raw/regex/ --udp_regex "bool_property_to_include|enum_property_to_include|struct_property_to_include|str_property_to_include"
peakrdl python tests/testcases/reserved_elements.rdl -o peakrdl_out/raw/ --hide_regex "(?:[\w_\[\]]+\.)+RSVD"
peakrdl python tests/testcases/parametrised_top.rdl -o peakrdl_out/raw/ -P MY_PARAM=3
python -m unittest discover -s peakrdl_out/raw
peakrdl python tests/testcases/basic.rdl -o peakrdl_out/raw_async/ --async
peakrdl python tests/testcases/hidden_property.rdl -o peakrdl_out/raw_async/ --async
peakrdl python tests/testcases/hidden_property.rdl -o peakrdl_out/raw_async/show_hidden/ --show_hidden --async
python -m unittest discover -s peakrdl_out/raw_async
peakrdl python tests/testcases/basic.rdl -o peakrdl_out/raw_legacy_block/ --legacy_block_access
python -m unittest discover -s peakrdl_out/raw_legacy_block
peakrdl python tests/testcases/basic.rdl -o peakrdl_out/no_test/ --skip_test_case_generation
peakrdl python tests/testcases/basic.rdl -o peakrdl_out/no_lib/ --skip_library_copy
python -m unittest discover -s peakrdl_out/no_lib
peakrdl python tests/testcases/enum_example.rdl -o peakrdl_out/raw_legacy_enum/ --legacy_enum_type
python -m unittest discover -s peakrdl_out/raw_legacy_enum
# test a TOMl file that passes in overridden templates
peakrdl python tests/testcases/basic.rdl -o peakrdl_out/simple_user_template/ --peakrdl-cfg tests/alternative_templates_toml/peakrdl.toml
python tests/alternative_templates_toml/header_check.py --generated_package_location peakrdl_out/simple_user_template/ --top_name basic
peakrdl python tests/testcases/basic.rdl -o peakrdl_out/dynamic_user_template/ --peakrdl-cfg tests/alternative_templates_dynamic_toml/peakrdl.toml
python tests/alternative_templates_dynamic_toml/header_check.py --generated_package_location peakrdl_out/dynamic_user_template/ --top_name basic
peakrdl python tests/testcases/addr_map.rdl -o peakrdl_out/addr_map/
peakrdl python tests/testcases/addr_map.rdl -o peakrdl_out/addr_map/ -t "child_addr_map_type_c"
python -m unittest discover -s peakrdl_out/addr_map/
peakrdl python tests/testcases/basic.rdl -o peakrdl_out/hash_variants/builtin/ --hashing_mode PYTHONHASH
python -m unittest discover -s peakrdl_out/hash_variants/builtin/
peakrdl python tests/testcases/basic.rdl -o peakrdl_out/hash_variants/sha256/ --hashing_mode SHA256
python -m unittest discover -s peakrdl_out/hash_variants/sha256/
- name: Check Examples
run: |
# build the libraries for the two cases
cd example/tranversing_address_map/
peakrdl python chip_with_registers.rdl -o .
python -m reseting_registers
python -m dumping_register_state_to_json_file
python -m writing_register_state_from_json_file
cd ../..
cd example/simulating_callbacks
peakrdl python chip_with_a_GPIO.rdl -o .
# this example creates a gui that stays up for ever so needs changing before it can be
# in the test suite
# python -m flashing_the_LED
cd ../..
cd example/optimised_access/
peakrdl python optimised_access.rdl -o .
python -m demo_optimised_access
cd ../..
cd example/array_access/
peakrdl python array_access.rdl -o .
python -m demo_array_access
cd ../..
cd example/enumerated_fields/
peakrdl python enumerated_fields.rdl -o .
python -m demo_enumerated_fields
cd ../..
cd example/why_ral/
peakrdl python gpio.rdl -o .
python -m without_ral
python -m with_ral
python -m with_hal
cd ../..
cd example/user_defined_properties/
peakrdl python user_defined_properties.rdl -o . --udp_regex "^(?!python_hide$)(?!python_name$).+"
python -m demo_user_defined_properties
cd ../..
identical_code:
needs:
- mypy
- lint
- unit_tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.9, "3.10", "3.11", "3.12", "3.13", "3.14" ]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[peakrdl]
# retrieve the example code from the systemRDL compiler
wget -L https://raw.githubusercontent.com/SystemRDL/systemrdl-compiler/main/examples/accelera-generic_example.rdl -O tests/testcases/accelera-generic_example.rdl
- name: Generate testcases
run: |
peakrdl python tests/testcases/basic.rdl -o sha256/ --hashing_mode SHA256
peakrdl python tests/testcases/basic.rdl -o sha256_repeat/ --hashing_mode SHA256
- name: Check Match
run: |
(cd sha256 && find . -type f -exec sha256sum {} + | sort -k 2) > /tmp/sha256.sum
(cd sha256_repeat && find . -type f -exec sha256sum {} + | sort -k 2) > /tmp/sha256_repeat.sum
diff /tmp/sha256.sum /tmp/sha256_repeat.sum
integration_tests:
needs:
- peakrdl_integration
- dev_runner
- identical_code
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9, "3.10", "3.11", "3.12", "3.13", "3.14"]
lib_copy: [true, false]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .
# retrieve the example code from the systemRDL compiler
wget -L https://raw.githubusercontent.com/SystemRDL/systemrdl-compiler/main/examples/accelera-generic_example.rdl -O tests/testcases/accelera-generic_example.rdl
# one of the test cases uses IPxact so we need the importer
python -m pip install peakrdl-ipxact
# the generated code is type checked with mypy so this is needed
python -m pip install mypy
- name: Generate testcases (lib_copy true)
if: matrix.lib_copy == true
run: |
python generate_testcases.py --copy_libraries --output testcase_output
- name: Generate testcases (lib_copy false)
if: matrix.lib_copy == false
run: |
python generate_testcases.py --output testcase_output
- name: Static checks
run: |
mypy testcase_output
- name: Run the generated tests
run: |
python -m unittest discover -s testcase_output
autoformating:
needs:
- integration_tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9, "3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .
python -m pip install mypy
# one of the test cases uses IPxact so we need the importer
python -m pip install peakrdl-ipxact
# black is the autoformatter used for this this testing
python -m pip install black
# retrieve the example code from the systemRDL compiler
wget -L https://raw.githubusercontent.com/SystemRDL/systemrdl-compiler/main/examples/accelera-generic_example.rdl -O tests/testcases/accelera-generic_example.rdl
- name: Generate testcases
run: |
# black will ignore files in the .gitingore by default, so we need to ensure that the
# content is generated with a different name
python generate_testcases.py --output autoformatted_output --test_case accelera-generic_example.rdl
# no need to check them as they are tested in the previous test
- name: Test Autoformating
run: |
# run the autoformatting
black autoformatted_output --line-length 120
# check the files are correct with mypy and unittesting
mypy autoformatted_output
python -m unittest discover -s autoformatted_output
#-------------------------------------------------------------------------------
build:
needs:
- autoformating
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: "3.13"
- name: Install dependencies
run: |
python -m pip install -U build
- name: Build
run: python -m build
- uses: actions/upload-artifact@v4
with:
path: |
dist/*.tar.gz
dist/*.whl
#-------------------------------------------------------------------------------
deploy:
needs:
- build
runs-on: ubuntu-latest
# Only publish when a GitHub Release is created.
if: github.event_name == 'release'
steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}