peakrdl-python 1.4.0__tar.gz → 2.0.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 (186) hide show
  1. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/.github/workflows/action.yaml +43 -16
  2. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/PKG-INFO +82 -6
  3. peakrdl_python-2.0.0/README.md +106 -0
  4. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/docs/api_components.rst +4 -4
  5. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/docs/generated_package.rst +37 -0
  6. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/example/array_access/demo_array_access.py +7 -7
  7. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/example/enumerated_fields/demo_enumerated_fields.py +5 -5
  8. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/example/optimised_access/demo_optimised_access.py +12 -9
  9. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/example/optimised_access/demo_optimised_array_access.py +4 -4
  10. peakrdl_python-2.0.0/example/overridden_names/demo_over_ridden_names.py +22 -0
  11. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/example/simulating_callbacks/flashing_the_LED.py +8 -5
  12. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/example/tranversing_address_map/dumping_register_state_to_json_file.py +7 -4
  13. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/example/tranversing_address_map/reseting_registers.py +8 -6
  14. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/example/tranversing_address_map/writing_register_state_from_json_file.py +8 -5
  15. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/example/user_defined_properties/demo_user_defined_properties.py +6 -3
  16. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/example/why_ral/with_hal.py +31 -10
  17. peakrdl_python-2.0.0/example/why_ral/with_ral.py +22 -0
  18. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/example/why_ral/without_ral.py +1 -1
  19. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/generate_and_test.py +32 -20
  20. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/generate_testcases.py +44 -24
  21. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/pyproject.toml +17 -17
  22. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/__about__.py +1 -1
  23. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/__init__.py +1 -1
  24. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/__peakrdl__.py +57 -4
  25. peakrdl_python-2.0.0/src/peakrdl_python/_deploy_package.py +203 -0
  26. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/_node_walkers.py +2 -2
  27. peakrdl_python-2.0.0/src/peakrdl_python/class_names.py +117 -0
  28. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/compiler_udp.py +1 -1
  29. peakrdl_python-2.0.0/src/peakrdl_python/exporter.py +1207 -0
  30. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/lib/__init__.py +16 -9
  31. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/lib/async_memory.py +144 -95
  32. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/lib/async_register_and_field.py +29 -39
  33. peakrdl_python-2.0.0/src/peakrdl_python/lib/base.py +507 -0
  34. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/lib/base_field.py +12 -15
  35. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/lib/base_register.py +35 -61
  36. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/lib/callbacks.py +1 -1
  37. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/lib/field_encoding.py +1 -1
  38. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/lib/memory.py +154 -105
  39. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/lib/register_and_field.py +27 -39
  40. peakrdl_python-2.0.0/src/peakrdl_python/lib/sections.py +606 -0
  41. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/lib/utility_functions.py +19 -1
  42. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/safe_name_utility.py +1 -1
  43. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/sim_lib/_callbacks.py +1 -1
  44. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/sim_lib/base.py +1 -1
  45. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/sim_lib/dummy_callbacks.py +1 -1
  46. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/sim_lib/field.py +1 -1
  47. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/sim_lib/memory.py +1 -1
  48. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/sim_lib/register.py +1 -1
  49. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/sim_lib/simulator.py +1 -1
  50. peakrdl_python-2.0.0/src/peakrdl_python/systemrdl_node_hashes.py +426 -0
  51. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/systemrdl_node_utility_functions.py +101 -120
  52. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/templates/__init__.py +1 -1
  53. peakrdl_python-2.0.0/src/peakrdl_python/templates/addrmap.py.jinja +339 -0
  54. peakrdl_python-2.0.0/src/peakrdl_python/templates/addrmap_field.py.jinja +68 -0
  55. peakrdl_python-2.0.0/src/peakrdl_python/templates/addrmap_memory.py.jinja +145 -0
  56. peakrdl_python-2.0.0/src/peakrdl_python/templates/addrmap_register.py.jinja +211 -0
  57. peakrdl_python-1.4.0/src/peakrdl_python/templates/sim_addrmap.py.jinja → peakrdl_python-2.0.0/src/peakrdl_python/templates/addrmap_simulation.py.jinja +12 -7
  58. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/templates/addrmap_simulation_tb.py.jinja +9 -4
  59. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/templates/addrmap_system_rdl_name_mapping.py.jinja +5 -11
  60. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/templates/addrmap_tb.py.jinja +93 -77
  61. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/templates/addrmap_udp_property.py.jinja +4 -3
  62. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/templates/addrmap_universal_property.py.jinja +1 -0
  63. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/templates/baseclass_simulation_tb.py.jinja +15 -10
  64. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/templates/baseclass_tb.py.jinja +27 -21
  65. peakrdl_python-2.0.0/src/peakrdl_python/templates/child_definitions.py.jinja +43 -0
  66. peakrdl_python-2.0.0/src/peakrdl_python/templates/example.py.jinja +35 -0
  67. peakrdl_python-2.0.0/src/peakrdl_python/templates/field_enums.py.jinja +45 -0
  68. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/templates/header.py.jinja +1 -1
  69. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/templates/header_tb.py.jinja +1 -1
  70. peakrdl_python-2.0.0/src/peakrdl_python/templates/property_enums.py.jinja +43 -0
  71. peakrdl_python-2.0.0/src/peakrdl_python/templates/reg_definitions.py.jinja +33 -0
  72. peakrdl_python-2.0.0/src/peakrdl_python/templates/template_ultilities.py.jinja +33 -0
  73. peakrdl_python-2.0.0/src/peakrdl_python/unique_component_iterator.py +412 -0
  74. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python.egg-info/PKG-INFO +82 -6
  75. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python.egg-info/SOURCES.txt +14 -1
  76. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python.egg-info/requires.txt +4 -1
  77. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/alternative_templates_dynamic_toml/header_check.py +1 -1
  78. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/alternative_templates_toml/header_check.py +1 -1
  79. peakrdl_python-2.0.0/tests/pathological_register_maps/pathalogical_rdl_builder.py +238 -0
  80. peakrdl_python-2.0.0/tests/pathological_register_maps/templates/pathological_template.rdl.jinja +89 -0
  81. peakrdl_python-2.0.0/tests/testcases/aliases.rdl +20 -0
  82. peakrdl_python-2.0.0/tests/testcases/deduplicated_field.rdl +46 -0
  83. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/different_array_types.rdl +27 -89
  84. peakrdl_python-2.0.0/tests/testcases/name_desc_option_deduplicate.rdl +121 -0
  85. peakrdl_python-1.4.0/src/peakrdl_python/templates/addrmap_simulation.py.jinja → peakrdl_python-2.0.0/tests/unit_tests/__init__.py +6 -3
  86. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/unit_tests/simple_components.py +116 -18
  87. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/unit_tests/test_array_indexing.py +175 -26
  88. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/unit_tests/test_building_inner_addrmap.py +22 -8
  89. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/unit_tests/test_export.py +234 -32
  90. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/unit_tests/test_field.py +73 -25
  91. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/unit_tests/test_name_desc_export.py +19 -4
  92. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/unit_tests/test_optimised_reg_array.py +18 -17
  93. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/unit_tests/test_reg.py +19 -18
  94. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/unit_tests/test_system_rdl_enum.py +16 -0
  95. peakrdl_python-1.4.0/README.md +0 -31
  96. peakrdl_python-1.4.0/example/overridden_names/demo_over_ridden_names.py +0 -17
  97. peakrdl_python-1.4.0/example/why_ral/with_ral.py +0 -19
  98. peakrdl_python-1.4.0/src/peakrdl_python/exporter.py +0 -930
  99. peakrdl_python-1.4.0/src/peakrdl_python/lib/base.py +0 -942
  100. peakrdl_python-1.4.0/src/peakrdl_python/templates/addrmap.py.jinja +0 -468
  101. peakrdl_python-1.4.0/src/peakrdl_python/templates/addrmap_field.py.jinja +0 -42
  102. peakrdl_python-1.4.0/src/peakrdl_python/templates/addrmap_memory.py.jinja +0 -118
  103. peakrdl_python-1.4.0/src/peakrdl_python/templates/addrmap_register.py.jinja +0 -152
  104. peakrdl_python-1.4.0/src/peakrdl_python/templates/example.py.jinja +0 -13
  105. peakrdl_python-1.4.0/src/peakrdl_python/templates/reg_definitions.py.jinja +0 -63
  106. peakrdl_python-1.4.0/tests/unit_tests/__init__.py +0 -4
  107. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/.gitignore +0 -0
  108. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/.readthedocs.yaml +0 -0
  109. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/LICENSE +0 -0
  110. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/MANIFEST.in +0 -0
  111. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/docs/api.rst +0 -0
  112. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/docs/command_line.rst +0 -0
  113. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/docs/conf.py +0 -0
  114. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/docs/customisation.rst +0 -0
  115. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/docs/design_decisions.rst +0 -0
  116. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/docs/design_tools.rst +0 -0
  117. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/docs/genindex.rst +0 -0
  118. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/docs/index.rst +0 -0
  119. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/docs/installation.rst +0 -0
  120. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/docs/requirements.txt +0 -0
  121. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/example/array_access/array_access.rdl +0 -0
  122. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/example/enumerated_fields/enumerated_fields.rdl +0 -0
  123. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/example/optimised_access/optimised_access.rdl +0 -0
  124. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/example/optimised_access/optimised_array_access.rdl +0 -0
  125. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/example/overridden_names/overridden_names.rdl +0 -0
  126. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/example/simulating_callbacks/chip_with_a_GPIO.rdl +0 -0
  127. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/example/tranversing_address_map/chip_with_registers.rdl +0 -0
  128. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/example/tranversing_address_map/reg_dump.json +0 -0
  129. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/example/user_defined_properties/user_defined_properties.rdl +0 -0
  130. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/example/why_ral/__init__.py +0 -0
  131. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/example/why_ral/gpio.rdl +0 -0
  132. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/setup.cfg +0 -0
  133. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/.coveragerc +0 -0
  134. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/lib/py.typed +0 -0
  135. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/py.typed +0 -0
  136. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/sim_lib/__init__.py +0 -0
  137. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python/sim_lib/py.typed +0 -0
  138. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python.egg-info/dependency_links.txt +0 -0
  139. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python.egg-info/entry_points.txt +0 -0
  140. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/src/peakrdl_python.egg-info/top_level.txt +0 -0
  141. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/alternative_templates/header.py.jinja +0 -0
  142. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/alternative_templates/header_tb.py.jinja +0 -0
  143. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/alternative_templates_dynamic/header.py.jinja +0 -0
  144. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/alternative_templates_dynamic/header_tb.py.jinja +0 -0
  145. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/alternative_templates_dynamic_toml/peakrdl.toml +0 -0
  146. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/alternative_templates_toml/peakrdl.toml +0 -0
  147. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/RDLFormatCode_example.rdl +0 -0
  148. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/addr_map.rdl +0 -0
  149. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/all_register_access_types.rdl +0 -0
  150. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/basic.rdl +0 -0
  151. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/block_a.xml +0 -0
  152. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/block_b.xml +0 -0
  153. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/enum_example.rdl +0 -0
  154. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/example_issue_106.rdl +0 -0
  155. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/extended_memories.rdl +0 -0
  156. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/extended_sizes_registers_array.rdl +0 -0
  157. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/field_scope.rdl +0 -0
  158. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/field_with_overridden_reset.rdl +0 -0
  159. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/fields_with_HW_write.rdl +0 -0
  160. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/fields_with_reset_values.rdl +0 -0
  161. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/hidden_property.rdl +0 -0
  162. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/large_field_combinations.rdl +0 -0
  163. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/memories.rdl +0 -0
  164. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/memories_with_registers.rdl +0 -0
  165. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/msb0_and_lsb0.rdl +0 -0
  166. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/multi_block.rdl +0 -0
  167. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/multifile.rdl +0 -0
  168. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/name_clash.rdl +0 -0
  169. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/name_desc_all_levels.rdl +0 -0
  170. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/overridden_python_name.rdl +0 -0
  171. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/parametrised_readonly_and_readwrite.rdl +0 -0
  172. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/parametrised_top.rdl +0 -0
  173. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/reg_name_stress.rdl +0 -0
  174. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/regfile_and_arrays.rdl +0 -0
  175. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/reserved_elements.rdl +0 -0
  176. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/same_but_different_enum.rdl +0 -0
  177. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/shared_register_issue_202 +0 -0
  178. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/signals_definitions_at_various_levels.rdl +0 -0
  179. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/simple.rdl +0 -0
  180. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/simple.xml +0 -0
  181. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/simulator_test.rdl +0 -0
  182. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/sizes_registers.rdl +0 -0
  183. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/sizes_registers_array.rdl +0 -0
  184. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/sparse_enum_issue_200.rdl +0 -0
  185. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/user_defined_properties.rdl +0 -0
  186. {peakrdl_python-1.4.0 → peakrdl_python-2.0.0}/tests/testcases/write_only_enum_with_undefined_reset.rdl +0 -0
