高级检索

    针对gem5指令集实现及其功能测试的自动代码生成

    An Automated Code Generation of Instruction Set Implementation and Functional Testing for gem5

    • 摘要: 在嵌入式领域,计算机系统模拟器是研究与原型开发的重要工具. 对于采用解释执行的模拟器,其CPU模型的译码过程会影响性能,如何提升译码过程的性能是提高仿真效率的关键问题之一. 此外,对于无标准测试集的指令集来说(例如自定义指令),手动编写指令功能测试的开发效率较低,并且其与实现译码过程所需的指令信息基本相同. 为解决上述问题,提出一个代码生成方案,输入一份指令集描述,输出针对gem5优化后的指令集实现代码和功能测试代码. 首先,扩展gem5的指令集描述语言,将其分为编码描述、功能描述和测试描述. 其次,针对gem5优化译码决策树构建算法,并为gem5生成译码模块代码、指令集实现代码和指令功能测试用例. 最后,以Cortex-M3指令集为例与原方案相比,总生成时间减少约64%,编译后的可执行文件代码大小减少约407 KB,性能提升约13%,并且能够提高开发效率.

       

      Abstract: Computer system simulators are important tools for research and prototype development of embedded systems. For interpretation-based simulators, the decoding process of CPU models has an important effect on their performance. Therefore, improving the performance of the decoding process is one of the key problems of simulation efficiency. Besides, for instruction sets without a standard test suite (such as custom instructions), writing functional tests manually leads to low development efficiency. The instruction information required by functional tests is practically the same as the implementation of the decoding process. To solve the above problems, we propose a code generation method, which takes an instruction set description as input and outputs its implementation codes optimized for gem5 and its functional tests. Firstly, we extend the instruction set description language of gem5 and divide it into code description, function description, and test description. Secondly, we optimize the construction algorithm of decoding decision trees for gem5 and generate decoding codes, instruction codes, and functional test cases. Lastly, we take the Cortex-M3 instruction set as an example and compare our method with the original method of gem5. The total generation time is reduced by about 64%, the compiled executable code size is reduced by about 407 KB, the performance is improved by about 13%, and our method can improve the development efficiency.

       

    /

    返回文章
    返回