peakrdl-python 0.8.1__tar.gz → 0.9.0rc1__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 (133) hide show
  1. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/.github/workflows/action.yaml +48 -4
  2. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/PKG-INFO +1 -1
  3. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/docs/design_decisions.rst +9 -1
  4. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/docs/generated_package.rst +19 -0
  5. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/example/optimised_access/demo_optimised_array_access.py +0 -2
  6. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/generate_and_test.py +18 -7
  7. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/generate_testcases.py +40 -13
  8. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/__about__.py +1 -1
  9. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/__peakrdl__.py +6 -1
  10. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/exporter.py +45 -25
  11. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/lib/__init__.py +18 -17
  12. peakrdl_python-0.9.0rc1/src/peakrdl_python/lib/async_memory.py +646 -0
  13. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/lib/async_register.py +215 -72
  14. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/lib/base.py +61 -31
  15. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/lib/callbacks.py +170 -22
  16. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/lib/fields.py +3 -0
  17. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/lib/memory.py +220 -364
  18. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/lib/register.py +189 -65
  19. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/lib/utility_functions.py +23 -1
  20. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/sim_lib/dummy_callbacks.py +85 -4
  21. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/sim_lib/memory.py +4 -1
  22. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/sim_lib/simulator.py +111 -8
  23. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/systemrdl_node_utility_functions.py +1 -1
  24. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/templates/addrmap.py.jinja +13 -8
  25. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/templates/addrmap_memory.py.jinja +3 -3
  26. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/templates/addrmap_register.py.jinja +3 -3
  27. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/templates/addrmap_simulation_tb.py.jinja +22 -9
  28. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/templates/addrmap_tb.py.jinja +192 -21
  29. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/templates/baseclass_simulation_tb.py.jinja +5 -5
  30. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/templates/baseclass_tb.py.jinja +34 -10
  31. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/templates/example.py.jinja +2 -2
  32. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/templates/sim_addrmap.py.jinja +3 -3
  33. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python.egg-info/PKG-INFO +1 -1
  34. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python.egg-info/SOURCES.txt +3 -0
  35. peakrdl_python-0.9.0rc1/tests/testcases/extended_memories.rdl +28 -0
  36. peakrdl_python-0.9.0rc1/tests/testcases/extended_sizes_registers_array.rdl +13 -0
  37. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/unit_tests/simple_components.py +5 -15
  38. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/unit_tests/test_optimised_reg_array.py +5 -5
  39. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/unit_tests/test_reg.py +16 -0
  40. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/.gitignore +0 -0
  41. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/.readthedocs.yaml +0 -0
  42. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/LICENSE +0 -0
  43. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/MANIFEST.in +0 -0
  44. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/README.md +0 -0
  45. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/docs/api.rst +0 -0
  46. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/docs/api_components.rst +0 -0
  47. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/docs/command_line.rst +0 -0
  48. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/docs/conf.py +0 -0
  49. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/docs/customisation.rst +0 -0
  50. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/docs/design_tools.rst +0 -0
  51. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/docs/genindex.rst +0 -0
  52. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/docs/index.rst +0 -0
  53. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/docs/installation.rst +0 -0
  54. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/docs/requirements.txt +0 -0
  55. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/example/array_access/array_access.rdl +0 -0
  56. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/example/array_access/demo_array_access.py +0 -0
  57. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/example/enumerated_fields/demo_enumerated_fields.py +0 -0
  58. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/example/enumerated_fields/enumerated_fields.rdl +0 -0
  59. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/example/optimised_access/demo_optimised_access.py +0 -0
  60. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/example/optimised_access/optimised_access.rdl +0 -0
  61. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/example/optimised_access/optimised_array_access.rdl +0 -0
  62. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/example/overridden_names/demo_over_ridden_names.py +0 -0
  63. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/example/overridden_names/overridden_names.rdl +0 -0
  64. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/example/simulating_callbacks/chip_with_a_GPIO.rdl +0 -0
  65. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/example/simulating_callbacks/flashing_the_LED.py +0 -0
  66. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/example/tranversing_address_map/chip_with_registers.rdl +0 -0
  67. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/example/tranversing_address_map/dumping_register_state_to_json_file.py +0 -0
  68. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/example/tranversing_address_map/reg_dump.json +0 -0
  69. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/example/tranversing_address_map/reseting_registers.py +0 -0
  70. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/example/tranversing_address_map/writing_register_state_from_json_file.py +0 -0
  71. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/example/why_ral/__init__.py +0 -0
  72. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/example/why_ral/gpio.rdl +0 -0
  73. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/example/why_ral/with_hal.py +0 -0
  74. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/example/why_ral/with_ral.py +0 -0
  75. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/example/why_ral/without_ral.py +0 -0
  76. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/pyproject.toml +0 -0
  77. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/setup.cfg +0 -0
  78. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/.coveragerc +0 -0
  79. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/__init__.py +0 -0
  80. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/_node_walkers.py +0 -0
  81. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/safe_name_utility.py +0 -0
  82. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/sim_lib/__init__.py +0 -0
  83. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/sim_lib/_callbacks.py +0 -0
  84. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/sim_lib/base.py +0 -0
  85. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/sim_lib/field.py +0 -0
  86. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/sim_lib/register.py +0 -0
  87. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/templates/__init__.py +0 -0
  88. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/templates/addrmap_field.py.jinja +0 -0
  89. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/templates/addrmap_simulation.py.jinja +0 -0
  90. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/templates/header.py.jinja +0 -0
  91. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/templates/header_tb.py.jinja +0 -0
  92. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python/templates/reg_definitions.py.jinja +0 -0
  93. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python.egg-info/dependency_links.txt +0 -0
  94. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python.egg-info/entry_points.txt +0 -0
  95. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python.egg-info/requires.txt +0 -0
  96. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/src/peakrdl_python.egg-info/top_level.txt +0 -0
  97. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/.mypy.ini +0 -0
  98. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/alternative_template_toml/peakrdl.toml +0 -0
  99. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/alternative_templates/header.py.jinja +0 -0
  100. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/alternative_templates/header_tb.py.jinja +0 -0
  101. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/pylint.rc +0 -0
  102. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/RDLFormatCode_example.rdl +0 -0
  103. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/addr_map.rdl +0 -0
  104. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/all_register_access_types.rdl +0 -0
  105. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/basic.rdl +0 -0
  106. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/block_a.xml +0 -0
  107. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/block_b.xml +0 -0
  108. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/different_array_types.rdl +0 -0
  109. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/enum_example.rdl +0 -0
  110. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/example_issue_106.rdl +0 -0
  111. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/field_scope.rdl +0 -0
  112. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/field_with_overridden_reset.rdl +0 -0
  113. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/fields_with_HW_write.rdl +0 -0
  114. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/fields_with_reset_values.rdl +0 -0
  115. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/memories.rdl +0 -0
  116. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/memories_with_registers.rdl +0 -0
  117. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/msb0_and_lsb0.rdl +0 -0
  118. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/multi_block.rdl +0 -0
  119. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/multifile.rdl +0 -0
  120. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/name_clash.rdl +0 -0
  121. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/overridden_python_name.rdl +0 -0
  122. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/parametrised_readonly_and_readwrite.rdl +0 -0
  123. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/regfile_and_arrays.rdl +0 -0
  124. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/same_but_different_enum.rdl +0 -0
  125. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/signals_definitions_at_various_levels.rdl +0 -0
  126. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/simple.rdl +0 -0
  127. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/simple.xml +0 -0
  128. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/simulator_test.rdl +0 -0
  129. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/sizes_registers.rdl +0 -0
  130. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/sizes_registers_array.rdl +0 -0
  131. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/testcases/write_only_enum_with_undefined_reset.rdl +0 -0
  132. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/unit_tests/__init__.py +0 -0
  133. {peakrdl_python-0.8.1 → peakrdl_python-0.9.0rc1}/tests/unit_tests/test_array_indexing.py +0 -0
