peakrdl-python 0.9.0rc4__tar.gz → 0.9.1__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 (147) hide show
  1. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/.github/workflows/action.yaml +19 -2
  2. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/PKG-INFO +5 -2
  3. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/docs/api.rst +24 -3
  4. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/docs/generated_package.rst +13 -3
  5. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/generate_and_test.py +19 -6
  6. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/pyproject.toml +8 -2
  7. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/__about__.py +1 -1
  8. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/__init__.py +3 -0
  9. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/__peakrdl__.py +21 -7
  10. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/_node_walkers.py +12 -10
  11. peakrdl_python-0.9.1/src/peakrdl_python/compiler_udp.py +99 -0
  12. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/exporter.py +112 -78
  13. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/lib/async_memory.py +1 -1
  14. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/lib/base.py +0 -7
  15. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/lib/fields.py +2 -1
  16. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/lib/memory.py +6 -6
  17. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/safe_name_utility.py +57 -16
  18. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/systemrdl_node_utility_functions.py +60 -25
  19. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/templates/addrmap.py.jinja +9 -9
  20. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/templates/addrmap_field.py.jinja +1 -1
  21. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/templates/addrmap_memory.py.jinja +3 -3
  22. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/templates/addrmap_register.py.jinja +7 -15
  23. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/templates/addrmap_tb.py.jinja +26 -26
  24. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/templates/reg_definitions.py.jinja +1 -1
  25. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python.egg-info/PKG-INFO +5 -2
  26. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python.egg-info/SOURCES.txt +8 -1
  27. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python.egg-info/requires.txt +7 -1
  28. peakrdl_python-0.9.1/tests/alternative_templates_dynamic/header.py.jinja +10 -0
  29. peakrdl_python-0.9.1/tests/alternative_templates_dynamic/header_tb.py.jinja +7 -0
  30. peakrdl_python-0.9.1/tests/alternative_templates_dynamic_toml/header_check.py +88 -0
  31. peakrdl_python-0.9.1/tests/alternative_templates_dynamic_toml/peakrdl.toml +3 -0
  32. peakrdl_python-0.9.1/tests/alternative_templates_toml/header_check.py +88 -0
  33. peakrdl_python-0.9.1/tests/testcases/reserved_elements.rdl +77 -0
  34. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/simple.rdl +6 -0
  35. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/unit_tests/simple_components.py +8 -3
  36. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/unit_tests/test_array_indexing.py +3 -3
  37. peakrdl_python-0.9.1/tests/unit_tests/test_export.py +729 -0
  38. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/unit_tests/test_optimised_reg_array.py +10 -13
  39. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/unit_tests/test_reg.py +4 -3
  40. peakrdl_python-0.9.0rc4/tests/unit_tests/test_export.py +0 -238
  41. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/.gitignore +0 -0
  42. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/.readthedocs.yaml +0 -0
  43. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/LICENSE +0 -0
  44. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/MANIFEST.in +0 -0
  45. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/README.md +0 -0
  46. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/docs/api_components.rst +0 -0
  47. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/docs/command_line.rst +0 -0
  48. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/docs/conf.py +0 -0
  49. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/docs/customisation.rst +0 -0
  50. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/docs/design_decisions.rst +0 -0
  51. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/docs/design_tools.rst +0 -0
  52. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/docs/genindex.rst +0 -0
  53. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/docs/index.rst +0 -0
  54. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/docs/installation.rst +0 -0
  55. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/docs/requirements.txt +0 -0
  56. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/example/array_access/array_access.rdl +0 -0
  57. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/example/array_access/demo_array_access.py +0 -0
  58. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/example/enumerated_fields/demo_enumerated_fields.py +0 -0
  59. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/example/enumerated_fields/enumerated_fields.rdl +0 -0
  60. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/example/optimised_access/demo_optimised_access.py +0 -0
  61. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/example/optimised_access/demo_optimised_array_access.py +0 -0
  62. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/example/optimised_access/optimised_access.rdl +0 -0
  63. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/example/optimised_access/optimised_array_access.rdl +0 -0
  64. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/example/overridden_names/demo_over_ridden_names.py +0 -0
  65. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/example/overridden_names/overridden_names.rdl +0 -0
  66. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/example/simulating_callbacks/chip_with_a_GPIO.rdl +0 -0
  67. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/example/simulating_callbacks/flashing_the_LED.py +0 -0
  68. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/example/tranversing_address_map/chip_with_registers.rdl +0 -0
  69. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/example/tranversing_address_map/dumping_register_state_to_json_file.py +0 -0
  70. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/example/tranversing_address_map/reg_dump.json +0 -0
  71. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/example/tranversing_address_map/reseting_registers.py +0 -0
  72. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/example/tranversing_address_map/writing_register_state_from_json_file.py +0 -0
  73. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/example/user_defined_properties/demo_user_defined_properties.py +0 -0
  74. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/example/user_defined_properties/user_defined_properties.rdl +0 -0
  75. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/example/why_ral/__init__.py +0 -0
  76. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/example/why_ral/gpio.rdl +0 -0
  77. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/example/why_ral/with_hal.py +0 -0
  78. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/example/why_ral/with_ral.py +0 -0
  79. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/example/why_ral/without_ral.py +0 -0
  80. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/generate_testcases.py +0 -0
  81. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/setup.cfg +0 -0
  82. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/.coveragerc +0 -0
  83. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/lib/__init__.py +0 -0
  84. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/lib/async_register.py +0 -0
  85. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/lib/callbacks.py +0 -0
  86. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/lib/register.py +0 -0
  87. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/lib/utility_functions.py +0 -0
  88. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/sim_lib/__init__.py +0 -0
  89. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/sim_lib/_callbacks.py +0 -0
  90. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/sim_lib/base.py +0 -0
  91. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/sim_lib/dummy_callbacks.py +0 -0
  92. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/sim_lib/field.py +0 -0
  93. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/sim_lib/memory.py +0 -0
  94. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/sim_lib/register.py +0 -0
  95. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/sim_lib/simulator.py +0 -0
  96. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/templates/__init__.py +0 -0
  97. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/templates/addrmap_simulation.py.jinja +0 -0
  98. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/templates/addrmap_simulation_tb.py.jinja +0 -0
  99. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/templates/addrmap_udp_property.py.jinja +0 -0
  100. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/templates/baseclass_simulation_tb.py.jinja +0 -0
  101. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/templates/baseclass_tb.py.jinja +0 -0
  102. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/templates/example.py.jinja +0 -0
  103. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/templates/header.py.jinja +0 -0
  104. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/templates/header_tb.py.jinja +0 -0
  105. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python/templates/sim_addrmap.py.jinja +0 -0
  106. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python.egg-info/dependency_links.txt +0 -0
  107. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python.egg-info/entry_points.txt +0 -0
  108. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/src/peakrdl_python.egg-info/top_level.txt +0 -0
  109. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/.mypy.ini +0 -0
  110. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/alternative_templates/header.py.jinja +0 -0
  111. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/alternative_templates/header_tb.py.jinja +0 -0
  112. {peakrdl_python-0.9.0rc4/tests/alternative_template_toml → peakrdl_python-0.9.1/tests/alternative_templates_toml}/peakrdl.toml +0 -0
  113. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/pylint.rc +0 -0
  114. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/RDLFormatCode_example.rdl +0 -0
  115. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/addr_map.rdl +0 -0
  116. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/all_register_access_types.rdl +0 -0
  117. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/basic.rdl +0 -0
  118. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/block_a.xml +0 -0
  119. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/block_b.xml +0 -0
  120. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/different_array_types.rdl +0 -0
  121. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/enum_example.rdl +0 -0
  122. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/example_issue_106.rdl +0 -0
  123. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/extended_memories.rdl +0 -0
  124. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/extended_sizes_registers_array.rdl +0 -0
  125. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/field_scope.rdl +0 -0
  126. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/field_with_overridden_reset.rdl +0 -0
  127. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/fields_with_HW_write.rdl +0 -0
  128. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/fields_with_reset_values.rdl +0 -0
  129. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/hidden_property.rdl +0 -0
  130. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/memories.rdl +0 -0
  131. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/memories_with_registers.rdl +0 -0
  132. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/msb0_and_lsb0.rdl +0 -0
  133. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/multi_block.rdl +0 -0
  134. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/multifile.rdl +0 -0
  135. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/name_clash.rdl +0 -0
  136. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/overridden_python_name.rdl +0 -0
  137. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/parametrised_readonly_and_readwrite.rdl +0 -0
  138. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/regfile_and_arrays.rdl +0 -0
  139. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/same_but_different_enum.rdl +0 -0
  140. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/signals_definitions_at_various_levels.rdl +0 -0
  141. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/simple.xml +0 -0
  142. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/simulator_test.rdl +0 -0
  143. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/sizes_registers.rdl +0 -0
  144. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/sizes_registers_array.rdl +0 -0
  145. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/user_defined_properties.rdl +0 -0
  146. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/testcases/write_only_enum_with_undefined_reset.rdl +0 -0
  147. {peakrdl_python-0.9.0rc4 → peakrdl_python-0.9.1}/tests/unit_tests/__init__.py +0 -0
