Restructuring Control Flow Graphs via Loop Nodes
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Control flow graphs (CFGs) often contain unstructured regions with GOTO statements, which are undesirable in many applications due to non-compliance with coding standards and limitations in current HDL and design verification implementations that do not support unstructured cycles.
Innovation Solution
The method involves identifying unstructured regions in a CFG and converting them into structured regions by introducing loop head and bottom nodes, re-routing loop back-edges, and using guard variables to ensure proper control flow, thereby eliminating GOTO statements.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If unstructured regions with GOTO statements are used in control flow graphs, then the implementation flexibility is improved, but compliance with coding standards and compatibility with HDL/design verification tools deteriorates
Solution Approach 1:
The patent introduces loop head nodes and loop bottom nodes as intermediary elements that mediate between unstructured GOTO statements and structured control flow requirements. These intermediary nodes serve as entry and exit points for loops, allowing GOTO statements to be transformed into structured loop constructs that comply with coding standards while preserving the original control flow semantics
Solution Approach 2:
The patent changes the structural parameters of the control flow graph by introducing new node types (loop head, loop bottom) and transforming edge relationships. This parameter change converts unstructured regions into structured regions, enabling compliance with coding standards that require structured control flow while maintaining functional equivalence
2Adaptability or versatility
If unstructured cycles are used in control flow graphs, then the modeling capability is improved, but support from HDL and design verification implementations deteriorates
Solution Approach 1:
The patent segments unstructured cycles into structured loop regions by identifying loop head nodes and loop bottom nodes. This segmentation divides the unstructured cycle into manageable structured components that can be processed by HDL and design verification tools, while preserving the cyclic behavior and modeling capability of the original unstructured region
3Device complexity
If GOTO statements are used in control flow graphs, then the code generation simplicity is improved, but adherence to structured programming standards deteriorates
Solution Approach 1:
The patent uses loop head nodes and loop bottom nodes as mediators to bridge GOTO statements and structured programming requirements. These intermediary nodes enable the transformation of simple GOTO-based control flow into structured loop constructs, maintaining code generation simplicity while achieving adherence to structured programming standards
Data Source
AI summary
A control flow graph may be generated from a model. The control flow graph may be restructured by converting at least one cyclical unstructured region of a control flow graph into a structured region. The restructuring may involve introducing loop head and/or bottom nodes, serving as incident nodes for loop entry or exit, correspondingly. Loop back-edges may be re-routed to loop entry nodes, while all exit nodes may be re-rerouted to loop exit nodes, as long as the control flow within the loop is properly directed using control flow constructs.


