创建必要的环境文件
为了通过 RISCOF 运行测试,您需要提供以下项目:
-
config.ini:这是一个基本的配置文件,遵循 ini 语法。此文件将捕获诸如 DUT/参考插件的名称、插件的路径、基于 riscv-config 的 yamls 的路径等信息。有关内容和语法的更多信息,请参阅 Config.ini 语法部分。
-
dut-plugin 目录:RISCOF 要求测试的 DUT 模型以 Python 插件的形式呈现。Python 插件仅是一个包含某些标准和定义函数的 python 文件,用于执行测试编译、执行和签名提取等活动。此 python 文件名需要以 riscof_ 为前缀,并且必须存在于 dut-plugin 目录中。有关如何编写此 python 文件的详细信息,请参阅 Python 插件文件部分。
该目录还需要包含基于 riscv-config 的 isa 和 platform yamls,这些 yamls 提供了 DUT 的定义。这些 yamls 将用于筛选需要在 DUT 上运行的测试。
最后,dut-plugin 目录中还需要存在一个 env 目录,其中包含编译和运行 DUT 上测试所需的环境文件,如 model_test.h。有关可以在 model_test.h 文件中使用的宏的定义,请参阅 TestFormat 规范。env 目录还可以包括链接脚本、用户可能需要的后处理脚本等其他文件。
-
reference-plugin 目录:与 DUT 插件类似,RISCOF 还需要一个参考模型插件。目录和文件的结构与 DUT 相同。然而,不需要 isa 和 platform yamls,因为 RISCOF 将始终从 DUT 插件中选择 yamls。
有关预构建插件的示例模板,请参阅参考 RISCOF 插件列表。
生成 DUT 和参考模型
为了简化操作,RISCOF 通过如下所示的 setup 命令为用户生成 DUT 和参考模型的标准预构建模板:
$ riscof setup --dutname=spike
执行日志
INFO | ****** RISCOF: RISC-V Architectural Test Framework 1.25.3 *******
INFO | using riscv_isac version : 0.18.0
INFO | using riscv_config version : 3.18.3
INFO | Setting up sample plugin requirements [Old files will be overwritten]
INFO | Creating sample Plugin directory for [DUT]: spike
INFO | copying/path/to/python/site-packages/riscof/Templates/setup/model/env/model_test.h ->/path/to/$pwd/spike/env
INFO | copying/path/to/python/site-packages/riscof/Templates/setup/model/env/link.ld ->/path/to/$pwd/spike/env
INFO | copying/path/to/python/site-packages/riscof/Templates/setup/model/model_platform.yaml ->/path/to/$pwd/spike
INFO | copying/path/to/python/site-packages/riscof/Templates/setup/model/model_isa.yaml ->/path/to/$pwd/spike
INFO | copying/path/to/python/site-packages/riscof/Templates/setup/model/riscof_model.py ->/path/to/$pwd/spike
INFO | copying/path/to/python/site-packages/riscof/Templates/setup/model/__pycache__/riscof_model.cpython-310.pyc ->/path/to/$pwd/spike/__pycache__
INFO | Creating sample Plugin directory for [REF]: sail_cSim
INFO | copying/path/to/python/site-packages/riscof/Templates/setup/sail_cSim/env/model_test.h ->/path/to/$pwd/sail_cSim/env
INFO | copying/path/to/python/site-packages/riscof/Templates/setup/sail_cSim/env/link.ld ->/path/to/$pwd/sail_cSim/env
INFO | copying/path/to/python/site-packages/riscof/Templates/setup/sail_cSim/__pycache__/__init__.cpython-310.pyc ->/path/to/$pwd/sail_cSim/__pycache__
INFO | copying/path/to/python/site-packages/riscof/Templates/setup/sail_cSim/__pycache__/riscof_sail_cSim.cpython-310.pyc ->/path/to/$pwd/sail_cSim/__pycache__
INFO | copying/path/to/python/site-packages/riscof/Templates/setup/sail_cSim/__init__.py ->/path/to/$pwd/sail_cSim
INFO | copying/