|
| 1 | +const BASE_MAX_TARGETED_CANDIDATE_ATTEMPTS = 2 |
| 2 | +const BASE_MAX_ITERATIONS_PER_EFFORT = 48 |
| 3 | +const DEEP_ERROR_FORCE_SCALES = [1, 1.75, -1] as const |
| 4 | +const FAST_ERROR_FORCE_SCALES = [1, 1.75] as const |
| 5 | +const LARGE_DRC_COUNT_IMPROVEMENT_CHECK_INTERVAL = 8 |
| 6 | +const LOW_DRC_COUNT_IMPROVEMENT_CHECK_INTERVAL = 1 |
| 7 | +const MAX_ITERATIONS_PER_DRC_ERROR = 8 / 3 |
| 8 | +const MIN_MAX_ITERATIONS = 48 |
| 9 | +const SMALL_DRC_COUNT_IMPROVEMENT_CHECK_INTERVAL = 2 |
| 10 | + |
| 11 | +export const POSITION_EPSILON = 1e-6 |
| 12 | +export const COORDINATE_EPSILON = 1e-3 |
| 13 | +export const MAX_ERROR_MOVE = 0.14 |
| 14 | +export const BROAD_FORCE_PASSES = 12 |
| 15 | +export const BROAD_MAX_MOVE = 0.035 |
| 16 | +export const BROAD_FALLBACK_SMALL_ROUTE_LIMIT = 120 |
| 17 | +export const MIN_ITERATIONS_FOR_LARGE_BOARD_BROAD_FALLBACK = 192 |
| 18 | +export const CLEARANCE_SLACK = 0.015 |
| 19 | +export const VIA_PAIR_REPAIR_MAX_MOVE = 0.16 |
| 20 | +export const TRACE_PAD_REPAIR_MAX_MOVE = 0.3 |
| 21 | +export const PREFERRED_TRACE_TO_PAD_CLEARANCE = 0.16 |
| 22 | +export const LARGE_DRC_COUNT_THRESHOLD = 20 |
| 23 | +export const MAX_DRC_COUNT_PLATEAU_CHECKS = 2 |
| 24 | +export const MAX_LARGE_BOARD_BROAD_FALLBACK_MISSES = 2 |
| 25 | +export const BROAD_SPATIAL_CELL_SIZE_MIN = 1 |
| 26 | + |
| 27 | +export const getBaseMaxIterations = (effort: number) => |
| 28 | + Math.max( |
| 29 | + MIN_MAX_ITERATIONS, |
| 30 | + Math.round(BASE_MAX_ITERATIONS_PER_EFFORT * Math.max(1, effort)), |
| 31 | + ) |
| 32 | + |
| 33 | +export const getDrcScaledMaxIterations = ( |
| 34 | + drcIssueCount: number, |
| 35 | + effort: number, |
| 36 | +) => |
| 37 | + Math.max( |
| 38 | + getBaseMaxIterations(effort), |
| 39 | + Math.ceil( |
| 40 | + drcIssueCount * MAX_ITERATIONS_PER_DRC_ERROR * Math.max(1, effort), |
| 41 | + ), |
| 42 | + ) |
| 43 | + |
| 44 | +export const getRouteComplexityMinIterations = ( |
| 45 | + routeCount: number, |
| 46 | + drcIssueCount: number, |
| 47 | +) => |
| 48 | + routeCount > BROAD_FALLBACK_SMALL_ROUTE_LIMIT && drcIssueCount > 0 |
| 49 | + ? MIN_ITERATIONS_FOR_LARGE_BOARD_BROAD_FALLBACK |
| 50 | + : MIN_MAX_ITERATIONS |
| 51 | + |
| 52 | +export const getLargeBoardBroadFallbackCadence = ( |
| 53 | + centeredDrcIssueCount: number, |
| 54 | +) => Math.max(16, Math.min(64, centeredDrcIssueCount * 2)) |
| 55 | + |
| 56 | +export const getDrcCountImprovementCheckInterval = ( |
| 57 | + initialDrcIssueCount: number, |
| 58 | +) => |
| 59 | + initialDrcIssueCount >= LARGE_DRC_COUNT_THRESHOLD |
| 60 | + ? LARGE_DRC_COUNT_IMPROVEMENT_CHECK_INTERVAL |
| 61 | + : initialDrcIssueCount <= 2 |
| 62 | + ? LOW_DRC_COUNT_IMPROVEMENT_CHECK_INTERVAL |
| 63 | + : SMALL_DRC_COUNT_IMPROVEMENT_CHECK_INTERVAL |
| 64 | + |
| 65 | +export const getForceScalesForEffort = (effort: number) => |
| 66 | + effort >= 2 ? DEEP_ERROR_FORCE_SCALES : FAST_ERROR_FORCE_SCALES |
| 67 | + |
| 68 | +export const getMaxTargetedCandidateAttemptsForEffort = (effort: number) => |
| 69 | + Math.max( |
| 70 | + 1, |
| 71 | + Math.round(BASE_MAX_TARGETED_CANDIDATE_ATTEMPTS * Math.max(1, effort)), |
| 72 | + ) |
0 commit comments