Repository navigation
Expand file tree
/
Copy pathproject_rules.py
More file actions
executable file
·55 lines (49 loc) · 1.61 KB
/
Copy pathproject_rules.py
File metadata and controls
executable file
·55 lines (49 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from .models import ProjectThresholdRule
ASYM_REGION_RULES = {
"S5AV920_8CH": ProjectThresholdRule(
project_code="S5AV920_8CH",
total_density_thresholds={
14: int("0xB_0000_0000", 16),
18: int("0xB_0000_0000", 16),
20: int("0xC_0000_0000", 16),
28: int("0xE_0000_0000", 16),
},
),
"S5AV620_4CH": ProjectThresholdRule(
project_code="S5AV620_4CH",
total_density_thresholds={
10: int("0xA_0000_0000", 16),
14: int("0xB_0000_0000", 16),
18: int("0xB_0000_0000", 16),
20: int("0xC_0000_0000", 16),
28: int("0xE_0000_0000", 16),
},
),
"S5AV920_4CH": ProjectThresholdRule(
project_code="S5AV920_4CH",
total_density_thresholds={
10: int("0xA_0000_0000", 16),
14: int("0xB_0000_0000", 16),
18: int("0xB_0000_0000", 16),
20: int("0xC_0000_0000", 16),
28: int("0xE_0000_0000", 16),
},
),
"S5AV930": ProjectThresholdRule(
project_code="S5AV930",
total_density_thresholds={
20: int("0xC_0000_0000", 16),
28: int("0xE_0000_0000", 16),
40: int("0x88_0000_0000", 16),
56: int("0x8C_0000_0000", 16),
},
),
}
def resolve_asym_region(project_code, total_density, system_addr):
rule = ASYM_REGION_RULES.get(project_code)
if rule is None:
return 0
threshold = rule.total_density_thresholds.get(total_density)
if threshold is None:
return 0
return 1 if system_addr >= threshold else 0