peakrdl-python 0.8.0__tar.gz → 0.9.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 (146) hide show
  1. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/.github/workflows/action.yaml +85 -8
  2. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/PKG-INFO +16 -2
  3. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/README.md +11 -0
  4. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/docs/api.rst +24 -3
  5. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/docs/design_decisions.rst +9 -1
  6. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/docs/generated_package.rst +122 -5
  7. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/docs/index.rst +3 -3
  8. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/example/optimised_access/demo_optimised_array_access.py +0 -2
  9. peakrdl_python-0.9.0/example/user_defined_properties/demo_user_defined_properties.py +16 -0
  10. peakrdl_python-0.9.0/example/user_defined_properties/user_defined_properties.rdl +17 -0
  11. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/generate_and_test.py +38 -10
  12. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/generate_testcases.py +40 -13
  13. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/pyproject.toml +8 -2
  14. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/__about__.py +1 -1
  15. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/__init__.py +3 -0
  16. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/__peakrdl__.py +33 -5
  17. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/_node_walkers.py +59 -3
  18. peakrdl_python-0.9.0/src/peakrdl_python/compiler_udp.py +99 -0
  19. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/exporter.py +215 -60
  20. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/lib/__init__.py +19 -17
  21. peakrdl_python-0.9.0/src/peakrdl_python/lib/async_memory.py +646 -0
  22. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/lib/async_register.py +223 -72
  23. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/lib/base.py +70 -36
  24. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/lib/callbacks.py +170 -22
  25. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/lib/fields.py +5 -0
  26. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/lib/memory.py +232 -366
  27. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/lib/register.py +199 -65
  28. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/lib/utility_functions.py +23 -1
  29. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/safe_name_utility.py +57 -16
  30. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/sim_lib/dummy_callbacks.py +85 -4
  31. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/sim_lib/memory.py +4 -1
  32. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/sim_lib/simulator.py +111 -8
  33. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/systemrdl_node_utility_functions.py +176 -24
  34. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/templates/addrmap.py.jinja +87 -55
  35. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/templates/addrmap_field.py.jinja +17 -12
  36. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/templates/addrmap_memory.py.jinja +14 -5
  37. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/templates/addrmap_register.py.jinja +29 -12
  38. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/templates/addrmap_simulation_tb.py.jinja +22 -9
  39. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/templates/addrmap_tb.py.jinja +314 -25
  40. peakrdl_python-0.9.0/src/peakrdl_python/templates/addrmap_udp_property.py.jinja +47 -0
  41. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/templates/baseclass_simulation_tb.py.jinja +5 -5
  42. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/templates/baseclass_tb.py.jinja +34 -10
  43. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/templates/example.py.jinja +2 -2
  44. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/templates/reg_definitions.py.jinja +5 -3
  45. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/templates/sim_addrmap.py.jinja +3 -3
  46. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python.egg-info/PKG-INFO +16 -2
  47. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python.egg-info/SOURCES.txt +17 -1
  48. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python.egg-info/requires.txt +7 -1
  49. peakrdl_python-0.9.0/tests/alternative_templates_dynamic/header.py.jinja +10 -0
  50. peakrdl_python-0.9.0/tests/alternative_templates_dynamic/header_tb.py.jinja +7 -0
  51. peakrdl_python-0.9.0/tests/alternative_templates_dynamic_toml/header_check.py +88 -0
  52. peakrdl_python-0.9.0/tests/alternative_templates_dynamic_toml/peakrdl.toml +3 -0
  53. peakrdl_python-0.9.0/tests/alternative_templates_toml/header_check.py +88 -0
  54. peakrdl_python-0.9.0/tests/testcases/extended_memories.rdl +28 -0
  55. peakrdl_python-0.9.0/tests/testcases/extended_sizes_registers_array.rdl +13 -0
  56. peakrdl_python-0.9.0/tests/testcases/hidden_property.rdl +117 -0
  57. peakrdl_python-0.9.0/tests/testcases/reserved_elements.rdl +77 -0
  58. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/simple.rdl +6 -0
  59. peakrdl_python-0.9.0/tests/testcases/user_defined_properties.rdl +175 -0
  60. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/unit_tests/simple_components.py +26 -16
  61. peakrdl_python-0.9.0/tests/unit_tests/test_export.py +729 -0
  62. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/unit_tests/test_optimised_reg_array.py +5 -5
  63. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/unit_tests/test_reg.py +21 -0
  64. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/.gitignore +0 -0
  65. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/.readthedocs.yaml +0 -0
  66. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/LICENSE +0 -0
  67. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/MANIFEST.in +0 -0
  68. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/docs/api_components.rst +0 -0
  69. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/docs/command_line.rst +0 -0
  70. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/docs/conf.py +0 -0
  71. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/docs/customisation.rst +0 -0
  72. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/docs/design_tools.rst +0 -0
  73. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/docs/genindex.rst +0 -0
  74. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/docs/installation.rst +0 -0
  75. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/docs/requirements.txt +0 -0
  76. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/example/array_access/array_access.rdl +0 -0
  77. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/example/array_access/demo_array_access.py +0 -0
  78. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/example/enumerated_fields/demo_enumerated_fields.py +0 -0
  79. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/example/enumerated_fields/enumerated_fields.rdl +0 -0
  80. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/example/optimised_access/demo_optimised_access.py +0 -0
  81. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/example/optimised_access/optimised_access.rdl +0 -0
  82. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/example/optimised_access/optimised_array_access.rdl +0 -0
  83. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/example/overridden_names/demo_over_ridden_names.py +0 -0
  84. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/example/overridden_names/overridden_names.rdl +0 -0
  85. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/example/simulating_callbacks/chip_with_a_GPIO.rdl +0 -0
  86. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/example/simulating_callbacks/flashing_the_LED.py +0 -0
  87. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/example/tranversing_address_map/chip_with_registers.rdl +0 -0
  88. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/example/tranversing_address_map/dumping_register_state_to_json_file.py +0 -0
  89. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/example/tranversing_address_map/reg_dump.json +0 -0
  90. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/example/tranversing_address_map/reseting_registers.py +0 -0
  91. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/example/tranversing_address_map/writing_register_state_from_json_file.py +0 -0
  92. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/example/why_ral/__init__.py +0 -0
  93. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/example/why_ral/gpio.rdl +0 -0
  94. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/example/why_ral/with_hal.py +0 -0
  95. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/example/why_ral/with_ral.py +0 -0
  96. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/example/why_ral/without_ral.py +0 -0
  97. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/setup.cfg +0 -0
  98. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/.coveragerc +0 -0
  99. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/sim_lib/__init__.py +0 -0
  100. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/sim_lib/_callbacks.py +0 -0
  101. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/sim_lib/base.py +0 -0
  102. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/sim_lib/field.py +0 -0
  103. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/sim_lib/register.py +0 -0
  104. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/templates/__init__.py +0 -0
  105. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/templates/addrmap_simulation.py.jinja +0 -0
  106. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/templates/header.py.jinja +0 -0
  107. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python/templates/header_tb.py.jinja +0 -0
  108. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python.egg-info/dependency_links.txt +0 -0
  109. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python.egg-info/entry_points.txt +0 -0
  110. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/src/peakrdl_python.egg-info/top_level.txt +0 -0
  111. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/.mypy.ini +0 -0
  112. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/alternative_templates/header.py.jinja +0 -0
  113. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/alternative_templates/header_tb.py.jinja +0 -0
  114. {peakrdl_python-0.8.0/tests/alternative_template_toml → peakrdl_python-0.9.0/tests/alternative_templates_toml}/peakrdl.toml +0 -0
  115. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/pylint.rc +0 -0
  116. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/RDLFormatCode_example.rdl +0 -0
  117. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/addr_map.rdl +0 -0
  118. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/all_register_access_types.rdl +0 -0
  119. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/basic.rdl +0 -0
  120. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/block_a.xml +0 -0
  121. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/block_b.xml +0 -0
  122. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/different_array_types.rdl +0 -0
  123. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/enum_example.rdl +0 -0
  124. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/example_issue_106.rdl +0 -0
  125. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/field_scope.rdl +0 -0
  126. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/field_with_overridden_reset.rdl +0 -0
  127. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/fields_with_HW_write.rdl +0 -0
  128. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/fields_with_reset_values.rdl +0 -0
  129. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/memories.rdl +0 -0
  130. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/memories_with_registers.rdl +0 -0
  131. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/msb0_and_lsb0.rdl +0 -0
  132. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/multi_block.rdl +0 -0
  133. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/multifile.rdl +0 -0
  134. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/name_clash.rdl +0 -0
  135. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/overridden_python_name.rdl +0 -0
  136. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/parametrised_readonly_and_readwrite.rdl +0 -0
  137. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/regfile_and_arrays.rdl +0 -0
  138. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/same_but_different_enum.rdl +0 -0
  139. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/signals_definitions_at_various_levels.rdl +0 -0
  140. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/simple.xml +0 -0
  141. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/simulator_test.rdl +0 -0
  142. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/sizes_registers.rdl +0 -0
  143. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/sizes_registers_array.rdl +0 -0
  144. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/testcases/write_only_enum_with_undefined_reset.rdl +0 -0
  145. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/unit_tests/__init__.py +0 -0
  146. {peakrdl_python-0.8.0 → peakrdl_python-0.9.0}/tests/unit_tests/test_array_indexing.py +0 -0