@@ -153,9 +153,12 @@ jobs:
153
153
 
154
154
  peakrdl python tests/testcases/basic.rdl -o peakrdl_out/raw/
155
155
  peakrdl python tests/testcases/simple.xml tests/testcases/multifile.rdl -o peakrdl_out/raw
156
+ peakrdl python tests/testcases/extended_memories.rdl -o peakrdl_out/raw/
156
157
  python -m unittest discover -s peakrdl_out/raw
157
158
  peakrdl python tests/testcases/basic.rdl -o peakrdl_out/raw_async/ --async
158
159
  python -m unittest discover -s peakrdl_out/raw_async
160
+ peakrdl python tests/testcases/basic.rdl -o peakrdl_out/raw_legacy/ --legacy_block_access
161
+ python -m unittest discover -s peakrdl_out/raw_legacy
159
162
 
160
163
  peakrdl python tests/testcases/basic.rdl -o peakrdl_out/no_test/ --skip_test_case_generation
161
164
 
@@ -248,17 +251,58 @@ jobs:
248
251
 
249
252
  python -m unittest discover -s testcase_output
250
253
 
251
- - name: Test Autoformating
254
+ autoformating:
255
+ needs:
256
+ - integration_tests
257
+
258
+ runs-on: ubuntu-latest
259
+ strategy:
260
+ matrix:
261
+ # reduced matrix because the autoformatter was having issues with python 3.8 so we will
262
+ # limit this to modern versions of python only
263
+ python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
264
+
265
+ steps:
266
+ - uses: actions/checkout@v4
267
+
268
+ - name: Set up Python ${{ matrix.python-version }}
269
+ uses: actions/setup-python@v5
270
+ with:
271
+ python-version: ${{ matrix.python-version }}
272
+
273
+ - name: Install dependencies
252
274
  run: |
