Compile

Compiles the active file. The main reason for using the Compile command is to create or update a block in the blocks tree. There is no reason to use the Compile command for simulation or code generation, since all relevant files will be compiled automatically in those functions.

First, if the file is a schematic file that hasn't been compiled before, then you will be asked for a name for the block that will be created. This name must adhere to the following rules:

Next, the file is checked for syntactic and semantic errors. If errors are found, they will be output to the message view. Some error messages include a link that can be clicked to have the failing element selected in the source file. Refer to the Compiler Errors section for information about error messages.

If no errors are found, a block is created and added to the blocks tree under the User folder. If the file had already been compiled to a block before, then that block is replaced with the new one.

Finally, all open source files are scanned for instances of the block to ensure that they match the new definition. Hence, if the interface of the block was changed (that is, inputs or outputs were added or removed), then all existing instances of the block in open source files will be updated. In addition, connections to removed inputs or outputs will be removed, and for each removed connection, a message will be printed into the message view.

As an example of the above situation, consider two schematics A and B, where the block defined by B is used in A. In A, all the inputs and outputs are connected. Now, if you remove an input port i from the schematic B and then compile B, then the instance of block B in schematic A will be updated accordingly. Hence, the port i will be removed from that instance, and so will the connection to it.

Notice that no files will be changed on disk as a result of the Compile command. If connections are removed from a schematic as in the above example, then those changes take place only in memory. Hence, if you close the modified schematic without saving, then the connections will still be present in the file. Similarly, files that are not open will not be modified. However, as soon as a schematic file is opened, its block instances will be updated to match the current blocks.

Keyboard shortcut

F11

Availability

Available if the active tab is a source file in the project.