The invention provides a Simulink
code generation method and device based on
instruction pipeline perception, and relates to the technical field of embedded
code generation, and the method comprises the steps: carrying out instruction dependency analysis and
delay modeling on a target Simulink model, and generating a
dependency graph for describing a dependency relationship between modules and an instruction
delay model combined with target processor
system structure parameters; based on the
dependency graph and the instruction
delay model, determining an optimal execution sequence of each module through
assembly line
perception scheduling, and performing
assembly line scheduling based on the optimal execution sequence to obtain a scheduling result; and based on the scheduling result, utilizing a local pipeline optimization strategy to generate a target code. According to the method provided by the invention, the
data dependence path between the modules is determined by utilizing topology analysis, and the execution sequence is adaptively selected through the minimum penalty priority
algorithm to avoid unnecessary waiting and resource conflicts, so that the number of pauses of the instruction
assembly line is effectively reduced on the premise of ensuring the
semantic consistency of the model.