@@ -10,6 +10,7 @@ on:
10
10
  pull_request:
11
11
  branches:
12
12
  - main
13
+ - 'release/**'
13
14
  schedule:
14
15
  - cron: '00 6 1 * *'
15
16
  release:
@@ -136,12 +137,15 @@ jobs:
136
137
  python -m generate_and_test --RDL_source_file tests/testcases/accelera-generic_example.rdl --root_node some_register_map
137
138
  python -m generate_and_test --RDL_source_file tests/testcases/accelera-generic_example.rdl --root_node some_register_map --legacy_block_access
138
139
  python -m generate_and_test --RDL_source_file tests/testcases/accelera-generic_example.rdl --root_node some_register_map --legacy_enum_type
140
+ python -m generate_and_test --RDL_source_file tests/testcases/accelera-generic_example.rdl --root_node some_register_map --copy_libraries
139
141
 
140
142
  python -m generate_and_test --RDL_source_file tests/testcases/user_defined_properties.rdl --root_node user_defined_properties --udp bool_property_to_include
141
143
  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
142
144
  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
143
145
  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
144
146
  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
147
+
148
+ python -m generate_and_test --RDL_source_file tests/testcases/user_defined_properties.rdl --root_node user_defined_properties --udp_regex "bool_property_to_include|enum_property_to_include|int_property_to_include|str_property_to_include|struct_property_to_include|double_layer_struct_property_to_include"
145
149
 