275
+ python -m pip install --upgrade pip
276
+ python -m pip install .
277
+ python -m pip install mypy
278
+ # one of the test cases uses IPxact so we need the importer
279
+ python -m pip install peakrdl-ipxact
280
+ # black is the autoformatter used for this this testing
253
281
  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
282
+
283
+ # retrieve the example code from the systemRDL compiler
284
+ wget -L https://raw.githubusercontent.com/SystemRDL/systemrdl-compiler/main/examples/accelera-generic_example.rdl -O tests/testcases/accelera-generic_example.rdl
285
+
286
+ - name: Generate testcases
287
+ run: |
288
+ # black will ignore files in the .gitingore by default, so we need to ensure that the
289
+ # content is generated with a different name
290
+ python generate_testcases.py --output autoformatted_output --test_case accelera-generic_example.rdl
291
+ # no need to check them as they are tested in the previous test
292
+
293
+ - name: Test Autoformating
294
+ run: |
295
+ # run the autoformatting
296
+ black autoformatted_output --line-length 120
297
+ # check the files are correct with mypy and unittesting
298
+ mypy autoformatted_output --config-file=tests/.mypy.ini
299
+ python -m unittest discover -s autoformatted_output
257
300
 
258
301
  #-------------------------------------------------------------------------------
259
302
  build:
260
303
  needs:
261
304
  - integration_tests
305
+ - autoformating
262
306
  - dev_runner
263
307
  - peakrdl_integration
264
308
  name: Build source distribution
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: peakrdl-python
3
- Version: 0.8.1
3
+ Version: 0.9.0rc1
4
4
  Summary: Generate Python Register Access Layer (RAL) from SystemRDL
5
5
  Author: Keith Brady
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -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,25 @@ 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 Callback
108
+ ---------------
109
+
110
+ .. versionchanged:: 0.9.0
111
+
112
+ Previous versions of peakrdl python used the python ``array.array`` for efficently 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 enties of up to
115
+ 64 bit.
116
+
117
+ In order to minimise the issues with older code the following types remain but require the
118
+ package to be built with the ``legacy_block_access`` option turned on
119
+
120
+ The callbacks are passed into the register access layer using either:
121
+
122
+ * ``NormalCallbackSetLegacy`` for standard python function callbacks
123
+ * ``AsyncCallbackSetLegacy`` for async python function callbacks, these are called from the library using
124
+ ``await``
125
+
107
126
  Using the Register Access Layer
108
127
  ===============================
109
128
 
@@ -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
 
@@ -35,11 +35,11 @@ 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
40
  from systemrdl import RDLCompiler
41
41
 
42
- #from peakrdl_ipxact import IPXACTImporter
42
+ from peakrdl_ipxact import IPXACTImporter
43
43
 
44
44
  sys.path.append('src')
45
45
  from peakrdl_python import PythonExporter
@@ -79,6 +79,11 @@ CommandLineParser.add_argument('--copy_libraries', action='store_true', dest='co
79
79
  'and debugging as multiple copies of the libraries can cause'
80
80
  'confusion. Therefore by default this script does not copy '
81
81
  'them over.')
82
+ CommandLineParser.add_argument('--legacy_block_access', action='store_true',
83
+ dest='legacy_block_access',
84
+ help='peakrdl python has two methods to hold blocks of data, the '
85
+ 'legacy mode based on Array or the new mode using lists')
86
+
82
87
 
