# US 2024/0256747 A1 · Statement block encapsulation method and apparatus, electronic device, and storage medium

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2024/0256747 A1
- Document ID: US20240256747A1
- Status: Published application
- Kind: A1
- Application number: 18/565,473
- Filed: 2021-10-27
- Published: 2024-08-01
- Earliest claimed: 2021-06-01
- Assignees: Shanghai Guowei Silcore Technology Co., Ltd.
- Applicants: Shanghai Guowei Silcore Technology Co., Ltd.
- Inventors: Zhongwei Shao; Jifeng Zhang
- Web page: https://patentgrep.com/patent/US20240256747A1

## CPC

- G06F 30/327: Logic synthesis; Behaviour synthesis, e.g. mapping logic, HDL to netlist, high-level language to RTL or netlist
- G06F 8/427: {Parsing}
- G06F 9/44: Arrangements for executing specific programs
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Embodiments of the present description provide a statement block encapsulation method and apparatus, an electronic device, and a storage medium, being applied to the technical field of electronic design automation. The encapsulation method comprises: according to a segmentation boundary obtained by an RTL segmentation tool, determining a plurality of statement blocks to be encapsulated; traversing each statement block to be encapsulated, wherein a module where the current statement block to be encapsulated is located is used as the current processing module; and scanning the current processing module, determining whether the current processing module comprises a black box signal, and according to the black box signal, clustering a sub-module and the statement block to perform encapsulation processing. The black box signal is used as a bond to perform encapsulation processing, so that the RTL segmentation tool is suitable for performing encapsulation processing on the sub-modules and the statement blocks under different syntax rules, improving the processing efficiency, and achieving fast layout planning.

## Claims

### Claim 1

A statement block encapsulation method, characterized by comprising:
determining a plurality of statement blocks to be encapsulated according to a segmentation boundary obtained by an RTL segmentation tool;
traversing each statement block to be encapsulated, wherein a module where a current statement block to be encapsulated is located is used as a current processing module;
scanning the current processing module, determining whether the current processing module comprises a black box signal, and executing the steps of:
if the black box signal exists in an external port signal in the current processing module, abandoning processing on the current processing module, and using a parent module instantiating the current processing module as a new current processing module for processing;
if statement blocks and/or sub-modules in the current processing module comprises a black box signal, clustering and encapsulating the statement blocks and/or sub-modules comprising the same black box signal in the current processing module to be a first module, and instantiating and updating the first module into the current processing module so as to correspondingly replace the statement blocks and/or sub-modules comprising the same black box signal in the current processing module;
if the current processing module does not comprise a black box signal, separately executing the fallowing operations on each statement block to be encapsulated in the current processing module: scanning the statement block to be encapsulated, extracting port information, encapsulating, according to the extracted port information, the statement block to be encapsulated to be a second module, and instantiating and updating the second module into the current processing module so as to replace the statement block to be encapsulated;
wherein the black box signal comprises a signal of a signal type not supported by the RTL segmentation tool.

### Claim 2 (depends on 1)

The statement block encapsulation method according to claim 1, characterized in that before the determining, according to the segmentation boundary, statement blocks to be encapsulated, the statement block encapsulation method further comprises:
reading design code into a memory; and
generating a syntax instance tree corresponding to the design code in the memory.

### Claim 3 (depends on 2)

The statement block encapsulation method according to claim 2, characterized in that the traversing each statement block to be encapsulated comprises traversing each statement block to be encapsulated by the syntax instance tree.

### Claim 4 (depends on 1)

The statement block encapsulation method according to claim 1, characterized in that the scanning the current processing module and determining whether the current processing module comprises a black box signal comprises:
traversing an external port signal of the current processing module; and
if the external port signal does not comprise the black box signal, scanning whether each statement block and/or sub-module in the current processing module comprises the black box signal.

### Claim 5 (depends on 4)

The statement block encapsulation method according to claim 4, characterized in that the statement block encapsulation method further comprises:
establishing a black box signal queue; and
storing queue element information corresponding to the black box signal into the black box signal queue, wherein the queue element information is used for characterizing signal attributes of the black box signal in the statement blocks and/or sub-modules.

### Claim 6 (depends on 5)

The statement block encapsulation method according to claim 5, characterized in that the structure of the black box signal queue comprises a first-in-first-out queue structure.

### Claim 7 (depends on 5)

The statement block encapsulation method according to claim 5, characterized in that the clustering and encapsulating the statement blocks and/or sub-modules comprising the same black box signal in the current processing module to be a first module comprises:
traversing each piece of queue element information in the black box signal queue, and in the traversal, with regard to the current queue element information, executing the steps of:
searching each of the statement blocks and/or sub-modules in the current processing module;
collecting the statement blocks and/or sub-modules comprising the current queue element information as statement items; and
subjecting the collected statement items to a merging operation.

### Claim 8 (depends on 7)

The statement block encapsulation method according to claim 7, characterized in that the subjecting the collected statement items to a merging operation comprises:
performing the merging operation on the collected statement items according to pairwise statement items to form a third module; and
instantiating the third module into the current processing module to replace the pairwise statement items prior to the merging.

### Claim 9 (depends on 7)

The statement block encapsulation method according to claim 7, characterized in that the statement block encapsulation method further comprises:
judging whether the statement item of the merging operation is a segmentation boundary;
if so, generating first prompt information which is used for merging the segmentation boundary of the statement item characterizing the merging operation with other statement items.