146
150
  python -m generate_and_test --RDL_source_file tests/testcases/reserved_elements.rdl --root_node reserved_elements --hide_regex "(?:[\w_\[\]]+\.)+RSVD"
147
151
 
@@ -179,7 +183,8 @@ jobs:
179
183
  peakrdl python tests/testcases/hidden_property.rdl -o peakrdl_out/raw/show_hidden/ --show_hidden
180
184
  peakrdl python tests/testcases/simple.xml tests/testcases/multifile.rdl -o peakrdl_out/raw
181
185
  peakrdl python tests/testcases/extended_memories.rdl -o peakrdl_out/raw/
182
- peakrdl python tests/testcases/user_defined_properties.rdl -o peakrdl_out/raw/ --udp bool_property_to_include
186
+ peakrdl python tests/testcases/user_defined_properties.rdl -o peakrdl_out/raw/list/ --udp bool_property_to_include enum_property_to_include struct_property_to_include str_property_to_include
187
+ peakrdl python tests/testcases/user_defined_properties.rdl -o peakrdl_out/raw/regex/ --udp_regex "bool_property_to_include|enum_property_to_include|struct_property_to_include|str_property_to_include"
183
188
  peakrdl python tests/testcases/reserved_elements.rdl -o peakrdl_out/raw/ --hide_regex "(?:[\w_\[\]]+\.)+RSVD"
184
189
  peakrdl python tests/testcases/parametrised_top.rdl -o peakrdl_out/raw/ -P MY_PARAM=3
185
190
  python -m unittest discover -s peakrdl_out/raw
@@ -257,17 +262,25 @@ jobs:
257
262
  python -m with_hal
258
263
 
259
264
  cd ../..
265
+
266
+ cd example/user_defined_properties/
267
+ peakrdl python user_defined_properties.rdl -o . --udp_regex "^(?!python_hide$)(?!python_name$).+"
268
+ python -m demo_user_defined_properties
269
+
270
+ cd ../..
271
+
272
+
260
273
 
261
274
  integration_tests:
262
275
  needs:
263
- - mypy
264
- - lint
265
- - unit_tests
276
+ - peakrdl_integration
277
+ - dev_runner
266
278
 
267
279
  runs-on: ubuntu-latest
268
280
  strategy:
269
281
  matrix:
270
282
  python-version: [3.9, "3.10", "3.11", "3.12", "3.13", "3.14"]