83
88
  def build_logging_cong(logfilepath:str):
84
89
  return {
@@ -127,6 +132,7 @@ def build_logging_cong(logfilepath:str):
127
132
  }
128
133
  }
129
134
 
135
+
130
136
  if __name__ == '__main__':
131
137
 
132
138
  CommandLineArgs = CommandLineParser.parse_args()
@@ -161,7 +167,8 @@ if __name__ == '__main__':
161
167
  exporter.export(node=spec, path=str(CommandLineArgs.output_path / 'generate_and_test_output'),
162
168
  asyncoutput=CommandLineArgs.asyncoutput,
163
169
  delete_existing_package_content=not CommandLineArgs.suppress_cleanup,
164
- skip_library_copy=not CommandLineArgs.copy_libraries)
170
+ skip_library_copy=not CommandLineArgs.copy_libraries,
171
+ legacy_block_access=CommandLineArgs.legacy_block_access)
165
172
  print(f'generation time {time.time() - start_time}s')
166
173
 
167
174
  if not CommandLineArgs.export_only:
@@ -190,9 +197,15 @@ if __name__ == '__main__':
190
197
  globals(), locals(), ['CallbackSet'], 0)
191
198
 
192
199
  if CommandLineArgs.asyncoutput is True:
193
- callbackset_cls = getattr(peakrdl_python_package, 'AsyncCallbackSet')
200
+ if CommandLineArgs.legacy_block_access is True:
201
+ callbackset_cls = getattr(peakrdl_python_package, 'AsyncCallbackSetLegacy')
202
+ else:
203
+ callbackset_cls = getattr(peakrdl_python_package, 'AsyncCallbackSet')
194
204
  else:
195
- callbackset_cls = getattr(peakrdl_python_package, 'NormalCallbackSet')
205
+ if CommandLineArgs.legacy_block_access is True:
206
+ callbackset_cls = getattr(peakrdl_python_package, 'NormalCallbackSetLegacy')
207
+ else:
208
+ callbackset_cls = getattr(peakrdl_python_package, 'NormalCallbackSet')
196
209
 
197
210
  sim_cls = getattr(sim_module, sim_class_name)
198
211
  sim = sim_cls(address=0)
@@ -210,6 +223,4 @@ if __name__ == '__main__':
210
223
  cov.stop()
211
224
  cov.html_report(directory=str(CommandLineArgs.coverage_report_path / CommandLineArgs.root_node))
212
225
 
213
- sim.memory_for_address(64)
214
-
215
226
 
@@ -25,6 +25,8 @@ import os
25
25
 
26
26
  from glob import glob
27
27
  from typing import Optional, List
28
+ import argparse
29
+ import pathlib
28
30
 
29
31
  from systemrdl import RDLCompiler # type: ignore
30
32
  from systemrdl.node import Node, AddrmapNode # type: ignore
@@ -33,6 +35,13 @@ from src.peakrdl_python import PythonExporter # type: ignore
33
35
 
34
36
  test_case_path = os.path.join('tests', 'testcases')
35
37
 
38
+ CommandLineParser = argparse.ArgumentParser(description='Test the framework')
39
+ CommandLineParser.add_argument('--output', dest='output_path',
40
+ type=pathlib.Path,
41
+ default='testcase_output')
42
+ CommandLineParser.add_argument('--test_case', dest='test_case',
43
+ type=str)
44
+
36
45
 