@@ -8,7 +8,8 @@ on:
8
8
  push:
9
9
  branches: [ main ]
10
10
  pull_request:
11
- branches: [ main ]
11
+ branches:
12
+ - main
12
13
  schedule:
13
14
  - cron: '00 6 1 * *'
14
15
  release:
@@ -35,10 +36,16 @@ jobs:
35
36
  python -m pip install .
36
37
  python -m pip install -U pylint
37
38
 
38
- - name: Run Lint
39
- #run: pylint --rcfile tests/pylint.rc src/peakrdl_python tests/unit_tests
39
+ - name: Run Main code Lint
40
40
  run: pylint --rcfile tests/pylint.rc src/peakrdl_python
41
41
 
42
+ - name: Install dependencies for unit tests
43
+ run: |
44
+ python -m pip install .[unit_test] -U
45
+
46
+ - name: Run unit tests Lint
47
+ run: pylint --rcfile tests/pylint.rc src/peakrdl_python tests/unit_tests
48
+
42
49
  mypy:
43
50
  runs-on: ubuntu-latest
44
51
  steps:
@@ -77,7 +84,9 @@ jobs:
77
84
  - name: Install dependencies
78
85
  run: |
79
86
  python -m pip install --upgrade pip
80
- python -m pip install .
87
+ # the unit tests need the development version of installer as tomllib may be needed
88
+ # for older versions of python
89
+ python -m pip install .[unit_test]
81
90
 