283
+ lib_copy: [true, false]
271
284
 
272
285
  steps:
273
286
  - uses: actions/checkout@v4
@@ -284,32 +297,46 @@ jobs:
284
297
 
285
298
  # retrieve the example code from the systemRDL compiler
286
299
  wget -L https://raw.githubusercontent.com/SystemRDL/systemrdl-compiler/main/examples/accelera-generic_example.rdl -O tests/testcases/accelera-generic_example.rdl
287
-
288
- - name: Generate testcases
289
- run: |
290
-
300
+
291
301
  # one of the test cases uses IPxact so we need the importer
292
302
  python -m pip install peakrdl-ipxact
293
303
  # the generated code is type checked with mypy so this is needed
294
304
  python -m pip install mypy
295
305
 
296
- python generate_testcases.py
306
+ - name: Generate testcases (lib_copy true)
307
+ if: matrix.lib_copy == true
308
+ run: |
309
+ python generate_testcases.py --copy_libraries --output lib_included_testcase_output
310
+
311
+ - name: Generate testcases (lib_copy false)
312
+ if: matrix.lib_copy == false
313
+ run: |
314
+ python generate_testcases.py --output lib_excluded_testcase_output
315
+
316
+ - name: Static checks (lib_copy true)
317
+ if: matrix.lib_copy == true
318
+ run: |
319
+ mypy lib_included_testcase_output
297
320
 
298
- - name: Static checks
321
+ - name: Static checks (lib_copy false)
322
+ if: matrix.lib_copy == false
299
323
  run: |
324
+ mypy lib_excluded_testcase_output
300
325
 
301
- mypy testcase_output
302
- # pylint testcase_output/autopep8 --disable=duplicate-code,line-too-long,too-many-statements,invalid-name,unused-import,too-many-instance-attributes,too-many-arguments,too-many-lines
326
+ - name: Run the generated tests (lib_copy true)
327
+ if: matrix.lib_copy == true
328
+ run: |
329
+ python -m unittest discover -s lib_included_testcase_output
303
330
 
304
- - name: Run the generated tests
331
+ - name: Run the generated tests (lib_copy false)
332
+ if: matrix.lib_copy == false
305
333
  run: |
306
- python -m unittest discover -s testcase_output
334
+ python -m unittest discover -s lib_excluded_testcase_output
307
335
 
308
336
  autoformating:
309
337
  needs:
310
338
  - integration_tests
311
- - peakrdl_integration
312
- - dev_runner
339
+
313
340
 
314
341
  runs-on: ubuntu-latest
315
342
  strategy:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: peakrdl-python
3
- Version: 1.4.0
3
+ Version: 2.0.0
4
4
  Summary: Generate Python Register Access Layer (RAL) from SystemRDL
5
5
  Author: Keith Brady
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -704,11 +704,12 @@ License-File: LICENSE
704
704
  Requires-Dist: systemrdl-compiler>=1.29.3
705
705
  Requires-Dist: jinja2
706
706
  Requires-Dist: typing-extensions; python_version < "3.11"
707
+ Requires-Dist: more_itertools; python_version < "3.13"
707
708
  Provides-Extra: dev
708
709
  Requires-Dist: mypy; extra == "dev"
709
710
  Requires-Dist: pylint; extra == "dev"
710
711
  Requires-Dist: coverage; extra == "dev"
711
- Requires-Dist: peakrdl-ipxact; extra == "dev"
712
+ Requires-Dist: peakrdl; extra == "dev"
712
713
  Provides-Extra: peakrdl
713
714
  Requires-Dist: peakrdl; extra == "peakrdl"
714
715
  Provides-Extra: unit-test
@@ -717,16 +718,84 @@ Requires-Dist: tomli; python_version < "3.11" and extra == "unit-test"
717
718
  Dynamic: license-file
718
719
 