37
46
  def compile_rdl(infile: str,
38
47
  incl_search_paths: Optional[List[str]] = None,
@@ -67,7 +76,8 @@ def compile_rdl(infile: str,
67
76
 
68
77
  def generate(root: Node, outdir: str,
69
78
  asyncoutput: bool = False,
70
- skip_test_case_generation: bool = False) -> List[str]:
79
+ skip_test_case_generation: bool = False,
80
+ legacy_block_access: bool = True) -> List[str]:
71
81
  """
72
82
  Generate a PeakRDL output package from compiled systemRDL
73
83
 
@@ -76,8 +86,8 @@ def generate(root: Node, outdir: str,
76
86
  outdir: directory to store the result in
77
87
  autoformatoutputs: If set to True the code will be run through autopep8 to
78
88
  clean it up. This can slow down large jobs or mask problems
79
- asyncoutput: If set to True the code build a register model with async operations to
80
- access the harware layer
89
+ legacy_block_access: If set to True the code build a register model the legacy array block
90
+ access as opposed to the newer list based
81
91
 
82
92
  Returns:
83
93
  List of strings with the module names generated
@@ -86,19 +96,24 @@ def generate(root: Node, outdir: str,
86
96
  print(f'Info: Generating python for {root.inst_name} in {outdir}')
87
97
  modules = PythonExporter().export(root, outdir, # type: ignore[no-untyped-call]
88
98
  asyncoutput=asyncoutput,
89
- skip_test_case_generation=skip_test_case_generation)
99
+ skip_test_case_generation=skip_test_case_generation,
100
+ legacy_block_access=legacy_block_access)
90
101
 
91
102
  return modules
92
103
 
93
104
 
94
105
  if __name__ == '__main__':
95
- if len(sys.argv) == 1:
96
- testcases = glob(os.path.join(test_case_path,'*.rdl'))
97
- else:
98
- testcases = glob(os.path.join(test_case_path,'{}.rdl').format(sys.argv[1]))
106
+
107
+ CommandLineArgs = CommandLineParser.parse_args()
108
+
109
+ output_path = CommandLineArgs.output_path
99
110
 
100
111
  #-------------------------------------------------------------------------------
101
112
  results = {}
113
+ if CommandLineArgs.test_case:
114
+ testcases = [os.path.join(test_case_path, CommandLineArgs.test_case)]
115
+ else:
116
+ testcases = glob(os.path.join(test_case_path, '*.rdl'))
102
117
  for case in testcases:
103
118
  print("Case: ", case)
104
119
  rdl_file = case
@@ -115,12 +130,24 @@ if __name__ == '__main__':
115
130
  else:
116
131
  root = compile_rdl(rdl_file)
117
132
 
118
- for asyncoutput, folder_name in [(False, 'raw'),
119
- (True, 'raw_async')]:
120
- _ = generate(root, os.path.join('testcase_output', folder_name),
121
- asyncoutput=asyncoutput)
133
+ for build_options, folder_name in \
134
+ [({'asyncoutput': True, 'legacy':False}, 'raw_async'),
135
+ ({'asyncoutput': False, 'legacy':False}, 'raw'),
136
+ ({'asyncoutput': True, 'legacy': True}, 'raw_async_legacy'),
137
+ ({'asyncoutput': False, 'legacy': True}, 'raw_legacy')
138
+ ]:
139
+
140
+ # test cases that use the extended widths an not be tested in the non-legacy modes
141
+ if (testcase_name in ['extended_memories', 'extended_sizes_registers_array']) and \
142
+ (build_options['legacy'] is True):
143
+ continue
144
+
145
+ _ = generate(root, str(output_path / folder_name),
146
+ asyncoutput=build_options['asyncoutput'],
147
+ legacy_block_access=build_options['legacy']
148
+ )
122
149
 
123
- module_fqfn = os.path.join('testcase_output', folder_name, '__init__.py')
150
+ module_fqfn = output_path / folder_name / '__init__.py'
124
151
  with open(module_fqfn, 'w', encoding='utf-8') as fid:
125
152
  fid.write('pass\n')
126
153
 
@@ -17,4 +17,4 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
17
17
 
18
18
  Variables that describes the peakrdl-python Package
19
19
  """
20
- __version__ = "0.8.1"
20
+ __version__ = "0.9.0.rc1"
@@ -68,6 +68,10 @@ class Exporter(ExporterSubcommandPlugin):
68
68
  'However, if additional python files are added by the user '
69
69
  '(not recommended) this cleanup will need to be suppressed '
70
70
  'and managed by the user')
71
+ arg_group.add_argument('--legacy_block_access', action='store_true',
72
+ dest='legacy_block_access',
73
+ help='peakrdl python has two methods to hold blocks of data, the '
74
+ 'legacy mode based on array.array or the new mode using lists')
71
75
 
72
76
  def do_export(self, top_node: 'AddrmapNode', options: 'argparse.Namespace') -> None:
73
77
  """
@@ -89,5 +93,6 @@ class Exporter(ExporterSubcommandPlugin):
89
93
  options.output,
90
94
  options.is_async,
91
95
  skip_test_case_generation=options.skip_test_case_generation,
92
- delete_existing_package_content=not options.suppress_cleanup
96
+ delete_existing_package_content=not options.suppress_cleanup,
97
+ legacy_block_access=options.legacy_block_access
93
98
  )
@@ -18,11 +18,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
18
18
  Main Classes for the peakrdl-python
19
19
  """
