PhysicalOptimizeDesign.py

Summary

Lines:

40 of 40 covered (100.0%)

Coverage:

100.0%

Directory:

Xilinx

Source

pyEDAA/OutputFilter/Xilinx/PhysicalOptimizeDesign.pycoveredpartialuncoveredexcludednot executable
1# ==================================================================================================================== #
2#               _____ ____    _        _      ___        _               _   _____ _ _ _                               #
3#   _ __  _   _| ____|  _ \  / \      / \    / _ \ _   _| |_ _ __  _   _| |_|  ___(_) | |_ ___ _ __                    #
4#  | '_ \| | | |  _| | | | |/ _ \    / _ \  | | | | | | | __| '_ \| | | | __| |_  | | | __/ _ \ '__|                   #
5#  | |_) | |_| | |___| |_| / ___ \  / ___ \ | |_| | |_| | |_| |_) | |_| | |_|  _| | | | ||  __/ |                      #
6#  | .__/ \__, |_____|____/_/   \_\/_/   \_(_)___/ \__,_|\__| .__/ \__,_|\__|_|   |_|_|\__\___|_|                      #
7#  |_|    |___/                                             |_|                                                        #
8# ==================================================================================================================== #
9# Authors:                                                                                                             #
10#   Patrick Lehmann                                                                                                    #
11#                                                                                                                      #
12# License:                                                                                                             #
13# ==================================================================================================================== #
14# Copyright 2025-2026 Electronic Design Automation Abstraction (EDA²)                                                  #
15#                                                                                                                      #
16# Licensed under the Apache License, Version 2.0 (the "License");                                                      #
17# you may not use this file except in compliance with the License.                                                     #
18# You may obtain a copy of the License at                                                                              #
19#                                                                                                                      #
20#   http://www.apache.org/licenses/LICENSE-2.0                                                                         #
21#                                                                                                                      #
22# Unless required by applicable law or agreed to in writing, software                                                  #
23# distributed under the License is distributed on an "AS IS" BASIS,                                                    #
24# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.                                             #
25# See the License for the specific language governing permissions and                                                  #
26# limitations under the License.                                                                                       #
27#                                                                                                                      #
28# SPDX-License-Identifier: Apache-2.0                                                                                  #
29# ==================================================================================================================== #
30#
31"""A filtering anc classification processor for AMD/Xilinx Vivado Synthesis outputs."""
32from re     import compile, Pattern
33from typing import ClassVar, Type, Tuple
34
35from pyTooling.Decorators import export
36
37from pyEDAA.OutputFilter.Xilinx import Task, TaskWithPhases, Phase
38from pyEDAA.OutputFilter.Xilinx import MAJOR, MAJOR_MINOR, MAJOR_MINOR_MICRO, MAJOR_MINOR_MICRO_NANO
39
40
41@export
42class InitialUpdateTimingTask(Task):
43	_NAME:   ClassVar[str] = "Initial Update Timing Task"
44	_START:  ClassVar[str] = "Starting Initial Update Timing Task"
45	_FINISH: ClassVar[str] = None
46
47
48@export
49class Phase_PlacerInitialization(Phase):
50	"""
51	*Physical Synthesis Initialization* phase.
52
53	Used by task :class:`PhysicalSynthesisTask`.
54	"""
55	_START:  ClassVar[Pattern] = compile(f"^Phase {MAJOR} Physical Synthesis Initialization")
56	_FINISH: ClassVar[str]     = "Phase {phaseIndex} Physical Synthesis Initialization | Checksum:"
57	_TIME:   ClassVar[str]     = "Time (s):"
58	_FINAL:  ClassVar[str]     = None
59
60
61@export
62class Phase_DSPRegisterOptimization(Phase):
63	"""
64	*DSP Register Optimization* phase.
65
66	Used by task :class:`PhysicalSynthesisTask`.
67	"""
68	_START:  ClassVar[Pattern] = compile(f"^Phase {MAJOR} DSP Register Optimization")
69	_FINISH: ClassVar[str]     = "Phase {phaseIndex} DSP Register Optimization | Checksum:"
70	_TIME:   ClassVar[str]     = "Time (s):"
71	_FINAL:  ClassVar[str]     = None
72
73
74@export
75class Phase_CriticalPathOptimization_1(Phase):  # todo: check for duplicates
76	"""
77	*Critical Path Optimization* phase.
78
79	Used by task :class:`PhysicalSynthesisTask`.
80	"""
81	_START:  ClassVar[Pattern] = compile(f"^Phase {MAJOR} Critical Path Optimization")
82	_FINISH: ClassVar[str]     = "Phase {phaseIndex} Critical Path Optimization | Checksum:"
83	_TIME:   ClassVar[str]     = "Time (s):"
84	_FINAL:  ClassVar[str]     = None
85
86
87@export
88class Phase_CriticalPathOptimization_2(Phase):
89	"""
90	*Critical Path Optimization* phase.
91
92	Used by task :class:`PhysicalSynthesisTask`.
93	"""
94	_START:  ClassVar[Pattern] = compile(f"^Phase {MAJOR} Critical Path Optimization")
95	_FINISH: ClassVar[str]     = "Phase {phaseIndex} Critical Path Optimization | Checksum:"
96	_TIME:   ClassVar[str]     = "Time (s):"
97	_FINAL:  ClassVar[str]     = None
98
99
100@export
101class PhysicalSynthesisTask(TaskWithPhases):
102	"""
103	Parses *Physical Synthesis* task's outputs.
104
105	Used by Vivado command :class:`~pyEDAA.OutputFilter.Xilinx.Commands.PhysicalOptimizeDesign`.
106	"""
107	_NAME:   ClassVar[str] = "Physical Synthesis Task"
108	_START:  ClassVar[str] = "Starting Physical Synthesis Task"
109	_FINISH: ClassVar[str] = "Ending Physical Synthesis Task"
110
111	_PARSERS: ClassVar[Tuple[Type[Phase], ...]] = (
112		Phase_PlacerInitialization,
113		Phase_DSPRegisterOptimization,
114		Phase_CriticalPathOptimization_1,
115		Phase_CriticalPathOptimization_2
116	)