@@ -10,7 +10,6 @@ on:
10
10
  pull_request:
11
11
  branches:
12
12
  - main
13
- - 0.9.0
14
13
  schedule:
15
14
  - cron: '00 6 1 * *'
16
15
  release:
@@ -40,6 +39,10 @@ jobs:
40
39
  - name: Run Main code Lint
41
40
  run: pylint --rcfile tests/pylint.rc src/peakrdl_python
42
41
 
42
+ - name: Install dependencies for unit tests
43
+ run: |
44
+ python -m pip install .[unit_test] -U
45
+
43
46
  - name: Run unit tests Lint
44
47
  run: pylint --rcfile tests/pylint.rc src/peakrdl_python tests/unit_tests
45
48
 
@@ -81,7 +84,9 @@ jobs:
81
84
  - name: Install dependencies
82
85
  run: |
83
86
  python -m pip install --upgrade pip
84
- 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]
85
90
 
86
91
  - name: Run Unit Tests
87
92
  run: |
@@ -134,6 +139,8 @@ jobs:
134
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
135
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
136
141
 
142
+ python -m generate_and_test --RDL_source_file tests/testcases/reserved_elements.rdl --root_node reserved_elements --hide_regex "(?:[\w_\[\]]+\.)+RSVD"
143
+
137
144
  peakrdl_integration:
