File tree Expand file tree Collapse file tree 2 files changed +26
-4
lines changed Expand file tree Collapse file tree 2 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -12,14 +12,12 @@ def voltage_within(
1212 # drop nominal in within:
1313 within = VoltageRange(min=within.min, max=within.max)
1414 # ensure voltage is within within
15- min_valid = voltage.min >= within.min
16- max_valid = voltage.max <= within.max
1715 err_msg = "Voltage range " + str(voltage) + " of " + net_name + " is not within " + str(within)
18- check(min_valid and max_valid , err_msg)
16+ check(voltage in within , err_msg)
1917
2018 def check_gen(power: Power, severity: Severity = severity, name: str = name):
2119 check_name = power.NET.name + "_" + name
22- if not power. voltage:
20+ if not hasattr( power, " voltage") :
2321 return
2422 builtin.add_electrical_check(
2523 name=check_name,
Original file line number Diff line number Diff line change 1+ load("../checks.zen", "voltage_within")
2+ load("../interfaces.zen", "Power", "VoltageRange")
3+
4+ # Test 3.3V rail with tolerance
5+ v3v3 = Power("3V3", voltage=VoltageRange("3.3V 1%"))
6+ # Check if 3.3V +/- 1% is within 3.3V +/- 5%
7+ check_3v3 = voltage_within("3.3V 5%")
8+ check_3v3(v3v3)
9+
10+ # Test 5V rail with explicit range
11+ v5 = Power("5V", voltage=VoltageRange("5V"))
12+ # Check if 5V is within 4.5V to 5.5V (using +/- 10% notation)
13+ check_5v = voltage_within("5V 10%")
14+ check_5v(v5)
15+
16+ # Test with tighter tolerance on the rail than the check
17+ v1v8 = Power("1V8", voltage=VoltageRange("1.8V 1%"))
18+ check_1v8 = voltage_within("1.8V 5%")
19+ check_1v8(v1v8)
20+
21+ # Test rail with no voltage set (should be ignored)
22+ v_unknown = Power("UNKNOWN")
23+ check_unknown = voltage_within("5V 10%")
24+ check_unknown(v_unknown)
You can’t perform that action at this time.
0 commit comments