### Claim 10 (depends on 7)

The statement block encapsulation method according to claim 7, characterized in that the statement block encapsulation method further comprises:
storing an operation record for each merging operation in a stack data structure, the operation record including an object, an action, and port information for the merging operation.

### Claim 11 (depends on 10)

The statement block encapsulation method according to claim 10, characterized in that the stack data structure comprises a first-in-last-out data structure.

### Claim 12 (depends on 11)

The statement block encapsulation method according to claim 11, characterized in that the statement block encapsulation method further comprises:
in the phase of hypergraph transition to RTL, popping operation records in the stack data structure in turn, and restoring the original design code logic by a reverse operation.

### Claim 13 (depends on 1)

The statement block encapsulation method according to claim 1, characterized in that after the encapsulating, according to the extracted port information, the statement block to be encapsulated to be a second module, the statement block encapsulation method further comprises:
marking the statement block to be encapsulated which has been encapsulated to be the second module.

### Claim 14 (depends on 1)

The statement block encapsulation method according to claim 1, characterized in that when the black box signal exists in an external port signal in the current processing module, the statement block encapsulation method further comprises:
generating second prompt information, wherein the second prompt information is used for characterizing moving the segmentation boundary to an upper module.

### Claim 15

A statement block encapsulation apparatus, characterized by comprising:
a determination module configured for determining a plurality of statement blocks to be encapsulated according to a segmentation boundary obtained by an RTL segmentation tool;
a traversal module configured for traversing each statement block to be encapsulated, wherein a module where a current statement block to be encapsulated is located is used as a current processing module;
a merging module configured for scanning the current processing module, determining whether the current processing module comprises a black box signal, and executing the steps of:
if the black box signal exists in an external port signal in the current processing module, abandoning processing on the current processing module, and using a parent module instantiating the current processing module as a new current processing module for processing;
if statement blocks and/or sub-modules in the current processing module comprises a black box signal, clustering and encapsulating the statement blocks and/or sub-modules comprising the same black box signal in the current processing module to be a first module, and instantiating and updating the first module into the current processing module so as to correspondingly replace the statement blocks and/or sub-modules comprising the same black box signal in the current processing module;
if the current processing module does not comprise a black box signal, separately executing the fallowing operations on each statement block to be encapsulated in the current processing module:
scanning the statement block to be encapsulated, extracting port information, encapsulating, according to the extracted port information, the statement block to be encapsulated to be a second module, and instantiating and updating the second module into the current processing module so as to replace the statement block to be encapsulated;
wherein the black box signal comprises a signal of a signal type not supported by the RTL segmentation tool.

### Claim 16

An electronic device for statement block encapsulation, characterized by comprising:
at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor for:
determining a plurality of statement blocks to be encapsulated according to a segmentation boundary obtained by an RTL segmentation tool;
traversing each statement block to be encapsulated, wherein a module where a current statement block to be encapsulated is located is used as a current processing module;
scanning the current processing module, determining whether the current processing module comprises a black box signal, and executing the steps of:
if the black box signal exists in an external port signal in the current processing module, abandoning processing on the current processing module, and using a parent module instantiating the current processing module as a new current processing module for processing;
if statement blocks and/or sub-modules in the current processing module comprises a black box signal, clustering and encapsulating the statement blocks and/or sub-modules comprising the same black box signal in the current processing module to be a first module, and instantiating and updating the first module into the current processing module so as to correspondingly replace the statement blocks and/or sub-modules comprising the same black box signal in the current processing module;
if the current processing module does not comprise a black box signal, separately executing the fallowing operations on each statement block to be encapsulated in the current processing module:
scanning the statement block to be encapsulated, extracting port information, encapsulating, according to the extracted port information, the statement block to be encapsulated to be a second module, and instantiating and updating the second module into the current processing module so as to replace the statement block to be encapsulated;
wherein the black box signal comprises a signal of a signal type not supported by the RTL segmentation tool.

### Claim 17

A computer storage medium for statement block encapsulation, characterized in that the computer storage medium stores computer-executable instructions configured for:
determining a plurality of statement blocks to be encapsulated according to a segmentation boundary obtained by an RTL segmentation tool;
traversing each statement block to be encapsulated, wherein a module where a current statement block to be encapsulated is located is used as a current processing module;
scanning the current processing module, determining whether the current processing module comprises a black box signal, and executing the steps of:
if the black box signal exists in an external port signal in the current processing module, abandoning processing on the current processing module, and using a parent module instantiating the current processing module as a new current processing module for processing;
if statement blocks and/or sub-modules in the current processing module comprises a black box signal, clustering and encapsulating the statement blocks and/or the black box signal comprising the same black box signal in the current processing module into a first module, and instantiating and updating the first module into the current processing module so as to correspondingly replace the statement blocks and/or the sub-modules comprising the same black box signal in the current processing module;
if the current processing module does not comprise a black box signal, separately executing the fallowing operations on each statement block to be encapsulated in the current processing module: scanning the statement block to be encapsulated, extracting port information, encapsulating, according to the extracted port information, the statement block to be encapsulated to be a second module, and instantiating and updating the second module into the current processing module so as to replace the statement block to be encapsulated;
wherein the black box signal comprises a signal of a signal type not supported by the RTL segmentation tool.