20
20
  import os
21
- import warnings
22
21
  from pathlib import Path
23
22
  from shutil import copy
24
23
  from typing import List, NoReturn, Iterable, Tuple, Dict, Any
25
- import sys
26
24
 
27
25
  import jinja2 as jj
28
26
  from systemrdl import RDLWalker # type: ignore
@@ -291,7 +289,8 @@ class PythonExporter:
291
289
  top_block: AddrmapNode,
292
290
  package: _Package,
293
291
  skip_lib_copy: bool,
294
- asyncoutput: bool) -> None:
292
+ asyncoutput: bool,
293
+ legacy_block_access: bool) -> None:
295
294
 
296
295
  context = {
297
296
  'print': print,
@@ -324,15 +323,17 @@ class PythonExporter:
324
323
  'get_reg_writable_fields': get_reg_writable_fields,
325
324
  'get_reg_readable_fields': get_reg_readable_fields,
326
325
  'get_memory_max_entry_value_hex_string': get_memory_max_entry_value_hex_string,
327
- 'get_array_typecode': get_array_typecode,
328
326
  'get_memory_width_bytes': get_memory_width_bytes,
329
327
  'get_field_default_value': get_field_default_value,
330
328
  'raise_template_error' : self._raise_template_error,
331
329
  'get_python_path_segments' : get_python_path_segments,
332
330
  'safe_node_name' : safe_node_name,
333
331
  'skip_lib_copy': skip_lib_copy,
334
- 'version' : __version__
332
+ 'version' : __version__,
333
+ 'legacy_block_access' : legacy_block_access,
335
334
  }
335
+ if legacy_block_access is True:
336
+ context['get_array_typecode'] = get_array_typecode
336
337
 
337
338
  context.update(self.user_template_context)
338
339
 
@@ -345,7 +346,8 @@ class PythonExporter:
345
346
  top_block: AddrmapNode,
346
347
  package: _Package,
347
348
  skip_lib_copy: bool,
348
- asyncoutput: bool) -> None:
349
+ asyncoutput: bool,
350
+ legacy_block_access: bool) -> None:
349
351
 
350
352
  context = {
351
353
  'top_node': top_block,
@@ -354,8 +356,8 @@ class PythonExporter:
354
356
  'isinstance': isinstance,
355
357
  'asyncoutput': asyncoutput,
356
358
  'skip_lib_copy': skip_lib_copy,
357
- 'version': __version__
358
-
359
+ 'version': __version__,
360
+ 'legacy_block_access' : legacy_block_access,
359
361
  }
360
362
 
361
363
  context.update(self.user_template_context)
@@ -369,7 +371,8 @@ class PythonExporter:
369
371
  top_block: AddrmapNode,
370
372
  package: _Package,
371
373
  skip_lib_copy: bool,
372
- asyncoutput: bool) -> None:
374
+ asyncoutput: bool,
375
+ legacy_block_access: bool) -> None:
373
376
 
374
377
  context = {
375
378
  'top_node': top_block,
@@ -378,7 +381,8 @@ class PythonExporter:
378
381
  'isinstance': isinstance,
379
382
  'asyncoutput': asyncoutput,
380
383
  'skip_lib_copy': skip_lib_copy,
381
- 'version': __version__
384
+ 'version': __version__,
385
+ 'legacy_block_access' : legacy_block_access,
382
386
  }
383
387
 
384
388
  context.update(self.user_template_context)
@@ -392,7 +396,8 @@ class PythonExporter:
392
396
  top_block: AddrmapNode,
393
397
  package: _Package,
394
398
  skip_lib_copy: bool,
395
- asyncoutput: bool) -> None:
399
+ asyncoutput: bool,
400
+ legacy_block_access: bool) -> None:
396
401
  """
397
402
 
398
403
  Args:
@@ -408,7 +413,8 @@ class PythonExporter:
408
413
  'top_node': top_block,
409
414
  'asyncoutput': asyncoutput,
410
415
  'skip_lib_copy': skip_lib_copy,
411
- 'version': __version__
416
+ 'version': __version__,
417
+ 'legacy_block_access' : legacy_block_access,
412
418
  }
413
419
 
414
420
  context.update(self.user_template_context)
@@ -427,17 +433,20 @@ class PythonExporter:
427
433
  top_block: AddrmapNode,
428
434
  package: _Package,
429
435
  skip_lib_copy: bool,
430
- asyncoutput: bool) -> None:
436
+ asyncoutput: bool,
437
+ legacy_block_access: bool) -> None:
431
438
  """