719
720
  ![CI](https://github.com/krcb197/PeakRDL-python/actions/workflows/action.yaml/badge.svg)
721
+ [![linting: pylint](https://img.shields.io/badge/linting-pylint-yellowgreen)](https://github.com/pylint-dev/pylint)
722
+ [![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
720
723
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/peakrdl-python.svg)](https://pypi.org/project/peakrdl-python)
721
724
  [![Documentation Status](https://readthedocs.org/projects/peakrdl-python/badge/?version=latest)](https://peakrdl-python.readthedocs.io/en/latest/?badge=latest)
722
725
  [![Downloads](https://static.pepy.tech/badge/peakrdl-python)](https://pepy.tech/project/peakrdl-python)
723
726
 
724
- # peakrdl-python
725
- Generate Python Register Access Layer (RAL) from SystemRDL
727
+ # Introduction
728
+ PeakRDL Python is used to generate a python based Register Access Layer (RAL) from SystemRDL.
726
729
 
727
730
  ## Documentation
728
731
  See the [peakrdl-python Documentation](https://peakrdl-python.readthedocs.io/) for more details
729
732
 
733
+ ## Getting Started
734
+
735
+ ### Installation
736
+
737
+ 1. Install a recent version of Python 3
738
+ 2. Install `peakrdl-python`
739
+ ```console
740
+ python3 -m pip install peakrdl-python
741
+ ```
742
+ 3. (Optional) Install `peakrdl`, this is needed if you want to use peakrdl python from the command
743
+ line
744
+ ```console
745
+ python3 -m pip install peakrdl
746
+ ```
747
+
748
+ ### Demo
749
+
750
+ This demonstration relies on downloading the systemRDL example from Accelera, available here: [accelera-generic_example.rdl](https://github.com/SystemRDL/systemrdl-compiler/blob/main/examples/accelera-generic_example.rdl). This demonstration also
751
+ assumes that peakrdl has been installed.
752
+
753
+ 1. Build the Register Access Layer (RAL) from the systemRDL code
754
+ ```console
755
+ peakrdl python accelera-generic_example.rdl -o .
756
+ ```
757
+ This will create a python package called `some_register_map` containing the python RAL
758
+ 2. In addition to the RAL, peakrdl-python also generates a simulator that can be used to exercise
759
+ the RAL without connecting to real hardware. Enter the following code into a file:
760
+ ```python
761
+ """
762
+ A demonstration of using peakrdl-python using the accelera generic example
763
+ """
764
+ # import the top level RAL class
765
+ from some_register_map.reg_model import RegModel
766
+ # import the simulator class
767
+ from some_register_map.sim import Simulator
768
+
769
+ from some_register_map.lib import NormalCallbackSet
770
+
771
+ if __name__ == '__main__':
772
+ # create an instance of the RAL with the callbacks directed at the hardware simulator
773
+ hw_sim = Simulator(0)
774
+ ral = RegModel(callbacks=NormalCallbackSet(read_callback=hw_sim.read,
775
+ write_callback=hw_sim.write))
776
+
777
+ # read chip ID
778
+ chip_id_part_number = ral.chip_id_reg.part_num.read()
779
+ chip_id_revision_number = ral.chip_id_reg.part_num.read()
780
+ print(f'Chip ID:{chip_id_part_number}.{chip_id_revision_number}')
781
+ ```
782
+ save it as `some_register_map_demo.py`
783
+ 3. Run the example
784
+ ```commandline
785
+ python3 -m some_register_map_demo
786
+ ```
787
+ This will generate the following output on the console:
788
+ ```commandline
789
+ Chip ID:0.0
790
+ ```
791
+
792
+ # Usage
793
+
794
+ To make use of the RAL with real hardware or a different simulation, the callbacks will need to be
795
+ connected to the appropriate access function in order to perform an address space reads and writes
796
+
797
+ # Upgrading from previous versions (some important changes)
798
+
730
799
  ## Upgrading from pre 0.9.0
731
800
 
732
801
  In order to address a major limitation of peakrdl-python that prevented it from implementing the
@@ -741,9 +810,16 @@ documentation
741
810
  ## Upgrading from pre 1.2.0
742
811
 
743
812
  Version 1.2 introduced a new way to define the enumerations for the field encoding. This allows
744
- metadata from the systemRDL to propogate through to the generated code. This may break advanced
813
+ metadata from the systemRDL to propagate through to the generated code. This may break advanced
745
814
  usage of the python enumerations. User are encouraged to use the new feature, however, if there
746
- are problems with the old enumeation types (based on `IntEnum`) can be used, see
815
+ are problems with the old enumeration types (based on `IntEnum`) can be used, see
747
816
  _Legacy Enumeration Types_ in the documentation
748
817
 
818
+ ## Upgrading from pre 2.0.0
819
+
820
+ Version 2.0 introduced a significant change to the process for building the register model python
821
+ code. This change was intended to reduce the size of the generated code by only generating
822
+ python classes for systemRDL components that required unique classes. The previous versions were
823
+ more conservative and tended to generate a lot of duplicate classes.
824
+
749
825
 
@@ -0,0 +1,106 @@
1
+ ![CI](https://github.com/krcb197/PeakRDL-python/actions/workflows/action.yaml/badge.svg)
2
+ [![linting: pylint](https://img.shields.io/badge/linting-pylint-yellowgreen)](https://github.com/pylint-dev/pylint)
3
+ [![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
4
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/peakrdl-python.svg)](https://pypi.org/project/peakrdl-python)
5
+ [![Documentation Status](https://readthedocs.org/projects/peakrdl-python/badge/?version=latest)](https://peakrdl-python.readthedocs.io/en/latest/?badge=latest)
6
+ [![Downloads](https://static.pepy.tech/badge/peakrdl-python)](https://pepy.tech/project/peakrdl-python)
7
+
8
+ # Introduction
9
+ PeakRDL Python is used to generate a python based Register Access Layer (RAL) from SystemRDL.
10
+
11
+ ## Documentation
12
+ See the [peakrdl-python Documentation](https://peakrdl-python.readthedocs.io/) for more details
13
+
14
+ ## Getting Started
15
+
16
+ ### Installation
17
+
18
+ 1. Install a recent version of Python 3
19
+ 2. Install `peakrdl-python`
20
+ ```console
21
+ python3 -m pip install peakrdl-python
22
+ ```
23
+ 3. (Optional) Install `peakrdl`, this is needed if you want to use peakrdl python from the command
24
+ line
25
+ ```console
26
+ python3 -m pip install peakrdl
27
+ ```
28
+
29
+ ### Demo
30
+
31
+ This demonstration relies on downloading the systemRDL example from Accelera, available here: [accelera-generic_example.rdl](https://github.com/SystemRDL/systemrdl-compiler/blob/main/examples/accelera-generic_example.rdl). This demonstration also
32
+ assumes that peakrdl has been installed.
33
+
34
+ 1. Build the Register Access Layer (RAL) from the systemRDL code
35
+ ```console
36
+ peakrdl python accelera-generic_example.rdl -o .
37
+ ```
38
+ This will create a python package called `some_register_map` containing the python RAL
39
+ 2. In addition to the RAL, peakrdl-python also generates a simulator that can be used to exercise
40
+ the RAL without connecting to real hardware. Enter the following code into a file:
41
+ ```python
42
+ """
43
+ A demonstration of using peakrdl-python using the accelera generic example
44
+ """
45
+ # import the top level RAL class
46
+ from some_register_map.reg_model import RegModel
47
+ # import the simulator class
48
+ from some_register_map.sim import Simulator
49
+
50
+ from some_register_map.lib import NormalCallbackSet
51
+
52
+ if __name__ == '__main__':
53
+ # create an instance of the RAL with the callbacks directed at the hardware simulator
54
+ hw_sim = Simulator(0)
55
+ ral = RegModel(callbacks=NormalCallbackSet(read_callback=hw_sim.read,
56
+ write_callback=hw_sim.write))
57
+
58
+ # read chip ID
59
+ chip_id_part_number = ral.chip_id_reg.part_num.read()
60
+ chip_id_revision_number = ral.chip_id_reg.part_num.read()
61
+ print(f'Chip ID:{chip_id_part_number}.{chip_id_revision_number}')
62
+ ```
63
+ save it as `some_register_map_demo.py`
64
+ 3. Run the example
65
+ ```commandline
66
+ python3 -m some_register_map_demo
67
+ ```
68
+ This will generate the following output on the console:
69
+ ```commandline
70
+ Chip ID:0.0
71
+ ```
72
+
73
+ # Usage
74
+
75
+ To make use of the RAL with real hardware or a different simulation, the callbacks will need to be
76
+ connected to the appropriate access function in order to perform an address space reads and writes
77
+
78
+ # Upgrading from previous versions (some important changes)
79
+
80
+ ## Upgrading from pre 0.9.0
81
+
82
+ In order to address a major limitation of peakrdl-python that prevented it from implementing the
83
+ full systemRDL specification, a breaking API change was needed for handling blocks:
84
+ * registers (in register array)
85
+ * memory entries in a memory
86
+
87
+ Users are encouraged to upgrade in order to avoid this limitation. However, there is a legacy mode
88
+ to support users with existing designs, see: _Legacy Block Callback and Block Access_ in the
89
+ documentation
90
+
91
+ ## Upgrading from pre 1.2.0
92
+
93
+ Version 1.2 introduced a new way to define the enumerations for the field encoding. This allows
94
+ metadata from the systemRDL to propagate through to the generated code. This may break advanced
95
+ usage of the python enumerations. User are encouraged to use the new feature, however, if there
96
+ are problems with the old enumeration types (based on `IntEnum`) can be used, see
97
+ _Legacy Enumeration Types_ in the documentation
98
+
99
+ ## Upgrading from pre 2.0.0
100
+
101
+ Version 2.0 introduced a significant change to the process for building the register model python
102
+ code. This change was intended to reduce the size of the generated code by only generating
103
+ python classes for systemRDL components that required unique classes. The previous versions were
104
+ more conservative and tended to generate a lot of duplicate classes.
105
+
106
+
@@ -18,22 +18,22 @@ Base Classes
18
18
  Address Maps
19
19
  ============
20
20
 
21
- .. autoclass:: peakrdl_python.lib.base.AddressMap
21
+ .. autoclass:: peakrdl_python.lib.sections.AddressMap
22
22
  :members:
23
23
  :inherited-members:
24
24
 
25
- .. autoclass:: peakrdl_python.lib.base.AddressMapArray
25
+ .. autoclass:: peakrdl_python.lib.sections.AddressMapArray
26
26
  :members:
27
27
  :inherited-members:
28
28
 
29
29
  Register Files
30
30
  ==============
31
31
 
32
- .. autoclass:: peakrdl_python.lib.base.RegFile
32
+ .. autoclass:: peakrdl_python.lib.sections.RegFile
33
33
  :members:
34
34
  :inherited-members:
35
35
 
36
- .. autoclass:: peakrdl_python.lib.base.RegFileArray
36
+ .. autoclass:: peakrdl_python.lib.sections.RegFileArray
37
37
  :members:
38
38
  :inherited-members:
39
39
 
@@ -24,6 +24,22 @@ In the folder structure above:
24
24
  - ``lib`` - This is a package of base classes used by the register access layer (The copy of this can be skipped, see :ref:`skipping-lib-copy`)
25
25
  - ``sim_lib`` - This is a package of base classes used by the register access layer simulator (The copy of this can be skipped, see :ref:`skipping-lib-copy`)
26
26
 
27
+ .. versionchanged:: 2.0.0
28
+
29
+ The ``reg_model`` was changed in version 2.0.0 to split it out into multiple modules rather
30
+ than building the whole register model in a single python module. This helps avoid
31
+ excessively large files which helps speed up the generation and loading time.
32
+
33
+ Top Level Classes
34
+ -----------------
35
+
36
+ .. versionchanged:: 2.0.0
37
+
38
+ A new class aliases were added to the ``reg_model`` and ``sim`` packages to allow the register
39
+ model and simulator to be imported more easily. See the example below using ``RegModel`` and
40
+ ``Simulator``.
41
+
42
+
27
43
  Running the Unit Tests
28
44
  ======================
29
45
 
@@ -402,6 +418,11 @@ Exposing User Defined Properties
402
418
  SystemRDL allows properties to be added to any component (Field, Memory, Register, Register File,
403
419
  Address Map), so called *User Defined Properties (UDP)*.
404
420
 
421
+ There are two methods to expose user defined properties:
422
+
423
+ - A list of strings to include in the package
424
+ - A Regular Expression which will include any UDP which matches the regular expression
425
+
405
426
  Consider the following systemRDL example with a user defined property: ``component_usage``
406
427
 
407
428
  .. literalinclude :: ../example/user_defined_properties/user_defined_properties.rdl
@@ -413,12 +434,28 @@ User Defined Properties are not automatically included they must be specified, a
413
434
 
414
435
  peakrdl python user_defined_properties.rdl -o . --udp component_usage
415
436
 
437
+ Alternatively the User Defined Properties can be included with a regular expression.
438
+ In the following case all UDPs are included, except the ones used by PeakRDL python
439
+
440
+ .. code-block:: bash
441
+
442
+ peakrdl python user_defined_properties.rdl -o . --udp_regex "^(?!python_hide$)(?!python_name$).+"
443
+
444
+ .. warning::
445
+
446
+ Attempting to use both the list and regular expression approach is not supported and will
447
+ generate an error
448
+
416
449
  The user defined properties are stored in a ``udp`` property of all component in the generated
417
450
  register access and can be accessed as follows:
418
451
 
419
452
  .. literalinclude :: ../example/user_defined_properties/demo_user_defined_properties.py
420
453
  :language: python
421
454
 
455
+ .. versionadded:: 2.0.0
456
+
457
+ Regular Expression matching for User Defined Properties was added in version 2.0.0
458
+
422
459
  Python Safe Names
423
460
  =================
424
461
 
@@ -1,17 +1,17 @@
1
- import json
2
- from typing import Union
3
-
4
- from array_access.reg_model.array_access import array_access_cls
5
- from array_access.sim.array_access import array_access_simulator_cls
1
+ """
2
+ A demonstration of array access for peakrdl-python
3
+ """
4
+ from array_access.reg_model import RegModel
5
+ from array_access.sim import Simulator
6
6
  from array_access.lib.callbacks import NormalCallbackSet
7
7
 
8
8
  if __name__ == '__main__':
9
9
 
10
10
  # setup the simple simulator
11
- sim = array_access_simulator_cls(0)
11
+ sim = Simulator(0)
12
12
 
13
13
  # create an instance of the class
14
- regmodel = array_access_cls(callbacks=NormalCallbackSet(read_callback=sim.read))
14
+ regmodel = RegModel(callbacks=NormalCallbackSet(read_callback=sim.read))
15
15
 
16
16
  # access a entry in the 1D array
17
17
  print(regmodel.reg_array_1D[0].field_a.read())
@@ -1,17 +1,17 @@
1
1
  """
2
- A demonstration of using enumeration
2
+ A demonstration of using enumeration for peakrdl-python
3
3
  """
4
4
  from enumerated_fields.lib import NormalCallbackSet
5
5
 
6
- from enumerated_fields.reg_model.enumerated_fields import enumerated_fields_cls as GPIO
7
- from enumerated_fields.sim.enumerated_fields import enumerated_fields_simulator_cls as HardwareSimulator
6
+ from enumerated_fields.reg_model import RegModel
7
+ from enumerated_fields.sim import Simulator
8
8
 
9
9
  if __name__ == '__main__':
10
10
 
11
11
  # create an instance of the hardware simulator
12
- hw = HardwareSimulator(0)
12
+ hw = Simulator(0)
13
13
  # create an instance of the RAL with the callbacks directed at the hardware simulator
14
- gpio = GPIO(callbacks=NormalCallbackSet(read_callback=hw.read, write_callback=hw.write))
14
+ gpio = RegModel(callbacks=NormalCallbackSet(read_callback=hw.read, write_callback=hw.write))
15
15
 
16
16
  # get the field values
17
17
  for field in gpio.gpio_strength.readable_fields:
@@ -1,9 +1,8 @@
1
1
  """
2
2
  PeakRDL Python example to show the different methods to access the fields of a register
3
3
  """
4
- from optimised_access.reg_model.optimised_access import optimised_access_cls, \
5
- optimised_access_gpio_direction_enc_enumcls
6
- from optimised_access.sim.optimised_access import optimised_access_simulator_cls
4
+ from optimised_access.reg_model import RegModel
5
+ from optimised_access.sim import Simulator
7
6
 
8
7
  from optimised_access.lib import NormalCallbackSet
9
8
 
@@ -12,22 +11,26 @@ if __name__ == '__main__':
12
11
 
13
12
  # create an instance of the address map with the simulated callback necessary to demonstrate
14
13
  # the example
15
- sim = optimised_access_simulator_cls(0)
16
- dut = optimised_access_cls(callbacks=NormalCallbackSet(read_callback=sim.read,
14
+ sim = Simulator(0)
15
+ dut = RegModel(callbacks=NormalCallbackSet(read_callback=sim.read,
17
16
  write_callback=sim.write))
18
17
 
19
18
  # configure the GPIO 0 and GPIO 1 without affecting the state of the GPIO 2 and GPIO 3
20
19
  # configuration.
21
20
 
21
+ # the direction field enumeration is needed to, it is found field attribute, note that the
22
+ # same enumeration definition can be used for all channels in this case
23
+ direction_enum = dut.gpio_register.gpio_0_dir.enum_cls
24
+
22
25
  # This can be done either using the ``write_fields`` method
23
- dut.gpio_register.write_fields(gpio_0_dir=optimised_access_gpio_direction_enc_enumcls.GPIO_OUT,
26
+ dut.gpio_register.write_fields(gpio_0_dir=direction_enum.GPIO_OUT,
24
27
  gpio_0_pullup=False,
25
28
  gpio_0_strength=2,
26
- gpio_1_dir=optimised_access_gpio_direction_enc_enumcls.GPIO_IN)
29
+ gpio_1_dir=direction_enum.GPIO_IN)
27
30
 
28
31
  # It can also be done with the context manager
29
32
  with dut.gpio_register.single_read_modify_write() as reg:
30
- reg.gpio_0_dir.write(optimised_access_gpio_direction_enc_enumcls.GPIO_OUT)
33
+ reg.gpio_0_dir.write(direction_enum.GPIO_OUT)
31
34
  reg.gpio_0_pullup.write(False)
32
35
  reg.gpio_0_strength.write(2)
33
- reg.gpio_0_dir.write(optimised_access_gpio_direction_enc_enumcls.GPIO_IN)
36
+ reg.gpio_0_dir.write(direction_enum.GPIO_IN)
@@ -1,8 +1,8 @@
1
1
  """
2
2
  PeakRDL Python example to show the different methods to access the a register array
3
3
  """
4
- from optimised_array_access.reg_model.optimised_array_access import optimised_array_access_cls
5
- from optimised_array_access.sim.optimised_array_access import optimised_array_access_simulator_cls
4
+ from optimised_array_access.reg_model import RegModel
5
+ from optimised_array_access.sim import Simulator
6
6
 
7
7
  from optimised_array_access.lib import NormalCallbackSet
8
8
 
@@ -12,8 +12,8 @@ if __name__ == '__main__':
12
12
 
13
13
  # create an instance of the address map with the simulated callback necessary to demonstrate
14
14
  # the example
15
- sim = optimised_array_access_simulator_cls(0)
16
- dut = optimised_array_access_cls(callbacks=NormalCallbackSet(read_block_callback=sim.read_block,
15
+ sim = Simulator(0)
16
+ dut = RegModel(callbacks=NormalCallbackSet(read_block_callback=sim.read_block,
17
17
  write_block_callback=sim.write_block,
18
18
  read_callback=sim.read,
19
19
  write_callback=sim.write))
@@ -0,0 +1,22 @@
1
+ """
2
+ A demonstration of using overridden names for peakrdl-python
3
+
4
+ In this example there is a register which has one field. These have systemRDL names: reg_a and
5
+ field_a respectively. However the python_inst_name has been used on change the names in the
6
+ peakrdl-python register model to overridden_reg_a and overridden_field_a respectively
7
+
8
+ """
9
+ from over_ridden_names.reg_model import RegModel
10
+ from over_ridden_names.lib import NormalCallbackSet
11
+ from over_ridden_names.sim_lib.dummy_callbacks import dummy_read
12
+
13
+ if __name__ == '__main__':
14
+
15
+ # create an instance of the class
16
+ over_ridden_names = RegModel(callbacks=NormalCallbackSet(read_callback=dummy_read))
17
+
18
+ # access the field value directly
19
+ print(over_ridden_names.overridden_reg_a.overridden_field_a.read())
20
+
21
+ # access the field value using the original systemRDL names
22
+ print(over_ridden_names.get_child_by_system_rdl_name('reg_a').get_child_by_system_rdl_name('field_a').read())
@@ -1,11 +1,14 @@
1
+ """
2
+ A demonstration of extended simulator behaviour in peakrdl-python
3
+ """
1
4
  import tkinter
2
5
  import tkinter as tk
3
6
 
4
- from mychip.reg_model.mychip import mychip_cls
5
- from mychip.sim.mychip import mychip_simulator_cls
7
+ from mychip.reg_model import RegModel
8
+ from mychip.sim import Simulator
6
9
  from mychip.lib import NormalCallbackSet
7
10
 
8
- class ChipSim(mychip_simulator_cls):
11
+ class ChipSim(Simulator):
9
12
 
10
13
  def __init__(self):
11
14
 
@@ -51,7 +54,7 @@ class ChipSim(mychip_simulator_cls):
51
54
  self.LED.itemconfig(self.LED_inner, fill='black')
52
55
 
53
56
 
54
- def timer_event(chip: mychip_cls, sim_kt_root: tkinter.Tk) -> None:
57
+ def timer_event(chip: RegModel, sim_kt_root: tkinter.Tk) -> None:
55
58
  """
56
59
  timer event which will invert the state of the LED and then set the timer event to run
57
60
  in 2s
@@ -88,7 +91,7 @@ if __name__ == '__main__':
88
91
  write_callback=chip_simulator.write)
89
92
 
90
93
  # created an instance of the register model and connect the callbacks to the simulator
91
- mychip = mychip_cls(callbacks=callbacks)
94
+ mychip = RegModel(callbacks=callbacks)
92
95
 
93
96
  # configure the GPIO.PIN_0 as an output
94
97
  mychip.GPIO.GPIO_dir.PIN_0.write(mychip.GPIO.GPIO_dir.PIN_0.enum_cls.DIR_OUT)
@@ -1,8 +1,11 @@
1
+ """
2
+ A demonstration of traversing the register model generated with peakrdl-python
3
+ """
1
4
  import json
2
5
  from typing import Union
3
6
 
4
- from chip_with_registers.reg_model.chip_with_registers import chip_with_registers_cls
5
- from chip_with_registers.sim.chip_with_registers import chip_with_registers_simulator_cls
7
+ from chip_with_registers.reg_model import RegModel
8
+ from chip_with_registers.sim import Simulator
6
9
 
7
10
  from chip_with_registers.lib import NormalCallbackSet, RegReadOnly, RegReadWrite, \
8
11
  MemoryReadOnly, MemoryReadWrite, RegFile, AddressMap, RegReadOnlyArray, RegReadWriteArray, \
@@ -136,8 +139,8 @@ if __name__ == '__main__':
136
139
 
137
140
  # create an instance of the address map with the simulated callback necessary to demonstrate
138
141
  # the example
139
- sim = chip_with_registers_simulator_cls(0)
140
- dut = chip_with_registers_cls(callbacks=NormalCallbackSet(read_callback=sim.read,
142
+ sim = Simulator(0)
143
+ dut = RegModel(callbacks=NormalCallbackSet(read_callback=sim.read,
141
144
  write_callback=sim.write))
142
145
 
143
146
  # generate an instance of the RegisterDumper and write the registers to a file