138
145
  needs:
139
146
  - mypy
@@ -167,6 +174,7 @@ jobs:
167
174
  peakrdl python tests/testcases/simple.xml tests/testcases/multifile.rdl -o peakrdl_out/raw
168
175
  peakrdl python tests/testcases/extended_memories.rdl -o peakrdl_out/raw/
169
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"
170
178
  python -m unittest discover -s peakrdl_out/raw
171
179
 
172
180
  peakrdl python tests/testcases/basic.rdl -o peakrdl_out/raw_async/ --async
@@ -178,6 +186,15 @@ jobs:
178
186
 
179
187
  peakrdl python tests/testcases/basic.rdl -o peakrdl_out/no_test/ --skip_test_case_generation
180
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
+
181
198
  - name: Check Examples
182
199
  run: |
183
200
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: peakrdl-python
3
- Version: 0.9.0rc4
3
+ Version: 0.9.1
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)
@@ -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
@@ -467,7 +467,7 @@ included to reserve space or test functions.
467
467
  User Defined Property
468
468
  ---------------------
469
469
 
470
- PeakRDL Python supports a User Defined Propery (UDP): ``python_hide`` that can be used to hide
470
+ PeakRDL Python supports a User Defined Property (UDP): ``python_hide`` that can be used to hide
471
471
  items that should not appear in the generated python wrappers.
