Code generation domains

In simulation domains, a scheduler invokes the run methods of the blocks in a system specification, and those methods perform a function associated with the model. In code generation domains, the scheduler also invokes the run methods of the blocks, but these run methods synthesize code in some language. That is, they generate code to perform some function, rather than performing the function directly. The target then is responsible for generating the connecting code between blocks (if any is needed). This mechanism is very simple, and language independent. Ptolemy has released code generators for C, Motorola 56000 assembly, and VHDL languages, and these are now included in the MLDesigner kernel.

An alternative mechanism that is supported but less exploited in current MLDesigner domains is for the target to analyze the network of blocks in a system specification and generate a single monolithic implementation. This is what we call compilation. In this case, the primitive blocks must have functionality that is recognized by the target. In previous code generation mechanisms, the functionality of the blocks was arbitrary and could be defined by the end user.

Hierarchical system model structure