82
91
  - name: Run Unit Tests
83
92
  run: |
@@ -124,6 +133,14 @@ jobs:
124
133
 
125
134
  python -m generate_and_test --RDL_source_file tests/testcases/accelera-generic_example.rdl --root_node some_register_map
126
135
 
136
+ python -m generate_and_test --RDL_source_file tests/testcases/user_defined_properties.rdl --root_node user_defined_properties --udp bool_property_to_include
137
+ 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
138
+ 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
139
+ 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
140
+ 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
141
+
142
+ python -m generate_and_test --RDL_source_file tests/testcases/reserved_elements.rdl --root_node reserved_elements --hide_regex "(?:[\w_\[\]]+\.)+RSVD"
143
+
127
144
  peakrdl_integration:
128
145
  needs:
129
146
  - mypy
@@ -152,13 +169,32 @@ jobs:
152
169
  run: |
153
170
 
154
171
  peakrdl python tests/testcases/basic.rdl -o peakrdl_out/raw/
172
+ peakrdl python tests/testcases/hidden_property.rdl -o peakrdl_out/raw/
173
+ peakrdl python tests/testcases/hidden_property.rdl -o peakrdl_out/raw/show_hidden/ --show_hidden
155
174
  peakrdl python tests/testcases/simple.xml tests/testcases/multifile.rdl -o peakrdl_out/raw
175
+ peakrdl python tests/testcases/extended_memories.rdl -o peakrdl_out/raw/
176
+ peakrdl python tests/testcases/user_defined_properties.rdl -o peakrdl_out/raw/ --udp bool_property_to_include
177
+ peakrdl python tests/testcases/reserved_elements.rdl -o peakrdl_out/raw/ --hide_regex "(?:[\w_\[\]]+\.)+RSVD"
156
178
  python -m unittest discover -s peakrdl_out/raw
179
+
157
180
  peakrdl python tests/testcases/basic.rdl -o peakrdl_out/raw_async/ --async
181
+ peakrdl python tests/testcases/hidden_property.rdl -o peakrdl_out/raw_async/ --async
182
+ peakrdl python tests/testcases/hidden_property.rdl -o peakrdl_out/raw_async/show_hidden/ --show_hidden --async
158
183
  python -m unittest discover -s peakrdl_out/raw_async
184
+ peakrdl python tests/testcases/basic.rdl -o peakrdl_out/raw_legacy/ --legacy_block_access
185
+ python -m unittest discover -s peakrdl_out/raw_legacy
159
186
 
160
187
  peakrdl python tests/testcases/basic.rdl -o peakrdl_out/no_test/ --skip_test_case_generation
161
188
 
189
+ # test a TOMl file that passes in overridden templates
190
+ peakrdl python tests/testcases/basic.rdl -o peakrdl_out/simple_user_template/ --peakrdl-cfg tests/alternative_templates_toml/peakrdl.toml
191
+ python tests/alternative_templates_toml/header_check.py --generated_package_location peakrdl_out/simple_user_template/ --top_name basic
192
+ peakrdl python tests/testcases/basic.rdl -o peakrdl_out/dynamic_user_template/ --peakrdl-cfg tests/alternative_templates_dynamic_toml/peakrdl.toml
193
+ python tests/alternative_templates_dynamic_toml/header_check.py --generated_package_location peakrdl_out/dynamic_user_template/ --top_name basic
194
+
195
+
196
+
197
+
162
198
  - name: Check Examples
163
199
  run: |
164
200
 
@@ -248,17 +284,58 @@ jobs:
248
284
 
249
285
  python -m unittest discover -s testcase_output
