oscura 0.5.0__py3-none-any.whl → 0.5.1__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 (34) hide show
  1. oscura/__init__.py +1 -1
  2. oscura/analyzers/digital/__init__.py +0 -48
  3. oscura/analyzers/digital/extraction.py +0 -195
  4. oscura/analyzers/protocols/__init__.py +1 -22
  5. oscura/automotive/__init__.py +1 -1
  6. oscura/automotive/dtc/data.json +2763 -0
  7. oscura/export/__init__.py +0 -12
  8. oscura/export/wireshark/README.md +15 -15
  9. oscura/exporters/json_export.py +0 -47
  10. oscura/inference/active_learning/README.md +7 -7
  11. oscura/pipeline/composition.py +10 -2
  12. oscura/reporting/__init__.py +0 -7
  13. oscura/reporting/templates/index.md +13 -13
  14. oscura/schemas/bus_configuration.json +322 -0
  15. oscura/schemas/device_mapping.json +182 -0
  16. oscura/schemas/packet_format.json +418 -0
  17. oscura/schemas/protocol_definition.json +363 -0
  18. oscura/utils/autodetect.py +1 -5
  19. oscura-0.5.1.dist-info/METADATA +583 -0
  20. {oscura-0.5.0.dist-info → oscura-0.5.1.dist-info}/RECORD +23 -28
  21. oscura/analyzers/digital/ic_database.py +0 -498
  22. oscura/analyzers/digital/timing_paths.py +0 -339
  23. oscura/analyzers/digital/vintage.py +0 -377
  24. oscura/analyzers/digital/vintage_result.py +0 -148
  25. oscura/analyzers/protocols/parallel_bus.py +0 -449
  26. oscura/export/wavedrom.py +0 -430
  27. oscura/exporters/vintage_logic_csv.py +0 -247
  28. oscura/reporting/vintage_logic_report.py +0 -523
  29. oscura/visualization/digital_advanced.py +0 -718
  30. oscura/visualization/figure_manager.py +0 -156
  31. oscura-0.5.0.dist-info/METADATA +0 -407
  32. {oscura-0.5.0.dist-info → oscura-0.5.1.dist-info}/WHEEL +0 -0
  33. {oscura-0.5.0.dist-info → oscura-0.5.1.dist-info}/entry_points.txt +0 -0
  34. {oscura-0.5.0.dist-info → oscura-0.5.1.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,363 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://oscura.io/schemas/protocol_definition.json",
4
+ "title": "Protocol Definition Schema",
5
+ "description": "Schema for validating protocol DSL definitions for automatic decoder/encoder generation (CFG-001).",
6
+ "type": "object",
7
+ "required": ["name", "settings", "framing", "fields"],
8
+ "additionalProperties": true,
9
+ "properties": {
10
+ "name": {
11
+ "type": "string",
12
+ "description": "Protocol identifier",
13
+ "pattern": "^[a-zA-Z][a-zA-Z0-9_]*$",
14
+ "minLength": 1
15
+ },
16
+ "version": {
17
+ "type": "string",
18
+ "description": "Protocol version",
19
+ "pattern": "^\\d+\\.\\d+$"
20
+ },
21
+ "description": {
22
+ "type": "string",
23
+ "description": "Human-readable description"
24
+ },
25
+ "settings": {
26
+ "type": "object",
27
+ "description": "Global protocol settings",
28
+ "properties": {
29
+ "endian": {
30
+ "type": "string",
31
+ "enum": ["big", "little", "native"],
32
+ "description": "Default byte order"
33
+ },
34
+ "alignment": {
35
+ "type": "integer",
36
+ "minimum": 1,
37
+ "description": "Byte alignment (1 = no padding)"
38
+ },
39
+ "strict": {
40
+ "type": "boolean",
41
+ "description": "Fail on unknown fields or extra data"
42
+ }
43
+ },
44
+ "additionalProperties": false
45
+ },
46
+ "framing": {
47
+ "type": "object",
48
+ "description": "Message framing and boundary detection",
49
+ "required": ["type"],
50
+ "properties": {
51
+ "type": {
52
+ "type": "string",
53
+ "enum": ["delimiter", "length_prefix", "fixed"],
54
+ "description": "Framing method"
55
+ },
56
+ "sync": {
57
+ "type": "object",
58
+ "description": "Synchronization pattern",
59
+ "properties": {
60
+ "pattern": {
61
+ "type": "array",
62
+ "description": "Sync byte pattern",
63
+ "items": { "type": "integer", "minimum": 0, "maximum": 255 }
64
+ },
65
+ "required": {
66
+ "type": "boolean",
67
+ "description": "Whether sync pattern is mandatory"
68
+ }
69
+ },
70
+ "additionalProperties": false
71
+ },
72
+ "length_field": {
73
+ "type": "object",
74
+ "description": "Length field specification (for length_prefix framing)",
75
+ "properties": {
76
+ "offset": {
77
+ "type": "integer",
78
+ "minimum": 0,
79
+ "description": "Offset from start of message"
80
+ },
81
+ "size": {
82
+ "type": "integer",
83
+ "minimum": 1,
84
+ "maximum": 8,
85
+ "description": "Length field size in bytes"
86
+ },
87
+ "endian": {
88
+ "type": "string",
89
+ "enum": ["big", "little", "native"],
90
+ "description": "Byte order for length field"
91
+ },
92
+ "includes_header": {
93
+ "type": "boolean",
94
+ "description": "Whether length includes header bytes"
95
+ }
96
+ },
97
+ "additionalProperties": false
98
+ },
99
+ "delimiter": {
100
+ "type": "object",
101
+ "description": "Delimiter specification (for delimiter framing)",
102
+ "properties": {
103
+ "pattern": {
104
+ "type": "array",
105
+ "description": "Delimiter byte pattern",
106
+ "items": { "type": "integer", "minimum": 0, "maximum": 255 }
107
+ },
108
+ "escape": {
109
+ "type": "integer",
110
+ "minimum": 0,
111
+ "maximum": 255,
112
+ "description": "Escape byte for escaped delimiters"
113
+ }
114
+ },
115
+ "additionalProperties": false
116
+ },
117
+ "fixed_size": {
118
+ "type": "integer",
119
+ "minimum": 1,
120
+ "description": "Fixed message size (for fixed framing)"
121
+ }
122
+ },
123
+ "additionalProperties": false
124
+ },
125
+ "fields": {
126
+ "type": "array",
127
+ "description": "Field definitions in order",
128
+ "minItems": 1,
129
+ "items": {
130
+ "allOf": [{ "$ref": "#/definitions/field" }, { "required": ["name"] }]
131
+ }
132
+ },
133
+ "computed_fields": {
134
+ "type": "array",
135
+ "description": "Computed/virtual fields derived from other fields",
136
+ "items": {
137
+ "type": "object",
138
+ "required": ["name", "expression"],
139
+ "properties": {
140
+ "name": {
141
+ "type": "string",
142
+ "pattern": "^[a-zA-Z][a-zA-Z0-9_]*$"
143
+ },
144
+ "expression": {
145
+ "type": "string",
146
+ "description": "Expression to compute value"
147
+ },
148
+ "description": {
149
+ "type": "string"
150
+ }
151
+ },
152
+ "additionalProperties": false
153
+ }
154
+ },
155
+ "decoding": {
156
+ "type": "object",
157
+ "description": "Decoding hints and configuration",
158
+ "properties": {
159
+ "min_header_size": {
160
+ "type": "integer",
161
+ "minimum": 1,
162
+ "description": "Minimum bytes to determine message length"
163
+ },
164
+ "max_message_size": {
165
+ "type": "integer",
166
+ "minimum": 1,
167
+ "description": "Maximum allowed message size"
168
+ },
169
+ "resync_on_error": {
170
+ "type": "boolean",
171
+ "description": "Attempt to resynchronize on errors"
172
+ },
173
+ "max_resync_distance": {
174
+ "type": "integer",
175
+ "minimum": 1,
176
+ "description": "Maximum bytes to search for resync"
177
+ }
178
+ },
179
+ "additionalProperties": false
180
+ },
181
+ "encoding": {
182
+ "type": "object",
183
+ "description": "Encoding rules for encoder generation",
184
+ "properties": {
185
+ "auto_fill": {
186
+ "type": "object",
187
+ "description": "Fields to auto-fill when encoding",
188
+ "additionalProperties": { "type": "boolean" }
189
+ },
190
+ "validate_required_fields": {
191
+ "type": "boolean",
192
+ "description": "Validate all required fields present"
193
+ },
194
+ "validate_field_ranges": {
195
+ "type": "boolean",
196
+ "description": "Validate field values in valid ranges"
197
+ }
198
+ },
199
+ "additionalProperties": false
200
+ }
201
+ },
202
+ "definitions": {
203
+ "field": {
204
+ "type": "object",
205
+ "required": ["type"],
206
+ "properties": {
207
+ "name": {
208
+ "type": "string",
209
+ "description": "Field name (optional for array elements)",
210
+ "pattern": "^[a-zA-Z][a-zA-Z0-9_]*$"
211
+ },
212
+ "type": {
213
+ "type": "string",
214
+ "enum": [
215
+ "uint8",
216
+ "uint16",
217
+ "uint32",
218
+ "uint64",
219
+ "int8",
220
+ "int16",
221
+ "int32",
222
+ "int64",
223
+ "float32",
224
+ "float64",
225
+ "bytes",
226
+ "string",
227
+ "array",
228
+ "struct",
229
+ "bitfield"
230
+ ],
231
+ "description": "Field data type"
232
+ },
233
+ "size": {
234
+ "description": "Field size (bytes for bytes type, can be expression)",
235
+ "oneOf": [{ "type": "integer", "minimum": 1 }, { "type": "string" }]
236
+ },
237
+ "endian": {
238
+ "type": "string",
239
+ "enum": ["big", "little", "native"],
240
+ "description": "Byte order override"
241
+ },
242
+ "value": {
243
+ "description": "Expected constant value for validation",
244
+ "oneOf": [
245
+ { "type": "integer" },
246
+ { "type": "number" },
247
+ { "type": "string" },
248
+ { "type": "array" }
249
+ ]
250
+ },
251
+ "condition": {
252
+ "type": "string",
253
+ "description": "Conditional expression - field only present if true"
254
+ },
255
+ "description": {
256
+ "type": "string",
257
+ "description": "Field description"
258
+ },
259
+ "enum": {
260
+ "type": "object",
261
+ "description": "Enumeration value to name mappings (keys can be integers or hex strings)",
262
+ "additionalProperties": {
263
+ "type": "object",
264
+ "required": ["name"],
265
+ "properties": {
266
+ "name": { "type": "string" },
267
+ "description": { "type": "string" }
268
+ },
269
+ "additionalProperties": false
270
+ }
271
+ },
272
+ "fields": {
273
+ "description": "Nested fields (for bitfield or struct types)",
274
+ "oneOf": [
275
+ {
276
+ "type": "object",
277
+ "description": "Bitfield extraction",
278
+ "patternProperties": {
279
+ "^[a-zA-Z][a-zA-Z0-9_]*$": {
280
+ "type": "object",
281
+ "properties": {
282
+ "bit": {
283
+ "type": "integer",
284
+ "minimum": 0,
285
+ "description": "Single bit position"
286
+ },
287
+ "bits": {
288
+ "type": "array",
289
+ "items": { "type": "integer", "minimum": 0 },
290
+ "minItems": 2,
291
+ "maxItems": 2,
292
+ "description": "Bit range [start, end]"
293
+ },
294
+ "description": { "type": "string" }
295
+ },
296
+ "oneOf": [{ "required": ["bit"] }, { "required": ["bits"] }]
297
+ }
298
+ }
299
+ },
300
+ {
301
+ "type": "array",
302
+ "description": "Struct fields",
303
+ "items": { "$ref": "#/definitions/field" }
304
+ }
305
+ ]
306
+ },
307
+ "count_field": {
308
+ "type": ["string", "null"],
309
+ "description": "Field name containing array count (for array type)"
310
+ },
311
+ "element": {
312
+ "description": "Array element definition (for array type)",
313
+ "$ref": "#/definitions/field"
314
+ },
315
+ "encoding": {
316
+ "type": "string",
317
+ "description": "Character encoding (for string type)",
318
+ "enum": ["utf-8", "ascii", "latin-1", "utf-16", "utf-32"]
319
+ },
320
+ "validation": {
321
+ "type": "object",
322
+ "description": "Field validation rules",
323
+ "properties": {
324
+ "min": {
325
+ "type": "number",
326
+ "description": "Minimum value"
327
+ },
328
+ "max": {
329
+ "type": "number",
330
+ "description": "Maximum value"
331
+ },
332
+ "expected": {
333
+ "description": "Expected value",
334
+ "oneOf": [
335
+ { "type": "integer" },
336
+ { "type": "number" },
337
+ { "type": "string" },
338
+ { "type": "array" }
339
+ ]
340
+ },
341
+ "on_mismatch": {
342
+ "type": "string",
343
+ "enum": ["error", "warn", "ignore"],
344
+ "description": "Action on validation failure"
345
+ },
346
+ "algorithm": {
347
+ "type": "string",
348
+ "enum": ["crc16_ccitt", "crc32", "md5", "sha1"],
349
+ "description": "Checksum algorithm"
350
+ },
351
+ "scope": {
352
+ "type": "string",
353
+ "enum": ["all_prior", "message", "payload"],
354
+ "description": "Scope for checksum calculation"
355
+ }
356
+ },
357
+ "additionalProperties": false
358
+ }
359
+ },
360
+ "additionalProperties": false
361
+ }
362
+ }
363
+ }
@@ -317,11 +317,7 @@ def detect_logic_family(
317
317
  # Score based on how well levels match
318
318
  low_match = 1.0 - min(1.0, abs(v_low - vol) / 0.5)
319
319
  high_match = 1.0 - min(1.0, abs(v_high - voh) / 0.5)
320
- # Handle VCC=0 for families like ECL
321
- if vcc != 0:
322
- vcc_match = 1.0 - min(1.0, abs(v_cc_est - vcc) / abs(vcc))
323
- else:
324
- vcc_match = 1.0 if abs(v_cc_est) < 0.5 else 0.0
320
+ vcc_match = 1.0 - min(1.0, abs(v_cc_est - vcc) / vcc)
325
321
 
326
322
  score = (low_match + high_match + vcc_match) / 3
327
323