472
472
 
473
473
  In the following example, python wrapper generated would have the registers:
@@ -508,8 +508,18 @@ However the ``hidden_reg`` would not be included in the python wrappers
508
508
  The ``python_hide`` property can be overridden with the ``show_hidden`` argument to the peakrdl
509
509
  command line tool or the ``export`` method.
510
510
 
511
- Autoformating
512
- =============
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
+
520
+
521
+ Autoformatting
522
+ ==============
513
523
 
514
524
  The generated code is not perfect it often has lots of spare black lines, over time this will
515
525
  improve but the quickest way to resolve these issue is to include an autoformatter
@@ -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',
@@ -86,6 +85,13 @@ CommandLineParser.add_argument('--legacy_block_access', action='store_true',
86
85
  CommandLineParser.add_argument('--udp', dest='udp', nargs='*',
87
86
  type=str, help='any user defined properties to include in the '
88
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')
89
95
 
90
96
 
91
97
  def build_logging_cong(logfilepath:str):
@@ -143,7 +149,7 @@ if __name__ == '__main__':
143
149
  logfile_path = build_logging_cong(CommandLineArgs.output_path / f'{__file__}.log')
144
150
  logging.config.dictConfig(logfile_path)
145
151
 
146
- rdlc = RDLCompiler()
152
+ rdlc = compiler_with_udp_registers()
147
153
 
148
154
  if CommandLineArgs.ipxact is not None:
149
155
 
@@ -165,6 +171,12 @@ if __name__ == '__main__':
165
171
  node_list.append(node)
166
172
  print(node.inst_name)
167
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
+
168
180
  exporter = PythonExporter()
169
181
  start_time = time.time()
170
182
  exporter.export(node=spec, path=str(CommandLineArgs.output_path / 'generate_and_test_output'),
@@ -172,7 +184,8 @@ if __name__ == '__main__':
172
184
  delete_existing_package_content=not CommandLineArgs.suppress_cleanup,
173
185
  skip_library_copy=not CommandLineArgs.copy_libraries,
174
186
  legacy_block_access=CommandLineArgs.legacy_block_access,
175
- user_defined_properties_to_include=CommandLineArgs.udp)
187
+ user_defined_properties_to_include=CommandLineArgs.udp,
188
+ hidden_inst_name_regex=CommandLineArgs.hide_regex)
176
189
  print(f'generation time {time.time() - start_time}s')
177
190
 
178
191
  if not CommandLineArgs.export_only:
@@ -7,7 +7,7 @@ name = "peakrdl-python"
7
7
  dynamic = ["version"]
8
8
  requires-python = ">=3.7"
9
9
  dependencies = [
10
- "systemrdl-compiler>=1.24.0",
10
+ "systemrdl-compiler>=1.25.0",
11
11
  "jinja2",
12
12
  "asynctest;python_version<'3.8'",
13
13
  "typing-extensions;python_version<'3.11'"
@@ -62,4 +62,10 @@ dev = [
62
62
  "coverage",
63
63
  "peakrdl-ipxact"
64
64
  ]
65
- peakrdl = ["peakrdl"]
65
+ peakrdl = [
66
+ "peakrdl"
67
+ ]
68
+ unit_test = [
69
+ "peakrdl",
70
+ "tomli;python_version<'3.11'"
71
+ ]
@@ -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.9.0-rc4"
20
+ __version__ = "0.9.1"
@@ -17,3 +17,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
17
17
 
18
18
  """
19
19
  from .exporter import PythonExporter
20
+
21
+ from .compiler_udp import PythonHideUDP, PythonInstNameUDP
22
+ from .compiler_udp import compiler_with_udp_registers
@@ -28,6 +28,7 @@ from peakrdl.config import schema # type: ignore[import]
28
28
  #pylint: enable=no-name-in-module,import-error
29
29
 
30
30
  from .exporter import PythonExporter
31
+ from .compiler_udp import PythonHideUDP, PythonInstNameUDP
31
32
 
32
33
  if TYPE_CHECKING:
33
34
  import argparse
@@ -38,11 +39,14 @@ class Exporter(ExporterSubcommandPlugin):
38
39
  """
39
40
  PeakRDL export class, see PeakRDL for more details
40
41
  """
41
- short_desc = "Generater Python Wrappers"
42
+ short_desc = "Generate Python Wrappers"
42
43
  long_desc = "Generate Python Wrappers for the Register Model"
44
+ udp_definitions = [PythonHideUDP, PythonInstNameUDP]
45
+ generates_output_file = True
43
46
 
44
47
  cfg_schema = {
45
48
  "user_template_dir": schema.DirectoryPath(),
49
+ "user_template_context": { "*" : schema.AnyType() }
46
50
  }
47
51
 
48
52
  def add_exporter_arguments(self, arg_group: 'argparse._ActionsContainer') -> None:
@@ -79,6 +83,9 @@ class Exporter(ExporterSubcommandPlugin):
79
83
  'would be removed from the build python by default')
80
84
  arg_group.add_argument('--udp', dest='udp', nargs='*', type=str,
81
85
  help='any user defined properties to include in the reg_model')
86
+ arg_group.add_argument('--hide_regex', dest='hide_regex', type=str,
87
+ help='A regex that will cause any matching fully qualified node to '
88
+ 'be hidden')
82
89
 
83
90
  def do_export(self, top_node: 'AddrmapNode', options: 'argparse.Namespace') -> None:
84
91
  """
@@ -92,16 +99,23 @@ class Exporter(ExporterSubcommandPlugin):
92
99
 
93
100
  """
94
101
  templates = self.cfg['user_template_dir']
95
- peakrdl_exporter = \
96
- PythonExporter(user_template_dir=templates) # type: ignore[no-untyped-call]
102
+ user_template_context = self.cfg['user_template_context']
103
+ if user_template_context is None:
104
+ peakrdl_exporter = \
105
+ PythonExporter(user_template_dir=templates) # type: ignore[no-untyped-call]
106
+ else:
107
+ peakrdl_exporter = \
108
+ PythonExporter(user_template_dir=templates, # type: ignore[no-untyped-call]
109
+ user_template_context=user_template_context)
97
110
 
98
111
  peakrdl_exporter.export(
99
- top_node,
100
- options.output,
101
- options.is_async,
112
+ node=top_node,
113
+ path=options.output,
114
+ asyncoutput=options.is_async,
102
115
  skip_test_case_generation=options.skip_test_case_generation,
103
116
  delete_existing_package_content=not options.suppress_cleanup,
104
117
  legacy_block_access=options.legacy_block_access,
105
118
  show_hidden=options.show_hidden,
106
- user_defined_properties_to_include=options.udp
119
+ user_defined_properties_to_include=options.udp,
120
+ hidden_inst_name_regex=options.hide_regex
107
121
  )
@@ -22,19 +22,21 @@ from typing import Optional, List, Union, Iterator
22
22
  from systemrdl import RDLListener, WalkerAction # type: ignore
23
23
  from systemrdl.node import RegNode, MemNode, FieldNode, AddrmapNode, RegfileNode # type: ignore
24
24
 
25
+ from .systemrdl_node_utility_functions import HideNodeCallback
26
+
25
27
 
26
28
  class AddressMaps(RDLListener):
27
29
  """
28
30
  class intended to be used as part of the walker/listener protocol to find all the descendant
29
31
  address maps
30
32
  """
31
- def __init__(self, show_hidden: bool) -> None:
33
+ def __init__(self, hide_node_callback: HideNodeCallback) -> None:
32
34
  super().__init__()
33
35
  self.__address_maps: List[AddrmapNode] = []
34
- self.__show_hidden = show_hidden
36
+ self.__hide_node_callback = hide_node_callback
35
37
 
36
38
  def enter_Addrmap(self, node: AddrmapNode) -> Optional[WalkerAction]:
37
- if node.get_property('python_hide', default=False) and not self.__show_hidden:
39
+ if self.__hide_node_callback(node):
38
40
  return WalkerAction.SkipDescendants
39
41
 
40
42
  self.__address_maps.append(node)
@@ -50,7 +52,7 @@ class OwnedbyAddressMap(RDLListener):
50
52
  class intended to be used as part of the walker/listener protocol to find all the items owned
51
53
  by an address map but not the descendents of any address map
52
54
  """
53
- def __init__(self, show_hidden: bool) -> None:
55
+ def __init__(self, hide_node_callback: HideNodeCallback) -> None:
54
56
  super().__init__()
55
57
 
56
58
  self.registers: List[RegNode] = []
@@ -63,10 +65,10 @@ class OwnedbyAddressMap(RDLListener):
63
65
  self._hidden_memories: List[RegNode] = []
64
66
  self._hidden_addr_maps: List[AddrmapNode] = []
65
67
  self._hidden_reg_files: List[RegfileNode] = []
66
- self.__show_hidden = show_hidden
68
+ self.__hide_node_callback = hide_node_callback
67
69
 
68
70
  def enter_Reg(self, node: RegNode) -> Optional[WalkerAction]:
69
- if node.get_property('python_hide', default=False) and not self.__show_hidden:
71
+ if self.__hide_node_callback(node):
70
72
  self._hidden_registers.append(node)
71
73
  return WalkerAction.SkipDescendants
72
74
 
@@ -74,7 +76,7 @@ class OwnedbyAddressMap(RDLListener):
74
76
  return WalkerAction.Continue
75
77
 
76
78
  def enter_Mem(self, node: MemNode) -> Optional[WalkerAction]:
77
- if node.get_property('python_hide', default=False) and not self.__show_hidden:
79
+ if self.__hide_node_callback(node):
78
80
  self._hidden_memories.append(node)
79
81
  return WalkerAction.SkipDescendants
80
82
 
@@ -82,7 +84,7 @@ class OwnedbyAddressMap(RDLListener):
82
84
  return WalkerAction.Continue
83
85
 
84
86
  def enter_Field(self, node: FieldNode) -> Optional[WalkerAction]:
85
- if node.get_property('python_hide', default=False) and not self.__show_hidden:
87
+ if self.__hide_node_callback(node):
86
88
  self._hidden_fields.append(node)
87
89
  return WalkerAction.SkipDescendants
88
90
 
@@ -90,14 +92,14 @@ class OwnedbyAddressMap(RDLListener):
90
92
  return WalkerAction.Continue
91
93
 
92
94
  def enter_Addrmap(self, node: AddrmapNode) -> Optional[WalkerAction]:
93
- if not node.get_property('python_hide', default=False) or self.__show_hidden:
95
+ if not self.__hide_node_callback(node):
94
96
  self.addr_maps.append(node)
95
97
  else:
96
98
  self._hidden_addr_maps.append(node)
97
99
  return WalkerAction.SkipDescendants
98
100
 
99
101
  def enter_Regfile(self, node: RegfileNode) -> Optional[WalkerAction]:
100
- if node.get_property('python_hide', default=False) and not self.__show_hidden:
102
+ if self.__hide_node_callback(node):
101
103
  self._hidden_reg_files.append(node)
102
104
  return WalkerAction.SkipDescendants
103
105
 
@@ -0,0 +1,99 @@
1
+ """
2
+ peakrdl-python is a tool to generate Python Register Access Layer (RAL) from SystemRDL
3
+ Copyright (C) 2021 - 2023
4
+
5
+ This program is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
17
+
18
+ Defined the compiler classes that are used
19
+ """
20
+ from typing import Any
21
+ from systemrdl import RDLCompiler # type: ignore
22
+ from systemrdl.udp import UDPDefinition # type: ignore
23
+ from systemrdl.component import Field, Reg, Regfile, Mem, Addrmap # type: ignore
24
+ from systemrdl.node import FieldNode, RegNode, RegfileNode, MemNode, AddrmapNode # type: ignore
25
+ from systemrdl.node import Node # type: ignore
26
+
27
+ from .safe_name_utility import is_safe_field_name, is_safe_memory_name, is_safe_addrmap_name, \
28
+ is_safe_regfile_name, is_safe_register_name
29
+
30
+
31
+ def compiler_with_udp_registers(**kwargs: Any) -> RDLCompiler:
32
+ """
33
+ Factory function to create an instance of the systemRDL compiler with the UDP registrations
34
+ """
35
+ rdlc = RDLCompiler(**kwargs)
36
+ rdlc.register_udp(PythonHideUDP)
37
+ rdlc.register_udp(PythonInstNameUDP)
38
+
39
+ return rdlc
40
+
41
+
42
+ class PythonInstNameUDP(UDPDefinition):
43
+ """
44
+ Definition of the class for the ``python_inst_name`` systemRDL property used by peakrdl-python
45
+ """
46
+ name = "python_inst_name"
47
+ valid_components = {Field, Reg, Regfile, Mem, Addrmap}
48
+ valid_type = str
49
+
50
+ def validate(self, node: Node, value: str) -> None:
51
+ if isinstance(node, FieldNode):
52
+ if not is_safe_field_name(node, value):
53
+ self.msg.error(
54
+ f"{value} is not a safe node name for a field as it clashes with a python "
55
+ f"keyword or attribute of a peakrdl-python field",
56
+ self.get_src_ref(node)
57
+ )
58
+ elif isinstance(node, RegNode):
59
+ if not is_safe_register_name(node, value):
60
+ self.msg.error(
61
+ f"{value} is not a safe node name for a register as it clashes with a python "
62
+ f"keyword or attribute of a peakrdl-python register",
63
+ self.get_src_ref(node)
64
+ )
65
+ elif isinstance(node, RegfileNode):
66
+ if not is_safe_regfile_name(node, value):
67
+ self.msg.error(
68
+ f"{value} is not a safe node name for a regfile as it clashes with a python "
69
+ f"keyword or attribute of a peakrdl-python regfile",
70
+ self.get_src_ref(node)
71
+ )
72
+ elif isinstance(node, AddrmapNode):
73
+ if not is_safe_addrmap_name(node, value):
74
+ self.msg.error(
75
+ f"{value} is not a safe node name for a addrmap as it clashes with a python "
76
+ f"keyword or attribute of a peakrdl-python addrmap",
77
+ self.get_src_ref(node)
78
+ )
79
+ elif isinstance(node, MemNode):
80
+ if not is_safe_memory_name(node, value):
81
+ self.msg.error(
82
+ f"{value} is not a safe node name for a Memory as it clashes with a python "
83
+ f"keyword or attribute of a peakrdl-python memory",
84
+ self.get_src_ref(node)
85
+ )
86
+ else:
87
+ self.msg.error(
88
+ f"unhandled type for property {type(node)}",
89
+ self.get_src_ref(node)
90
+ )
91
+
92
+
93
+ class PythonHideUDP(UDPDefinition):
94
+ """
95
+ Definition of the class for the ``python_hide`` systemRDL property used by peakrdl-python
96
+ """
97
+ name = "python_hide"
98
+ valid_components = {Field, Reg, Regfile, Mem, Addrmap}
99
+ valid_type = bool