250
286
 
251
- - name: Test Autoformating
287
+ autoformating:
288
+ needs:
289
+ - integration_tests
290
+
291
+ runs-on: ubuntu-latest
292
+ strategy:
293
+ matrix:
294
+ # reduced matrix because the autoformatter was having issues with python 3.8 so we will
295
+ # limit this to modern versions of python only
296
+ python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
297
+
298
+ steps:
299
+ - uses: actions/checkout@v4
300
+
301
+ - name: Set up Python ${{ matrix.python-version }}
302
+ uses: actions/setup-python@v5
303
+ with:
304
+ python-version: ${{ matrix.python-version }}
305
+
306
+ - name: Install dependencies
252
307
  run: |
308
+ python -m pip install --upgrade pip
309
+ python -m pip install .
310
+ python -m pip install mypy
311
+ # one of the test cases uses IPxact so we need the importer
312
+ python -m pip install peakrdl-ipxact
313
+ # black is the autoformatter used for this this testing
253
314
  python -m pip install black
254
- cp testcase_output autoformatted_testcase_output -r
255
- black autoformatted_testcase_output --line-length 120
256
- python -m unittest discover -s autoformatted_testcase_output
315
+
316
+ # retrieve the example code from the systemRDL compiler
317
+ wget -L https://raw.githubusercontent.com/SystemRDL/systemrdl-compiler/main/examples/accelera-generic_example.rdl -O tests/testcases/accelera-generic_example.rdl
318
+
319
+ - name: Generate testcases
320
+ run: |
321
+ # black will ignore files in the .gitingore by default, so we need to ensure that the
322
+ # content is generated with a different name
323
+ python generate_testcases.py --output autoformatted_output --test_case accelera-generic_example.rdl
324
+ # no need to check them as they are tested in the previous test
325
+
326
+ - name: Test Autoformating
327
+ run: |
328
+ # run the autoformatting
329
+ black autoformatted_output --line-length 120
330
+ # check the files are correct with mypy and unittesting
331
+ mypy autoformatted_output --config-file=tests/.mypy.ini
332
+ python -m unittest discover -s autoformatted_output
257
333
 
258
334
  #-------------------------------------------------------------------------------
259
335
  build:
260
336
  needs:
261
337
  - integration_tests
338
+ - autoformating
262
339
  - dev_runner
263
340
  - peakrdl_integration
264
341
  name: Build source distribution
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: peakrdl-python
3
- Version: 0.8.0
3
+ Version: 0.9.0
4
4
  Summary: Generate Python Register Access Layer (RAL) from SystemRDL
5
5
  Author: Keith Brady
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -700,7 +700,7 @@ Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA
700
700
  Requires-Python: >=3.7
701
701
  Description-Content-Type: text/markdown
702
702
  License-File: LICENSE
703
- Requires-Dist: systemrdl-compiler>=1.24.0
703
+ Requires-Dist: systemrdl-compiler>=1.25.0
704
704
  Requires-Dist: jinja2
705
705
  Requires-Dist: asynctest; python_version < "3.8"
706
706
  Requires-Dist: typing-extensions; python_version < "3.11"
@@ -711,6 +711,9 @@ Requires-Dist: coverage; extra == "dev"
711
711
  Requires-Dist: peakrdl-ipxact; extra == "dev"
712
712
  Provides-Extra: peakrdl
713
713
  Requires-Dist: peakrdl; extra == "peakrdl"
714
+ Provides-Extra: unit-test
715
+ Requires-Dist: peakrdl; extra == "unit-test"
716
+ Requires-Dist: tomli; python_version < "3.11" and extra == "unit-test"
714
717
 
