powertrain-build 1.13.1__py3-none-any.whl → 1.13.3.dev3__py3-none-any.whl

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 (132) hide show
  1. powertrain_build/__init__.py +40 -40
  2. powertrain_build/__main__.py +6 -6
  3. powertrain_build/a2l.py +582 -582
  4. powertrain_build/a2l_merge.py +650 -650
  5. powertrain_build/a2l_templates.py +717 -717
  6. powertrain_build/build.py +985 -985
  7. powertrain_build/build_defs.py +309 -309
  8. powertrain_build/build_proj_config.py +690 -690
  9. powertrain_build/check_interface.py +575 -575
  10. powertrain_build/cli.py +141 -141
  11. powertrain_build/config.py +542 -542
  12. powertrain_build/core.py +395 -395
  13. powertrain_build/core_dummy.py +343 -343
  14. powertrain_build/create_conversion_table.py +73 -73
  15. powertrain_build/dids.py +916 -916
  16. powertrain_build/dummy.py +157 -157
  17. powertrain_build/dummy_spm.py +252 -252
  18. powertrain_build/environmentcheck.py +52 -52
  19. powertrain_build/ext_dbg.py +255 -255
  20. powertrain_build/ext_var.py +327 -327
  21. powertrain_build/feature_configs.py +301 -301
  22. powertrain_build/gen_allsysteminfo.py +227 -227
  23. powertrain_build/gen_label_split.py +449 -449
  24. powertrain_build/handcode_replacer.py +124 -124
  25. powertrain_build/html_report.py +133 -133
  26. powertrain_build/interface/__init__.py +4 -4
  27. powertrain_build/interface/application.py +511 -511
  28. powertrain_build/interface/base.py +500 -500
  29. powertrain_build/interface/csp_api.py +490 -490
  30. powertrain_build/interface/device_proxy.py +677 -677
  31. powertrain_build/interface/ems.py +67 -67
  32. powertrain_build/interface/export_global_vars.py +121 -121
  33. powertrain_build/interface/generate_adapters.py +132 -132
  34. powertrain_build/interface/generate_hi_interface.py +87 -87
  35. powertrain_build/interface/generate_service.py +69 -69
  36. powertrain_build/interface/generate_wrappers.py +147 -147
  37. powertrain_build/interface/generation_utils.py +142 -142
  38. powertrain_build/interface/hal.py +194 -194
  39. powertrain_build/interface/model_yaml_verification.py +348 -348
  40. powertrain_build/interface/service.py +296 -296
  41. powertrain_build/interface/simulink.py +249 -249
  42. powertrain_build/interface/update_call_sources.py +180 -180
  43. powertrain_build/interface/update_model_yaml.py +186 -186
  44. powertrain_build/interface/zone_controller.py +362 -362
  45. powertrain_build/lib/__init__.py +4 -4
  46. powertrain_build/lib/helper_functions.py +127 -127
  47. powertrain_build/lib/logger.py +55 -55
  48. powertrain_build/matlab_scripts/CodeGen/BuildAutomationPyBuild.m +78 -78
  49. powertrain_build/matlab_scripts/CodeGen/Generate_A2L.m +154 -154
  50. powertrain_build/matlab_scripts/CodeGen/generateTLUnit.m +239 -239
  51. powertrain_build/matlab_scripts/CodeGen/getAsilClassification.m +28 -28
  52. powertrain_build/matlab_scripts/CodeGen/modelConfiguredForTL.m +28 -28
  53. powertrain_build/matlab_scripts/CodeGen/moveDefOutports.m +88 -88
  54. powertrain_build/matlab_scripts/CodeGen/parseCalMeasData.m +410 -410
  55. powertrain_build/matlab_scripts/CodeGen/parseCoreIdentifiers.m +139 -139
  56. powertrain_build/matlab_scripts/CodeGen/parseDIDs.m +141 -141
  57. powertrain_build/matlab_scripts/CodeGen/parseInPorts.m +106 -106
  58. powertrain_build/matlab_scripts/CodeGen/parseIncludeConfigs.m +25 -25
  59. powertrain_build/matlab_scripts/CodeGen/parseModelInfo.m +38 -38
  60. powertrain_build/matlab_scripts/CodeGen/parseNVM.m +81 -81
  61. powertrain_build/matlab_scripts/CodeGen/parseOutPorts.m +120 -120
  62. powertrain_build/matlab_scripts/CodeGen/parsePreProcBlks.m +23 -23
  63. powertrain_build/matlab_scripts/CodeGen/struct2JSON.m +128 -128
  64. powertrain_build/matlab_scripts/CodeGen/updateCodeSwConfig.m +31 -31
  65. powertrain_build/matlab_scripts/Init_PyBuild.m +91 -91
  66. powertrain_build/matlab_scripts/__init__.py +2 -2
  67. powertrain_build/matlab_scripts/helperFunctions/Get_Full_Name.m +46 -46
  68. powertrain_build/matlab_scripts/helperFunctions/Get_SrcLines.m +12 -12
  69. powertrain_build/matlab_scripts/helperFunctions/Init_Models.m +78 -78
  70. powertrain_build/matlab_scripts/helperFunctions/Init_Projects.m +67 -67
  71. powertrain_build/matlab_scripts/helperFunctions/Read_Units.m +34 -34
  72. powertrain_build/matlab_scripts/helperFunctions/SetProjectTimeSamples.m +26 -26
  73. powertrain_build/matlab_scripts/helperFunctions/Strip_Suffix.m +16 -16
  74. powertrain_build/matlab_scripts/helperFunctions/followLink.m +118 -118
  75. powertrain_build/matlab_scripts/helperFunctions/getCodeSwitches.m +50 -50
  76. powertrain_build/matlab_scripts/helperFunctions/getConsumerBlocks.m +30 -30
  77. powertrain_build/matlab_scripts/helperFunctions/getDefBlock.m +39 -39
  78. powertrain_build/matlab_scripts/helperFunctions/getDefOutport.m +58 -58
  79. powertrain_build/matlab_scripts/helperFunctions/getDstBlocks.m +19 -19
  80. powertrain_build/matlab_scripts/helperFunctions/getDstLines.m +13 -13
  81. powertrain_build/matlab_scripts/helperFunctions/getInterfaceSignals.m +37 -37
  82. powertrain_build/matlab_scripts/helperFunctions/getName.m +37 -37
  83. powertrain_build/matlab_scripts/helperFunctions/getPath.m +6 -6
  84. powertrain_build/matlab_scripts/helperFunctions/getProperValue.m +21 -21
  85. powertrain_build/matlab_scripts/helperFunctions/getSrcBlocks.m +19 -19
  86. powertrain_build/matlab_scripts/helperFunctions/getSrcLines.m +13 -13
  87. powertrain_build/matlab_scripts/helperFunctions/loadLibraries.m +10 -10
  88. powertrain_build/matlab_scripts/helperFunctions/loadjson.m +6 -6
  89. powertrain_build/matlab_scripts/helperFunctions/modifyEnumStructField.m +21 -21
  90. powertrain_build/matlab_scripts/helperFunctions/removeConfigDuplicates.m +31 -31
  91. powertrain_build/matlab_scripts/helperFunctions/sortSystemByClass.m +26 -26
  92. powertrain_build/matlab_scripts/helperFunctions/tl_getfast.m +89 -89
  93. powertrain_build/matlab_scripts/helperFunctions/topLevelSystem.m +20 -20
  94. powertrain_build/matlab_scripts/helperFunctions/updateModels.m +131 -131
  95. powertrain_build/memory_section.py +224 -224
  96. powertrain_build/nvm_def.py +729 -729
  97. powertrain_build/problem_logger.py +86 -86
  98. powertrain_build/pt_matlab.py +430 -430
  99. powertrain_build/pt_win32.py +144 -144
  100. powertrain_build/replace_compu_tab_ref.py +105 -105
  101. powertrain_build/rte_dummy.py +254 -254
  102. powertrain_build/sched_funcs.py +209 -207
  103. powertrain_build/signal.py +7 -7
  104. powertrain_build/signal_if_html_rep.py +221 -221
  105. powertrain_build/signal_if_html_rep_all.py +302 -302
  106. powertrain_build/signal_incons_html_rep.py +180 -180
  107. powertrain_build/signal_incons_html_rep_all.py +366 -366
  108. powertrain_build/signal_incons_html_rep_base.py +168 -168
  109. powertrain_build/signal_inconsistency_check.py +641 -641
  110. powertrain_build/signal_interfaces.py +864 -864
  111. powertrain_build/templates/Index_SigCheck_All.html +22 -22
  112. powertrain_build/templates/Index_SigIf_All.html +19 -19
  113. powertrain_build/types.py +218 -218
  114. powertrain_build/unit_configs.py +419 -419
  115. powertrain_build/user_defined_types.py +660 -660
  116. powertrain_build/versioncheck.py +66 -66
  117. powertrain_build/wrapper.py +512 -512
  118. powertrain_build/xlrd_csv.py +87 -87
  119. powertrain_build/zone_controller/__init__.py +4 -4
  120. powertrain_build/zone_controller/calibration.py +176 -176
  121. powertrain_build/zone_controller/composition_yaml.py +880 -878
  122. {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/METADATA +100 -100
  123. powertrain_build-1.13.3.dev3.dist-info/RECORD +130 -0
  124. {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/WHEEL +1 -1
  125. {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/licenses/LICENSE +202 -202
  126. powertrain_build-1.13.3.dev3.dist-info/pbr.json +1 -0
  127. powertrain_build-1.13.1.dist-info/RECORD +0 -130
  128. powertrain_build-1.13.1.dist-info/pbr.json +0 -1
  129. {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/entry_points.txt +0 -0
  130. {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/licenses/AUTHORS +0 -0
  131. {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/licenses/NOTICE +0 -0
  132. {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/top_level.txt +0 -0
@@ -1,221 +1,221 @@
1
- # Copyright 2024 Volvo Car Corporation
2
- # Licensed under Apache 2.0.
3
-
4
- """Module containing classes for the signal interfaces report."""
5
- from collections import defaultdict
6
- from powertrain_build.html_report import HtmlReport
7
-
8
-
9
- class SigIfHtmlReport(HtmlReport):
10
- """Signal interface html report.
11
-
12
- Inherits class :doc:`HtmlReport <html_report>`.
13
- """
14
-
15
- __intro = """<h2 class="nocount">Table of contents</h2>
16
- <ol>
17
- <li><a href="#introduction">Introduction</a></li>
18
- <li><a href="#signal_details">Detailed signal information</a></li>
19
- <li><a href="#signal_index">Signal index</a></li>
20
- </ol>
21
- <h2 id="introduction">Introduction</h2>
22
- <p>This documents lists the signal interfaces.</p>
23
- """
24
-
25
- __table_unused = """
26
- <table id="unused">
27
- <thead>
28
- <tr>
29
- <th>Variable</th>
30
- <th>Configurations</th>
31
- </tr>
32
- </thead>
33
- <tbody>
34
- """
35
-
36
- __table_detailed_sig_desc = """
37
- <table id="sig_desc">
38
- <thead>
39
- <tr>
40
- <th>Unit</th>
41
- <th>Type</th>
42
- <th>Class</th>
43
- <th>Min</th>
44
- <th>Max</th>
45
- <th>Lsb</th>
46
- <th>Offset</th>
47
- <th>Configs</th>
48
- </tr>
49
- </thead>
50
- <tbody>
51
- """
52
-
53
- __table_detailed_sig_desc_ext = """
54
- <table id="sig_desc">
55
- <thead>
56
- <tr>
57
- <th>Unit</th>
58
- <th>Type</th>
59
- <th>Init Value</th>
60
- <th>Min</th>
61
- <th>Max</th>
62
- <th>Config Doc</th>
63
- </tr>
64
- </thead>
65
- <tbody>
66
- """
67
-
68
- __table_detailed_sig_def = """
69
- <table id="detailed_sig_def">
70
- <thead>
71
- <tr>
72
- <th>Defined in unit</th>
73
- <th>in projects</th>
74
- </tr>
75
- </thead>
76
- <tbody>
77
- """
78
-
79
- __table_detailed_sig_cons = """
80
- <table id="detailed_sig_cons">
81
- <thead>
82
- <tr>
83
- <th>Consumed by units</th>
84
- <th>in projects</th>
85
- </tr>
86
- </thead>
87
- <tbody>
88
- """
89
-
90
- def __init__(self, build_cfg, unit_cfg, sig_if):
91
- """Initialize class instance.
92
-
93
- Args:
94
- build_cfg (BuildProjConfig): holds all the build configs
95
- unit_cfg (UnitConfigs): object holding all unit interfaces
96
- sig_if (SignalInterfaces): object holding signal interface information
97
- """
98
- super().__init__('Signal interface report')
99
- self._build_cfg = build_cfg
100
- self._unit_cfg = unit_cfg
101
- self._sig_if = sig_if
102
- self._format_unit_data()
103
-
104
- def _gen_sigs_details(self):
105
- """Generate detailed signal information."""
106
- out = ' <h2 id="signal_details">Detailed Signal Information</h2>\n'
107
- for signal in sorted(self._if.keys()):
108
- out += self._gen_sig_details(signal)
109
- return out
110
-
111
- def _gen_sig_details(self, signal):
112
- """Generate detailed signal information."""
113
- out = f' <h3 id="{signal}">{signal}</h3>\n'
114
- unit = tuple(self._if[signal]['def'].keys())[0] # ugly! use the first defining unit.
115
- # Check that it is a unit, and not from the inteface definition
116
- if unit[:2] == 'Vc':
117
- sig_def = defaultdict(lambda: '-', self._unit_cfg.get_per_unit_cfg()[unit]['outports'][signal])
118
- out += f' <p>{sig_def["description"]}</p>'
119
- out += self.__table_detailed_sig_desc
120
- out += ' <tr>\n'
121
- out += f' <td>{sig_def["unit"]}</td>\n'
122
- out += f' <td>{sig_def["type"]}</td>\n'
123
- out += f' <td>{sig_def["class"]}</td>\n'
124
- out += f' <td>{sig_def["min"]}</td>\n'
125
- out += f' <td>{sig_def["max"]}</td>\n'
126
- out += f' <td>{sig_def["lsb"]}</td>\n'
127
- out += f' <td>{sig_def["offset"]}</td>\n'
128
- out += f' <td>{sig_def["configs"]}</td>\n'
129
- out += ' </tr>\n'
130
- out += ' </tbody>\n'
131
- out += ' </table>\n <p></p>\n'
132
- else:
133
- sig_def = defaultdict(lambda: '-', self._sig_if.get_raw_io_cnfg()[unit][signal])
134
- out += f' <p>{sig_def["description"]}</p>'
135
- out += self.__table_detailed_sig_desc_ext
136
- out += ' <tr>\n'
137
- out += f' <td>{sig_def["unit"]}</td>\n'
138
- out += f' <td>{sig_def["type"]}</td>\n'
139
- out += f' <td>{sig_def["init"]}</td>\n'
140
- out += f' <td>{sig_def["min"]}</td>\n'
141
- out += f' <td>{sig_def["max"]}</td>\n'
142
- out += f' <td>{unit}</td>\n'
143
- out += ' </tr>\n'
144
- out += ' </tbody>\n'
145
- out += ' </table>\n <p></p>\n'
146
-
147
- out += self.__table_detailed_sig_def
148
- for unit, prjs in self._if[signal]['def'].items():
149
- out += ' <tr>\n'
150
- out += f' <td>{unit}</td>\n'
151
- out += f' <td>{prjs}</td>\n'
152
- out += ' </tr>\n'
153
- out += ' </tbody>\n'
154
- out += ' </table>\n'
155
-
156
- if 'consumers' in self._if[signal]:
157
- out += ' <p></p>\n'
158
- out += self.__table_detailed_sig_cons
159
- for units, prjs in self._if[signal]['consumers'].items():
160
- out += ' <tr>\n'
161
- out += f' <td>{units}</td>\n'
162
- out += f' <td>{prjs}</td>\n'
163
- out += ' </tr>\n'
164
- out += ' </tbody>\n'
165
- out += ' </table>\n'
166
- return out
167
-
168
- def _format_unit_data(self):
169
- """Format data per unit."""
170
- self._if = {}
171
- prj_name = self._build_cfg.get_prj_config()
172
- # internal signals
173
- prj_cfg = self._unit_cfg.get_per_cfg_unit_cfg()
174
- ext_out_prj = self._sig_if.get_external_outputs()
175
- if 'outports' in prj_cfg:
176
- for sig, data in prj_cfg['outports'].items():
177
- prod_unit = list(data.keys())[0]
178
- self._if.setdefault(sig, {}).setdefault('def', {}).setdefault(prod_unit, []).append(prj_name)
179
- cons_units = []
180
- for sig_type, osig in ext_out_prj.items():
181
- if sig in osig:
182
- cons_units = [sig_type]
183
- break
184
- if sig in prj_cfg['inports']:
185
- cons_units.extend(list(prj_cfg['inports'][sig].keys()))
186
- if cons_units:
187
- (self._if[sig].setdefault('consumers', {})
188
- .setdefault(tuple(sorted(cons_units)), [])
189
- .append(prj_name))
190
-
191
- # external signals
192
- prj_cfg = self._unit_cfg.get_per_cfg_unit_cfg()
193
- ext_in_prj = self._sig_if.get_external_inputs()
194
- for sig_type, osig in ext_in_prj.items():
195
- for sig, data in osig.items():
196
- self._if.setdefault(sig, {}).setdefault('def', {}).setdefault(sig_type, []).append(prj_name)
197
- if 'inports' in prj_cfg and sig in prj_cfg['inports']:
198
- (self._if[sig].setdefault('consumers', {})
199
- .setdefault(tuple(sorted(prj_cfg['inports'][sig].keys())), [])
200
- .append(prj_name))
201
-
202
- def _gen_signal_toc(self):
203
- """Generate a signal TOC for the unit with signal inconsistencies.
204
-
205
- Hyperlinks to more in depth signal information.
206
- """
207
- out = ' <h2 id="signal_index">Signal index</h2>\n'
208
- for signal in sorted(self._if.keys()):
209
- out += f' <div><a href="#{signal}">{signal}</a></div>\n'
210
- return out
211
-
212
- def gen_contents(self):
213
- """Generate report contents from the signal interfaces data.
214
-
215
- Overrides HtmlReport.gen_contents()
216
- """
217
- html = []
218
- html += self.__intro
219
- html += self._gen_sigs_details()
220
- html += self._gen_signal_toc()
221
- return ''.join(html)
1
+ # Copyright 2024 Volvo Car Corporation
2
+ # Licensed under Apache 2.0.
3
+
4
+ """Module containing classes for the signal interfaces report."""
5
+ from collections import defaultdict
6
+ from powertrain_build.html_report import HtmlReport
7
+
8
+
9
+ class SigIfHtmlReport(HtmlReport):
10
+ """Signal interface html report.
11
+
12
+ Inherits class :doc:`HtmlReport <html_report>`.
13
+ """
14
+
15
+ __intro = """<h2 class="nocount">Table of contents</h2>
16
+ <ol>
17
+ <li><a href="#introduction">Introduction</a></li>
18
+ <li><a href="#signal_details">Detailed signal information</a></li>
19
+ <li><a href="#signal_index">Signal index</a></li>
20
+ </ol>
21
+ <h2 id="introduction">Introduction</h2>
22
+ <p>This documents lists the signal interfaces.</p>
23
+ """
24
+
25
+ __table_unused = """
26
+ <table id="unused">
27
+ <thead>
28
+ <tr>
29
+ <th>Variable</th>
30
+ <th>Configurations</th>
31
+ </tr>
32
+ </thead>
33
+ <tbody>
34
+ """
35
+
36
+ __table_detailed_sig_desc = """
37
+ <table id="sig_desc">
38
+ <thead>
39
+ <tr>
40
+ <th>Unit</th>
41
+ <th>Type</th>
42
+ <th>Class</th>
43
+ <th>Min</th>
44
+ <th>Max</th>
45
+ <th>Lsb</th>
46
+ <th>Offset</th>
47
+ <th>Configs</th>
48
+ </tr>
49
+ </thead>
50
+ <tbody>
51
+ """
52
+
53
+ __table_detailed_sig_desc_ext = """
54
+ <table id="sig_desc">
55
+ <thead>
56
+ <tr>
57
+ <th>Unit</th>
58
+ <th>Type</th>
59
+ <th>Init Value</th>
60
+ <th>Min</th>
61
+ <th>Max</th>
62
+ <th>Config Doc</th>
63
+ </tr>
64
+ </thead>
65
+ <tbody>
66
+ """
67
+
68
+ __table_detailed_sig_def = """
69
+ <table id="detailed_sig_def">
70
+ <thead>
71
+ <tr>
72
+ <th>Defined in unit</th>
73
+ <th>in projects</th>
74
+ </tr>
75
+ </thead>
76
+ <tbody>
77
+ """
78
+
79
+ __table_detailed_sig_cons = """
80
+ <table id="detailed_sig_cons">
81
+ <thead>
82
+ <tr>
83
+ <th>Consumed by units</th>
84
+ <th>in projects</th>
85
+ </tr>
86
+ </thead>
87
+ <tbody>
88
+ """
89
+
90
+ def __init__(self, build_cfg, unit_cfg, sig_if):
91
+ """Initialize class instance.
92
+
93
+ Args:
94
+ build_cfg (BuildProjConfig): holds all the build configs
95
+ unit_cfg (UnitConfigs): object holding all unit interfaces
96
+ sig_if (SignalInterfaces): object holding signal interface information
97
+ """
98
+ super().__init__('Signal interface report')
99
+ self._build_cfg = build_cfg
100
+ self._unit_cfg = unit_cfg
101
+ self._sig_if = sig_if
102
+ self._format_unit_data()
103
+
104
+ def _gen_sigs_details(self):
105
+ """Generate detailed signal information."""
106
+ out = ' <h2 id="signal_details">Detailed Signal Information</h2>\n'
107
+ for signal in sorted(self._if.keys()):
108
+ out += self._gen_sig_details(signal)
109
+ return out
110
+
111
+ def _gen_sig_details(self, signal):
112
+ """Generate detailed signal information."""
113
+ out = f' <h3 id="{signal}">{signal}</h3>\n'
114
+ unit = tuple(self._if[signal]['def'].keys())[0] # ugly! use the first defining unit.
115
+ # Check that it is a unit, and not from the inteface definition
116
+ if unit[:2] == 'Vc':
117
+ sig_def = defaultdict(lambda: '-', self._unit_cfg.get_per_unit_cfg()[unit]['outports'][signal])
118
+ out += f' <p>{sig_def["description"]}</p>'
119
+ out += self.__table_detailed_sig_desc
120
+ out += ' <tr>\n'
121
+ out += f' <td>{sig_def["unit"]}</td>\n'
122
+ out += f' <td>{sig_def["type"]}</td>\n'
123
+ out += f' <td>{sig_def["class"]}</td>\n'
124
+ out += f' <td>{sig_def["min"]}</td>\n'
125
+ out += f' <td>{sig_def["max"]}</td>\n'
126
+ out += f' <td>{sig_def["lsb"]}</td>\n'
127
+ out += f' <td>{sig_def["offset"]}</td>\n'
128
+ out += f' <td>{sig_def["configs"]}</td>\n'
129
+ out += ' </tr>\n'
130
+ out += ' </tbody>\n'
131
+ out += ' </table>\n <p></p>\n'
132
+ else:
133
+ sig_def = defaultdict(lambda: '-', self._sig_if.get_raw_io_cnfg()[unit][signal])
134
+ out += f' <p>{sig_def["description"]}</p>'
135
+ out += self.__table_detailed_sig_desc_ext
136
+ out += ' <tr>\n'
137
+ out += f' <td>{sig_def["unit"]}</td>\n'
138
+ out += f' <td>{sig_def["type"]}</td>\n'
139
+ out += f' <td>{sig_def["init"]}</td>\n'
140
+ out += f' <td>{sig_def["min"]}</td>\n'
141
+ out += f' <td>{sig_def["max"]}</td>\n'
142
+ out += f' <td>{unit}</td>\n'
143
+ out += ' </tr>\n'
144
+ out += ' </tbody>\n'
145
+ out += ' </table>\n <p></p>\n'
146
+
147
+ out += self.__table_detailed_sig_def
148
+ for unit, prjs in self._if[signal]['def'].items():
149
+ out += ' <tr>\n'
150
+ out += f' <td>{unit}</td>\n'
151
+ out += f' <td>{prjs}</td>\n'
152
+ out += ' </tr>\n'
153
+ out += ' </tbody>\n'
154
+ out += ' </table>\n'
155
+
156
+ if 'consumers' in self._if[signal]:
157
+ out += ' <p></p>\n'
158
+ out += self.__table_detailed_sig_cons
159
+ for units, prjs in self._if[signal]['consumers'].items():
160
+ out += ' <tr>\n'
161
+ out += f' <td>{units}</td>\n'
162
+ out += f' <td>{prjs}</td>\n'
163
+ out += ' </tr>\n'
164
+ out += ' </tbody>\n'
165
+ out += ' </table>\n'
166
+ return out
167
+
168
+ def _format_unit_data(self):
169
+ """Format data per unit."""
170
+ self._if = {}
171
+ prj_name = self._build_cfg.get_prj_config()
172
+ # internal signals
173
+ prj_cfg = self._unit_cfg.get_per_cfg_unit_cfg()
174
+ ext_out_prj = self._sig_if.get_external_outputs()
175
+ if 'outports' in prj_cfg:
176
+ for sig, data in prj_cfg['outports'].items():
177
+ prod_unit = list(data.keys())[0]
178
+ self._if.setdefault(sig, {}).setdefault('def', {}).setdefault(prod_unit, []).append(prj_name)
179
+ cons_units = []
180
+ for sig_type, osig in ext_out_prj.items():
181
+ if sig in osig:
182
+ cons_units = [sig_type]
183
+ break
184
+ if sig in prj_cfg['inports']:
185
+ cons_units.extend(list(prj_cfg['inports'][sig].keys()))
186
+ if cons_units:
187
+ (self._if[sig].setdefault('consumers', {})
188
+ .setdefault(tuple(sorted(cons_units)), [])
189
+ .append(prj_name))
190
+
191
+ # external signals
192
+ prj_cfg = self._unit_cfg.get_per_cfg_unit_cfg()
193
+ ext_in_prj = self._sig_if.get_external_inputs()
194
+ for sig_type, osig in ext_in_prj.items():
195
+ for sig, data in osig.items():
196
+ self._if.setdefault(sig, {}).setdefault('def', {}).setdefault(sig_type, []).append(prj_name)
197
+ if 'inports' in prj_cfg and sig in prj_cfg['inports']:
198
+ (self._if[sig].setdefault('consumers', {})
199
+ .setdefault(tuple(sorted(prj_cfg['inports'][sig].keys())), [])
200
+ .append(prj_name))
201
+
202
+ def _gen_signal_toc(self):
203
+ """Generate a signal TOC for the unit with signal inconsistencies.
204
+
205
+ Hyperlinks to more in depth signal information.
206
+ """
207
+ out = ' <h2 id="signal_index">Signal index</h2>\n'
208
+ for signal in sorted(self._if.keys()):
209
+ out += f' <div><a href="#{signal}">{signal}</a></div>\n'
210
+ return out
211
+
212
+ def gen_contents(self):
213
+ """Generate report contents from the signal interfaces data.
214
+
215
+ Overrides HtmlReport.gen_contents()
216
+ """
217
+ html = []
218
+ html += self.__intro
219
+ html += self._gen_sigs_details()
220
+ html += self._gen_signal_toc()
221
+ return ''.join(html)