英特尔设备建模语言,用于虚拟平台。
Intel Device Modeling Language for virtual platforms

原始链接: https://github.com/intel/device-modeling-language

## 设备建模语言 (DML) 概要 设备建模语言 (DML) 是一种专门的语言,旨在创建用于虚拟平台开发的快速、功能性的设备模型。它提供诸如寄存器组和事件发布等高级抽象,简化了模型创建。DML 代码由 DML 编译器 (DMLC) 处理,该编译器生成针对特定模拟器(目前是 Intel® Simics®)优化的 C 代码,未来可能会扩展。 构建 DMLC 需要 Simics 安装,并涉及将 DML 仓库检出到 Simics 项目中,然后执行 `make dmlc` 命令。测试通过 `make test-dmlc` 进行。 几个环境变量可以辅助开发,包括 `DMLC_DIR` 用于指定编译器位置,以及 `DMLC_PATHSUBST` 用于提高错误消息的清晰度。 DMLC 还提供用于性能分析、通过创建存档隔离编译问题以及收集代码生成统计信息 (`DMLC_GATHER_SIZE_STATISTICS`) 以优化模型大小和编译时间等功能。这些统计信息突出了代码改进的领域,例如利用共享方法或重构循环。

黑客新闻 新 | 过去 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 英特尔设备建模语言,用于虚拟平台 (github.com/intel) 3点 由 transpute 1小时前 | 隐藏 | 过去 | 收藏 | 讨论 帮助 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请YC | 联系 搜索:
相关文章

原文

The Device Modeling Language (DML) is a domain-specific language for writing fast functional or transaction-level device models for virtual platforms. DML provides high-level abstractions suitable for functional device models, including constructs like register banks, registers, bit fields, event posting, interfaces between models, and logging. DML code is compiled by the DML Compiler (DMLC), producing C code with API calls tailored for a particular simulator.

Currently, the compiler supports building models for the Intel® Simics® simulator, but other back-ends may be added in the future.

Building and testing DMLC

To build DMLC, you need to have a Simics simulator installation and a Simics project set up.

Using the Public Release of the Intel Simics Simulator

If you do not already have a Simics simulator installation or access to the Simics simulator via commercial channels, install the Public Release of the Intel Simics simulator and create a Simics project (automatic in the default installation flow).

Building DMLC from a Simics project

In your Simics project, check out the DML repository into the modules/dmlc directory. At the top-level of the project, do make dmlc (or bin\make dmlc on Windows).

Testing DMLC from a Simics project

To run the unit tests provided with DMLC, run make test-dmlc or bin/test-runner --suite modules/dmlc/test from the top-level of the project.

The following environment variables are handy when developing DMLC. If you work regularly with a locally built DMLC, then consider setting the variables DMLC_DIR T126_JOBS, DMLC_PATHSUBST and PY_SYMLINKS in your .bashrc. Remaining variables are better to only enable when needed.

After building DMLC, you need to set DMLC_DIR to <your-project>/<hosttype>/bin in subsequent invocations of make in order to build devices with the locally built compiler. <hosttype> is either linux64 or win64 depending on your host type.

When set, the given number of tests are run in parallel.

The DMLC build copies a few DML library files, e.g. dml-builtins.dml, into <hosttype>/bin. When a compile error happens, error messages will normally point to this copy rather than the source. By setting DMLC_PATHSUBST to <hosttype>/bin/dml=modules/dmlc/lib, error messages will be rewritten to point to the source file instead. <hosttype> is either linux64 or win64 depending on your host type.

When set to 1, make dmlc will symlink Python files instead of copying them. This has two effects: Python tracebacks will bring you to the source file in the repository, and you don't need to re-run make after editing Python files.

When set to 1, unexpected exceptions in the compiler are echoed to stderr. The default is to hide tracebacks in a file dmlc-error.log.

Override the default compiler in unit tests.

When set, DMLC does self-profiling and writes the profile to a .prof file.

When set, DMLC emits a .tar.bz2 archive containing all DML source files, packaged on a form that can be compiled standalone. This is useful when a DML problem appears within a complex build environment, and you want to reproduce the problem in isolation. In the created archive, all DML files are located in the same directory (either top level or under a series of subdirectories called _), and relative imports are handled by also including symlinks in the archive. On Windows, DMLC is sometimes unable to resolve these symlinks correctly; for this reason, it is recommended that the archive is only extracted and compiled on Linux.

DMLC_GATHER_SIZE_STATISTICS

When set, DMLC outputs a file ending with -size-stats.json, which shows code generation statistics useful to reduce generated code size and increase compile speed. The file lists how much C code is generated for each DML method. The output is a list of triples [tot_size, location, num], where tot_size is the total number of bytes of C code generated from one method declaration, num is how many times C code was generated from this declaration (because it was expanded by a template), and location is the source location of the declaration.

An entry with a large tot_size and a large num can be reduced by declaring the method as shared; this should roughly divide the size by num. An entry with large tot_size with num equals 1 usually means the method is dominated by a construct like #foreach or #select, and can be reduced by breaking out the loop body into a separate method, or by otherwise reworking the loop into some other construct like foreach.

Note that the statistics only includes code directly generated from method declarations; the total code size includes much more. One megabyte of code size from method declarations usually contributes with a few seconds of compile time.

联系我们 contact @ memedata.com