# US 2012/0254830 A1 · Verification of computer-executable code generated from a model

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

- Number: US 2012/0254830 A1
- Document ID: US20120254830A1
- Status: Published application
- Kind: A1
- Application number: 13/250,577
- Filed: 2011-09-30
- Published: 2012-10-04
- Earliest claimed: 2009-09-14
- Assignees: The MathWorks, Inc.
- Inventors: Mirko CONRAD; Xiaocang LIN; Jun YAN; Peter SZPAK; Matthew Wnglehart; Appa Rao NIRAKH; Jaya SHANKAR
- Web page: https://patentgrep.com/patent/US20120254830A1

## CPC

- G06F 11/3604: Analysis of software for verifying properties of programs (testing of software G06F11/3668)
- G06F 8/35: model driven
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

In an embodiment, a model is sliced into a plurality of slices. A slice in the plurality of slices is selected. A portion of code, that corresponds to the selected slice, is identified from code generated from the model. The identified code is verified to be equivalent to the selected slice. Equivalence may include equivalent functionality, equivalent data types, equivalent performance, and/or other forms of equivalence between the selected slice and the identified generated code.

## Claims

### Claim 1

One or more tangible non-transitory computer-readable storage media for storing computer-executable instructions executable by processing logic, the media storing one or more instructions for:
acquiring an annotation of a block, the block being part of a block diagram model, the annotation including information for use in identifying expected code for the block, the expected code representing functionality that is expected to be implemented in code generated for the block;
identifying the expected code for the block based on the annotation;
acquiring code that is generated for the block; and
verifying that the acquired code generated for the block is equivalent to the identified expected code.

### Claim 2 (depends on 1)

The media of claim 1, wherein the block is an S-function block and wherein the annotation is associated with code specified for the S-function block.

### Claim 3 (depends on 1)

The media of claim 1, wherein the block is an unrecognized block and wherein the annotation includes a description of a function associated with the block.

### Claim 4 (depends on 1)

The media of claim 1, further storing one or more instructions for:
learning a pattern of the expected code for the block based on the annotation.

### Claim 5 (depends on 4)

The media of claim 4, further storing one or more instructions for:
integrating the learned pattern into a verification procedure that is used to verify the acquired code is equivalent to the expected code.

### Claim 6 (depends on 4)

The media of claim 4, wherein the block is a first block that is part of the block diagram model and wherein identifying further comprises:
acquiring an indication that the learned pattern is acceptable for use in verifying a second block that is part of the block diagram model, the second block being of a block type that is equivalent to a block type of the first block.

### Claim 7 (depends on 1)

The media of claim 1, wherein the block is a first block in the block diagram model and wherein a pattern of the expected code for the first block is learned based on the annotation and wherein the media further stores one or more instructions for:
acquiring code for a second block, the second block being part of the block diagram model, the second block being of a block type that is equivalent to a block type of the first block; and
verifying the acquired code for the second block based on the learned pattern.

### Claim 8 (depends on 1)

The media of claim 1, wherein the code generated for the block is acquired from at least one of:
a code generator,
storage, or
a communications network.

### Claim 9 (depends on 1)

The media of claim 1, wherein verifying further comprises:
generating an intermediate representation (IR) for the expected code;
generating an IR for the generated code; and
comparing the IR for the expected code with the IR for the generated code to determine whether the expected code is equivalent to the generated code.

### Claim 10

A method comprising:
acquiring an annotation of a block, the block being part of a block diagram model, the annotation including information for use in identifying expected code for the block, the expected code representing functionality that is expected to be implemented in code generated for the block;
identifying the expected code for the block based on the annotation;
acquiring code that is generated for the block; and
verifying that the acquired code generated for the block is equivalent to the identified expected code.

### Claim 11 (depends on 10)

The method of claim 10, further comprising:
learning a pattern of the expected code for the block based on the identified expected code.

### Claim 12 (depends on 11)

The method of claim 11, further comprising:
incorporating the learned pattern into a verification procedure that is used to verify the acquired code is equivalent to the expected code.

### Claim 13 (depends on 11)

The method of claim 11, further comprising:
receiving an indication that the learned pattern is acceptable for verifying code that is generated for the block; and
in response to receiving the indication, incorporating the learned pattern into a verification procedure that is used to verify the acquired code is equivalent to the expected code.

### Claim 14 (depends on 10)

The method of claim 10, wherein the block is a first block that is part of the block diagram model and wherein a pattern of the expected code for the first block is learned based on the annotation and wherein the method further comprises:
acquiring code for a second block, the second block being part of the block diagram model, the second block being of a block type that is equivalent to a block type of the first block; and
verifying the acquired code for the second block based on the learned pattern.

### Claim 15 (depends on 10)

The method of claim 10, wherein verifying further comprises:
generating an intermediate representation (IR) for the expected code;
generating an IR for the generated code; and
comparing the IR for the expected code with the IR for the generated code to determine whether the expected code is equivalent to the generated code.

### Claim 16 (depends on 10)

The method of claim 10, wherein the block is an S-function block and wherein the annotation is associated with code specified for the S-function block.

### Claim 17 (depends on 10)

The method of claim 10, wherein the block is an unrecognized block and wherein the annotation includes a description of a function associated with the block.

### Claim 18 (depends on 10)

The method of claim 10, wherein identifying further comprises:
identifying a first version of the expected code based on the annotation;
receiving an indication that a second version of the expected code is to be used in place of the first version of the expected code; and
identifying the expected code based on the second version of the expected code.

### Claim 19

A system comprising:
a processor for:
acquiring an annotation of a block, the block being part of a block diagram model, the annotation including information for use in identifying expected code for the block, the expected code representing functionality that is expected to be included in code generated for the block,
identifying the expected code for the block based on the annotation,
acquiring an indication that the identified expected code is acceptable for verifying code that is generated for the block,
acquiring code that is generated for the block, and
verifying that the acquired code generated for the block is equivalent to the identified expected code.

### Claim 20 (depends on 19)

The system of claim 19, wherein the block is a first block that is part of the block diagram model and wherein a pattern of the expected code for the first block is learned based on the annotation and wherein the method further comprises:
acquiring code for a second block, the second block being part of the block diagram model, the second block being of a block type that is equivalent to a block type of the first block; and
determining whether the acquired code for the second block is equivalent to the identified expected code.