715
718
  ![CI](https://github.com/krcb197/PeakRDL-python/actions/workflows/action.yaml/badge.svg)
716
719
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/peakrdl-python.svg)](https://pypi.org/project/peakrdl-python)
@@ -723,4 +726,15 @@ Generate Python Register Access Layer (RAL) from SystemRDL
723
726
  ## Documentation
724
727
  See the [peakrdl-python Documentation](https://peakrdl-python.readthedocs.io/) for more details
725
728
 
729
+ ## Upgrading from pre 0.9.0
730
+
731
+ In order to address a major limitation of peakrdl-python that prevented it from implementing the
732
+ full systemRDL specification, a breaking API change was needed for handling blocks:
733
+ * registers (in register array)
734
+ * memory entries in a memory
735
+
736
+ Users are encouraged to upgrade in order to avoid this limitation. However, there is a legacy mode
737
+ to support users with existing designs, see: _Legacy Block Callback and Block Access_ in the
738
+ documentation
739
+
726
740
 
@@ -9,4 +9,15 @@ Generate Python Register Access Layer (RAL) from SystemRDL
9
9
  ## Documentation
10
10
  See the [peakrdl-python Documentation](https://peakrdl-python.readthedocs.io/) for more details
11
11
 
12
+ ## Upgrading from pre 0.9.0
13
+
14
+ In order to address a major limitation of peakrdl-python that prevented it from implementing the
15
+ full systemRDL specification, a breaking API change was needed for handling blocks:
16
+ * registers (in register array)
17
+ * memory entries in a memory
18
+
19
+ Users are encouraged to upgrade in order to avoid this limitation. However, there is a legacy mode
20
+ to support users with existing designs, see: _Legacy Block Callback and Block Access_ in the
21
+ documentation
22
+
12
23
 
@@ -18,13 +18,15 @@ Example
18
18
  The following example shows the compiling an SystemRDL file and then generating
19
19
  the python register access layer using PeakRDL Python.
20
20
 
21
+
22
+
21
23
  .. code-block:: python
22
24
 
23
- from systemrdl import RDLCompiler
25
+ from peakrdl_python import compiler_with_udp_registers
24
26
  from peakrdl_python.exporter import PythonExporter
25
27
 
26
28
  # compile the systemRDL
27
- rdlc = RDLCompiler()
29
+ rdlc = compiler_with_udp_registers()
28
30
  rdlc.compile_file('basic.rdl')
29
31
  spec = rdlc.elaborate(top_def_name='basic').top
30
32
 
@@ -36,6 +38,25 @@ the python register access layer using PeakRDL Python.
36
38
  PythonExporter
37
39
  ==============
38
40
 
41
+ The main exported class used to build the python register access layer:
42
+
39
43
  .. autoclass:: peakrdl_python.exporter.PythonExporter
40
44
  :members:
41
- :special-members: __init__
45
+ :special-members: __init__
46
+
47
+ Compiler Extensions
48
+ -------------------
49
+
50
+ PeakRDL Python uses two User Defined Properties to help the generation, there are definitions of
51
+ these available to register with a the Compiler
52
+
53
+ .. autoclass:: peakrdl_python.PythonHideUDP
54
+ :members:
55
+
56
+
57
+ .. autoclass:: peakrdl_python.PythonInstNameUDP
58
+ :members:
59
+
60
+ The compiler factory function will generate an instance of the compiler with these registered
61
+
62
+ .. autofunction:: peakrdl_python.compiler_with_udp_registers
@@ -20,4 +20,12 @@ Integer Data Types
20
20
  ===================
21
21
 
22
22
  All the APIs present memory, register and field entries as python integers. This abstracts, the
23
- complexity of byte ordering and reversed registers.
23
+ complexity of byte ordering and reversed registers.
24
+
25
+ Blocks of Data
26
+ ==============
27
+
28
+ .. versionchanged:: 0.9.0
29
+
30
+ blocks of data (for example memories were accessed as python array.array previously. This
31
+ did not support width of larger than 128 bits therefore this was changed to list.
@@ -104,6 +104,37 @@ The callbacks are passed into the register access layer using either:
104
104
  * ``AsyncCallbackSet`` for async python function callbacks, these are called from the library using
105
105
  ``await``
106
106
 
107
+ Legacy Block Callback and Block Access
108
+ --------------------------------------
109
+
110
+ .. versionchanged:: 0.9.0
111
+
112
+ Previous versions of PeakRDL Python used the python ``array.array`` for efficiently moving blocks
113
+ of data. This was changed in version 0.9.0 in order to accommodate memories which were larger
114
+ than 64 bit wide which could not be supported as the array type only support entries of up to
115
+ 64 bit.
116
+
117
+ .. warning::
118
+ The developers apologise for making a breaking change, however, not being able to fully the
119
+ systemRDL specification was determined to be a major limitation that needed to be addressed.
120
+
121
+ It could have left this as a future compatibility mode before making a breaking change but
122
+ that would just delay the pain it was felt to be better to get as many users onto the new
123
+ API as soon as possible whilst PeakRDL Python is in beta.
124
+
125
+ If you really want to just keep on with the array based interface and make only minimal changes
126
+ to existing code, there are two simple steps:
127
+
128
+ 1. The northbound interfaces that are provided by the generated package expect lists of integers
129
+ rather than array. The old interfaces can be retained by using the ``legacy_block_access``
130
+ build option.
131
+ 2. The southbound interfaces into the callbacks again need to use lists for the
132
+ ``read_block_callback`` and ``write_block_callback`` methods. If you want to continue to use
133
+ the old scheme use the following callback classes which are part of the callbacks:
134
+ * ``NormalCallbackSetLegacy`` for standard python function callbacks
135
+ * ``AsyncCallbackSetLegacy`` for async python function callbacks, these are called from the library using ``await``
136
+
137
+
107
138
  Using the Register Access Layer
108
139
  ===============================
109
140
 
@@ -170,7 +201,9 @@ The following example shows the usage of the enumeration
170
201
  Array Access
171
202
  ------------
172
203
 
173
- SystemRDL supports multi-dimensional arrays, the following example shows an definition with an 1D and 3D array with various methods to access individual elements of the array and use of the iterators to walk through elements in loops
204
+ SystemRDL supports multi-dimensional arrays, the following example shows an definition with an 1D
205
+ and 3D array with various methods to access individual elements of the array and use of the
206
+ iterators to walk through elements in loops
174
207
 
175
208
  .. literalinclude :: ../example/array_access/array_access.rdl
176
209
  :language: systemrdl
@@ -350,13 +383,38 @@ worry if they are in an array or not.
350
383
  .. literalinclude :: ../example/tranversing_address_map/reseting_registers.py
351
384
  :language: python
352
385
 
386
+ Exposing User Defined Properties
387
+ --------------------------------
388
+
389
+ SystemRDL allows properties to be added to any component (Field, Memory, Register, Register File,
390
+ Address Map), so called *User Defined Properties (UDP)*.
391
+
392
+ Consider the following systemRDL example with a user defined property: ``component_usage``
393
+
394
+ .. literalinclude :: ../example/user_defined_properties/user_defined_properties.rdl
395
+ :language: systemrdl
396
+
397
+ User Defined Properties are not automatically included they must be specified, as shown:
398
+
399
+ .. code-block:: bash
400
+
401
+ peakrdl python chip_with_registers.rdl -o chip_with_registers
402
+
403
+ The user defined properties are stored in a ``udp`` property of all component in the generated
404
+ register access and can be accessed as follows:
405
+
406
+ .. literalinclude :: ../example/user_defined_properties/demo_user_defined_properties.py
407
+ :language: python
408
+
353
409
  Python Safe Names
354
410
  =================
355
411
 
356
412
  The systemRDL structure is converted to a python class structure, there are two concerns:
357
413
 
358
414
  * if any systemRDL node name is a python keyname
359
- * if any systemRDL node name clashes with part of the peakrdl_standard types, for example all register nodes have an ``address`` property that would clash with a field of that register called ``address``
415
+ * if any systemRDL node name clashes with part of the peakrdl_standard types, for example all
416
+ register nodes have an ``address`` property that would clash with a field of that register
417
+ called ``address``
360
418
 
361
419
  consider the following example:
362
420
 
@@ -400,9 +458,68 @@ field from the example above
400
458
  .. literalinclude :: ../example/overridden_names/demo_over_ridden_names.py
401
459
  :language: python
402
460
 
461
+ Hidden Elements
462
+ ===============
463
+
464
+ Commonly some parts of the register map want to be hidden from some users, for example register
465
+ included to reserve space or test functions.
466
+
467
+ User Defined Property
468
+ ---------------------
469
+
470
+ PeakRDL Python supports a User Defined Property (UDP): ``python_hide`` that can be used to hide
471
+ items that should not appear in the generated python wrappers.
472
+
473
+ In the following example, python wrapper generated would have the registers:
474
+
475
+ * ``explictly_visible_reg``
476
+ * ``implicitly_visible_reg``
477
+
478
+ However the ``hidden_reg`` would not be included in the python wrappers
479
+
480
+ .. code-block:: systemrdl
481
+
482
+ property python_hide { type = boolean; component = addrmap | regfile | reg | field | mem; };
483
+
484
+ addrmap my_addr_map {
485
+
486
+ reg {
487
+ default sw = rw;
488
+ default hw = r;
489
+ python_hide = true;
490
+ field { fieldwidth=1; } field_a;
491
+ } hidden_reg;
492
+
493
+ reg {
494
+ default sw = rw;
495
+ default hw = r;
496
+ python_hide = false;
497
+ field { fieldwidth=1; } field_a;
498
+ } explictly_visible_reg;
499
+
500
+ reg {
501
+ default sw = rw;
502
+ default hw = r;
503
+ field { fieldwidth=1; } field_a;
504
+ } implicitly_visible_reg;
505
+
506
+ };
507
+
508
+ The ``python_hide`` property can be overridden with the ``show_hidden`` argument to the peakrdl
509
+ command line tool or the ``export`` method.
510
+
511
+ Regular Expression
512
+ ------------------
513
+
514
+ PeakRDL Python supports hiding elements of the based on a regular expression.
515
+
516
+ .. note:: The expression uses the python re.match, for example to hide all fields, registers,
517
+ regfiles, address maps or memories with the name ``RSVD``, the regular expression
518
+ must match on the full name e.g. ``(?:[\w_\[\]]+\.)+RSVD``
519
+
403
520
 
404
- Autoformating
405
- =============
521
+ Autoformatting
522
+ ==============
406
523
 
407
524
  The generated code is not perfect it often has lots of spare black lines, over time this will
408
525
  improve but the quickest way to resolve these issue is to include an autoformatter
@@ -424,7 +541,7 @@ PeakRDL Python also generates an simulator, this can be used to test and develop
424
541
  generated package. The simulator is used in a the examples shown earlier in this section. The
425
542
  simulator has the option to attach a callback to the read and write operations of either a
426
543
  register or field. In addition there is a ``value`` property that allows access to the register
427
- or feild content, this allows the contents to be accessed or updated without activating the
544
+ or field content, this allows the contents to be accessed or updated without activating the
428
545
  callbacks, this is intended to allow the simulator to be extended with behaviour that is not
429
546
  fully described by the systemRDL.
430
547
 
@@ -38,7 +38,7 @@ At some point another software component called a Hardware Abstraction Layer (HA
38
38
  get produced that abstracts the device function providing functions to do more useful things.
39
39
  The RAL could be used as part of a HAL.
40
40
 
41
- .. note:: The Hardware Abstraction Layer (HAL) provides abstact functionality and allows
41
+ .. note:: The Hardware Abstraction Layer (HAL) provides abstract functionality and allows
42
42
  people to use the device without needing a full knowledge of how it works.
43
43
 
44
44
  What does it do
@@ -91,7 +91,7 @@ manipulations
91
91
  .. warning:: A Register Access Layer (RAL) is not for everyone. Some engineers like to see the
92
92
  address of each register and the content of a register as a hex word. You may be quite
93
93
  happy with this, if that is you please stop, the overhead of an extra
94
- layer, its opaque nature and inefficency will annoy you.
94
+ layer, its opaque nature and inefficiency will annoy you.
95
95
 
96
96
  In order to move on the systemRDL code for the registers needs to exist
97
97
 
@@ -111,7 +111,7 @@ Once built, a set of test cases can be run on the code to confirm its integrity,
111
111
 
112
112
  python -m unittest discover -s gpio\tests -t .
113
113
 
114
- Using the RAL allows for much simipler to understand code that does the function that was intended
114
+ Using the RAL allows for much simpler to understand code that does the function that was intended
115
115
 
116
116
  .. literalinclude :: ../example/why_ral/with_ral.py
117
117
  :language: python
@@ -1,8 +1,6 @@
1
1
  """
2
2
  PeakRDL Python example to show the different methods to access the a register array
3
3
  """
4
- from array import array as Array
5
-
6
4
  from optimised_array_access.reg_model.optimised_array_access import optimised_array_access_cls
7
5
  from optimised_array_access.sim.optimised_array_access import optimised_array_access_simulator_cls
8
6
 
@@ -0,0 +1,16 @@
1
+ from user_defined_property.reg_model.user_defined_property import user_defined_property_cls
2
+ from user_defined_property.sim_lib.dummy_callbacks import dummy_read, dummy_write
3
+ from user_defined_property.lib.callbacks import NormalCallbackSet
4
+
5
+ if __name__ == '__main__':
6
+
7
+ # create an instance of the class
8
+ regmodel = user_defined_property_cls(callbacks=NormalCallbackSet(read_callback=dummy_read,
9
+ write_callback=dummy_write))
10
+
11
+ # loop through the the fields in the register access model and print out the value of the
12
+ # component_usage property
13
+ for field in regmodel.control_register.readable_fields:
14
+ field_usage = field.udp['component_usage']
15
+ print(f"Control register field:{field.inst_name} has recommend usage {field_usage.name}")
16
+
@@ -0,0 +1,17 @@
1
+ enum component_type {
2
+ test_function = 0 { name = "test the design"; };
3
+ device_configuration = 1 { name = "configuring_the_device"; };
4
+ normal_use = 2 { desc="normal device usage"; };
5
+ };
6
+
7
+ property component_usage { type = component_type; component = addrmap | regfile | reg | field | mem; };
8
+
9
+ addrmap user_defined_property {
10
+
11
+ reg {
12
+ field { fieldwidth=4; component_usage=component_type::test_function; } data_loop_back;
13
+ field { fieldwidth=1; component_usage=component_type::device_configuration; } power_control;
14
+ field { fieldwidth=1; component_usage=component_type::normal_use; } led_control;
15
+ } control_register;
16
+
17
+ };
@@ -35,14 +35,13 @@ from unittest import TestLoader
35
35
  from unittest import TestSuite
36
36
  from unittest import TextTestRunner
37
37
 
38
- from coverage import Coverage
38
+ #from coverage import Coverage
39
39
 
40
- from systemrdl import RDLCompiler
41
-
42
- from peakrdl_ipxact import IPXACTImporter
40
+ #from peakrdl_ipxact import IPXACTImporter
43
41
 
44
42
  sys.path.append('src')
45
43
  from peakrdl_python import PythonExporter
44
+ from peakrdl_python import compiler_with_udp_registers
46
45
 
47
46
  CommandLineParser = argparse.ArgumentParser(description='Test the framework')
48
47
  CommandLineParser.add_argument('--RDL_source_file', dest='root_RDL_file',
@@ -79,6 +78,21 @@ CommandLineParser.add_argument('--copy_libraries', action='store_true', dest='co
79
78
  'and debugging as multiple copies of the libraries can cause'
80
79
  'confusion. Therefore by default this script does not copy '
81
80
  'them over.')
81
+ CommandLineParser.add_argument('--legacy_block_access', action='store_true',
82
+ dest='legacy_block_access',
83
+ help='peakrdl python has two methods to hold blocks of data, the '
84
+ 'legacy mode based on Array or the new mode using lists')
85
+ CommandLineParser.add_argument('--udp', dest='udp', nargs='*',
86
+ type=str, help='any user defined properties to include in the '
87
+ 'reg_model')
88
+ CommandLineParser.add_argument('--hide_regex', dest='hide_regex', type=str,
89
+ help='A regex that will cause any matching fully qualified node to '
90
+ 'be hidden')
91
+ CommandLineParser.add_argument('--full_inst_file', dest='full_inst_file',
92
+ type=pathlib.Path, required=False,
93
+ help='export a text file with a list of the all qualified instance'
94
+ 'names in the systemRDL')
95
+
82
96
 
83
97
  def build_logging_cong(logfilepath:str):
84
98
  return {
@@ -127,6 +141,7 @@ def build_logging_cong(logfilepath:str):
127
141
  }
128
142
  }
129
143
 
144
+
130
145
  if __name__ == '__main__':
131
146
 
132
147
  CommandLineArgs = CommandLineParser.parse_args()
@@ -134,7 +149,7 @@ if __name__ == '__main__':
134
149
  logfile_path = build_logging_cong(CommandLineArgs.output_path / f'{__file__}.log')
135
150
  logging.config.dictConfig(logfile_path)
136
151
 
137
- rdlc = RDLCompiler()
152
+ rdlc = compiler_with_udp_registers()
138
153
 
139
154
  if CommandLineArgs.ipxact is not None:
140
155
 
@@ -156,12 +171,21 @@ if __name__ == '__main__':
156
171
  node_list.append(node)
157
172
  print(node.inst_name)
158
173
 
174
+ # write out text file of all the nodes names, this can be used to debug regex issues
175
+ if CommandLineArgs.full_inst_file is not None:
176
+ with CommandLineArgs.full_inst_file.open('w', encoding='utf-8') as fid:
177
+ for child in spec.descendants(unroll=True):
178
+ fid.write('.'.join(child.get_path_segments()) + '\n')
179
+
159
180
  exporter = PythonExporter()
160
181
  start_time = time.time()
161
182
  exporter.export(node=spec, path=str(CommandLineArgs.output_path / 'generate_and_test_output'),
162
183
  asyncoutput=CommandLineArgs.asyncoutput,
163
184
  delete_existing_package_content=not CommandLineArgs.suppress_cleanup,
164
- skip_library_copy=not CommandLineArgs.copy_libraries)
185
+ skip_library_copy=not CommandLineArgs.copy_libraries,
186
+ legacy_block_access=CommandLineArgs.legacy_block_access,
187
+ user_defined_properties_to_include=CommandLineArgs.udp,
188
+ hidden_inst_name_regex=CommandLineArgs.hide_regex)
165
189
  print(f'generation time {time.time() - start_time}s')
166
190
 
167
191
  if not CommandLineArgs.export_only:
@@ -190,9 +214,15 @@ if __name__ == '__main__':
190
214
  globals(), locals(), ['CallbackSet'], 0)
191
215
 
192
216
  if CommandLineArgs.asyncoutput is True:
193
- callbackset_cls = getattr(peakrdl_python_package, 'AsyncCallbackSet')
217
+ if CommandLineArgs.legacy_block_access is True:
218
+ callbackset_cls = getattr(peakrdl_python_package, 'AsyncCallbackSetLegacy')
219
+ else:
220
+ callbackset_cls = getattr(peakrdl_python_package, 'AsyncCallbackSet')
194
221
  else:
195
- callbackset_cls = getattr(peakrdl_python_package, 'NormalCallbackSet')
222
+ if CommandLineArgs.legacy_block_access is True:
223
+ callbackset_cls = getattr(peakrdl_python_package, 'NormalCallbackSetLegacy')
224
+ else:
225
+ callbackset_cls = getattr(peakrdl_python_package, 'NormalCallbackSet')
196
226
 
197
227
  sim_cls = getattr(sim_module, sim_class_name)
198
228
  sim = sim_cls(address=0)
@@ -210,6 +240,4 @@ if __name__ == '__main__':
210
240
  cov.stop()
211
241
  cov.html_report(directory=str(CommandLineArgs.coverage_report_path / CommandLineArgs.root_node))
212
242
 
213
- sim.memory_for_address(64)
214
-
215
243