基于源程序获取实时控制系统的模式,不仅能够验证实现的模式与设计是否一致,还可使程序的最差情况执行时间(WCET)计算更为精准。为此,提出一种自动分析实时控制系统程序模式的方法。通过分析C语言源程序生成程序控制流图,对输入变量相关节点进行切片,形成依赖输入变量的控制流图(ICFG),建立ICFG每条路径的线性规划问题并求解,从而获得潜在的程序模式。在此基础上,计算指定模式下针对现代RISC处理器程序的WCET。在基准程序上的实验结果验证了该方法的可行性和有效性。
Obtaining program modes of real-time control system from source codes cannot only verify the consistence of the design and implementation, but also improve the accuracy of Worst-Case Execution Time(WCET) calculation. Based on this consideration, this paper proposes an automatic analysis method for program mode of real-time control system. The Control Flow Graph (CFG) of program is generated by analyzing the C source codes, and by means of slicing input variables dependent nodes, an Input-dependent Control Flow Graph (ICFG) is formed. Linear programming problem is constructed and solved for each path of ICFG. If the problem has a solution, a potential program mode will be achieved. On this basis,the WCET of given mode for program in modern RISC processor is calculated. Experimental result for a benchmark program shows that the proposed method is feasible and effective.