432
439
 
433
440
  Args:
434
441
  top_block:
435
442
  package:
436
443
  asyncoutput:
444
+ legacy_block_access:
437
445
 
438
446
  Returns:
439
447
 
440
448
  """
449
+ #pylint: disable=too-many-locals
441
450
 
442
451
  blocks = AddressMaps()
443
452
  # running the walker populated the blocks with all the address maps in within the
@@ -463,7 +472,7 @@ class PythonExporter:
463
472
  def is_reg_array(item: RegNode) -> bool:
464
473
  return item.is_array
465
474
 
466
- rolled_owned_reg_array = filter(is_reg_array, rolled_owned_reg)
475
+ rolled_owned_reg_array = list(filter(is_reg_array, rolled_owned_reg))
467
476
 
468
477
  fq_block_name = '_'.join(block.get_path_segments(array_suffix='_{index:d}_'))
469
478
 
@@ -492,14 +501,16 @@ class PythonExporter:
492
501
  'get_reg_readable_fields': get_reg_readable_fields,
493
502
  'get_memory_max_entry_value_hex_string': get_memory_max_entry_value_hex_string,
494
503
  'get_enum_values': get_enum_values,
495
- 'get_array_typecode': get_array_typecode,
496
504
  'get_memory_width_bytes': get_memory_width_bytes,
497
505
  'asyncoutput': asyncoutput,
498
506
  'uses_enum': uses_enum(block),
499
507
  'skip_lib_copy': skip_lib_copy,
500
- 'version': __version__
508
+ 'version': __version__,
509
+ 'get_array_typecode' : get_array_typecode,
510
+ 'legacy_block_access': legacy_block_access,
501
511
  }
502
512
 
513
+
503
514
  self.__stream_jinja_template(template_name="addrmap_tb.py.jinja",
504
515
  target_package=package.tests,
505
516
  target_name='test_' + fq_block_name + '.py',
@@ -514,7 +525,8 @@ class PythonExporter:
514
525
  asyncoutput: bool = False,
515
526
  skip_test_case_generation: bool = False,
516
527
  delete_existing_package_content: bool = True,
517
- skip_library_copy: bool = False) -> List[str]:
528
+ skip_library_copy: bool = False,
529
+ legacy_block_access: bool = True) -> List[str]:
518
530
  """
519
531
  Generated Python Code and Testbench
520
532
 
@@ -531,13 +543,16 @@ class PythonExporter:
531
543
  useful to turn off when developing peakrdl python to avoid
532
544
  editing the wrong copy of the library. However, it is not
533
545
  recommended in end user cases
546
+ legacy_block_access (bool): version 0.8 changed the block access methods from using
547
+ arrays to to lists. This allows memory widths of other
548
+ than 8, 16, 32, 64 to be supported which are legal in
549
+ systemRDL. The legacy mode with Arrays is still in
550
+ the tool and will be turned on by default for a few
551
+ releases.
534
552
 
535
553
  Returns:
536
554
  List[str] : modules that have been exported:
537
555
  """
538
- if sys.version_info < (3, 8):
539
- warnings.warn('Support for Python 3.7 will be withdrawn in the next major release',
540
- category=DeprecationWarning)
541
556
 
542
557
  # If it is the root node, skip to top addrmap
543
558
  if isinstance(node, RootNode):
@@ -556,22 +571,27 @@ class PythonExporter:
556
571
  self._build_node_type_table(top_block)
557
572
 
558
573
  self.__export_reg_model(top_block=top_block, package=package, asyncoutput=asyncoutput,
559
- skip_lib_copy=skip_library_copy)
574
+ skip_lib_copy=skip_library_copy,
575
+ legacy_block_access=legacy_block_access)
560
576
 
561
577
  self.__export_simulator(top_block=top_block, package=package, asyncoutput=asyncoutput,
562
- skip_lib_copy=skip_library_copy)
578
+ skip_lib_copy=skip_library_copy,
579
+ legacy_block_access=legacy_block_access)
563
580
 
564
581
  self.__export_example(top_block=top_block, package=package, asyncoutput=asyncoutput,
565
- skip_lib_copy=skip_library_copy)
582
+ skip_lib_copy=skip_library_copy,
583
+ legacy_block_access=legacy_block_access)
566
584
 
567
585
  if not skip_test_case_generation:
568
586
 
569
587
  # export the baseclasses for the tests
570
588
  self.__export_base_tests(top_block=top_block, package=package, asyncoutput=asyncoutput,
571
- skip_lib_copy=skip_library_copy)
589
+ skip_lib_copy=skip_library_copy,
590
+ legacy_block_access=legacy_block_access)
572
591
  # export the tests themselves, these are broken down to one file per addressmap
573
592
  self.__export_tests(top_block=top_block, package=package, asyncoutput=asyncoutput,
574
- skip_lib_copy=skip_library_copy)
593
+ skip_lib_copy=skip_library_copy,
594
+ legacy_block_access=legacy_block_access)
575
595
 
576
596
  return top_block.inst_name
577
597
 
@@ -23,8 +23,8 @@ from .callbacks import ReadCallback
23
23
  from .callbacks import ReadBlockCallback
24
24
  from .callbacks import WriteCallback
25
25
  from .callbacks import WriteBlockCallback
26
- from .callbacks import NormalCallbackSet
27
- from .callbacks import AsyncCallbackSet
26
+ from .callbacks import NormalCallbackSet, NormalCallbackSetLegacy
27
+ from .callbacks import AsyncCallbackSet, AsyncCallbackSetLegacy
28
28
  from .callbacks import CallbackSet
29
29
 
30
30
  from .base import AddressMap
@@ -84,26 +84,27 @@ from .fields import FieldEnumAsyncReadOnly
84
84
  from .fields import FieldEnumAsyncWriteOnly
85
85
  from .fields import FieldEnumAsyncReadWrite
86
86
 
87
- from .memory import MemoryReadOnly
88
- from .memory import MemoryWriteOnly
89
- from .memory import MemoryReadWrite
87
+ from .memory import MemoryReadOnly, MemoryReadOnlyLegacy
88
+ from .memory import MemoryWriteOnly, MemoryWriteOnlyLegacy
89
+ from .memory import MemoryReadWrite, MemoryReadWriteLegacy
90
90
  from .memory import MemoryReadOnlyArray
91
91
  from .memory import MemoryWriteOnlyArray
92
92
  from .memory import MemoryReadWriteArray
93
- from .memory import MemoryAsyncReadOnly
94
- from .memory import MemoryAsyncWriteOnly
95
- from .memory import MemoryAsyncReadWrite
96
- from .memory import MemoryAsyncReadOnlyArray
97
- from .memory import MemoryAsyncWriteOnlyArray
98
- from .memory import MemoryAsyncReadWriteArray
99
- from .memory import ReadableMemory
100
- from .memory import WritableMemory
93
+ from .async_memory import MemoryAsyncReadOnly, MemoryAsyncReadOnlyLegacy
94
+ from .async_memory import MemoryAsyncWriteOnly, MemoryAsyncWriteOnlyLegacy
95
+ from .async_memory import MemoryAsyncReadWrite, MemoryAsyncReadWriteLegacy
96
+ from .async_memory import MemoryAsyncReadOnlyArray
97
+ from .async_memory import MemoryAsyncWriteOnlyArray
98
+ from .async_memory import MemoryAsyncReadWriteArray
99
+ from .memory import ReadableMemory, ReadableMemoryLegacy
100
+ from .memory import WritableMemory, WritableMemoryLegacy
101
101
  from .memory import Memory
102
- from .memory import ReadableAsyncMemory
103
- from .memory import WritableAsyncMemory
104
- from .memory import AsyncMemory
102
+ from .async_memory import ReadableAsyncMemory, ReadableAsyncMemoryLegacy
103
+ from .async_memory import WritableAsyncMemory, WritableAsyncMemoryLegacy
104
+ from .async_memory import AsyncMemory
105
105
  from .memory import MemoryArray
106
- from .memory import AsyncMemoryArray
106
+ from .async_memory import AsyncMemoryArray
107
107
 
108
108
  from .utility_functions import get_array_typecode
109
+ from .utility_functions import UnsupportedWidthError
109
110
  from .base import Node