Main Content

Modularize Large Projects in Polyspace Desktop User Interface

When you add source files to a project in the Polyspace® desktop user interface, by default, all files are analyzed in a single run. Analyzing the entire code base for a single application might take a long time, depending on the size of the application.

For a large application, Polyspace allows you to:

  • Partition the application into modules that individually require less time to verify.

  • Specify the number of modules in a tradeoff between verification speed and precision.

You can carry out faster analysis with a larger number of small modules. During partitioning, the software automatically minimizes cross-module references. However, with more modules, greater cross-module referencing is required during verification, which results in a loss of precision.

To partition your application into modules:

  1. Run an initial verification, which performs a limited analysis but processes all the files of your application. For example, run a verification with the following Precision pane settings:

    • Precision level0

    • Verification levelSoftware Safety Analysis level 0

  2. In the Project Browser view, select the results folder.

  3. Select Tools > Run Modularize. The software analyzes your application code and displays two plots in a new Modularization choices window.

    Plot that allows you to pick a number of modules.

    The plots show the following information:

    • Red — Maximum complexity of a module versus number of modules, which is expressed as a percentage of the total complexity of the application.

    • Blue — Number of public variables and functions when modules are limited by a given complexity.

  4. From the plots, identify the number of modules into which your application must be partitioned. In this example, a suitable number is 2 or 4.

    The number of partitioned modules that you choose involves a trade-off between the following:

    • Time — The smaller the maximum complexity, the shorter the time required for verification. This time saving is even greater if the different modules are verified in parallel.

    • Precision — The smaller the number of public variables and functions, the greater the precision of the verification.

    Select a number just after a big drop in maximum complexity and before a big increase in the number of public functions and variables. The precision of a modular verification can be very sensitive to the number of public variables. If the series of horizontal blue lines ascends so gradually that there is no clear number choice, then:

    1. On the toolbar, select Public Entities > Separate functions and variables. The software displays the number of public variables and functions separately.

      Plot showing number of public variables and functions separately.

    2. Select a point just before a big jump in the number of public variables. In this example, you must click the gray region associated with 2.

  5. Click the vertical gray region associated with the number of modules that you choose, for example, 2. A dialog box opens.

    Popup dialog asking whether to overwrite the existing modular configuration.

  6. Click Yes. The software generates a new project with two modules containing the partitioned code.