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