A DML source file can be compiled into a runnable device model using
the DML compiler, dmlc
. The main output of the compiler is a C file, that
can be compiled into a Simics module.
The DML compiler and its libraries are available as part of the Simics Base package.
The dmlc
compiler can be build locally. This requires an
installation of the Simics 6 base package.
In order to build the compiler, checkout the DML repository
into the
into the modules/dmlc
subdirectory of your Simics project. The compiler
can be built using the make dmlc
command. The build result ends up
in host/bin/dml
(where host
is linux64
or
win64
), and consists of three parts:
host/bin/dml/python
contains the Python module that
implements the compiler
host/bin/dml/1.4
contains the standard libraries
required to compile a device
host/bin/dml/api
contains .dml
files that
expose the Simics API
In order to use a locally built version of dmlc
to compile your
devices, you can add the following line to your config-user.mk
file:
DMLC_DIR = $(SIMICS_PROJECT)/$(HOST_TYPE)/bin
The syntax for running dmlc
from the command line is:
dmlc [options] input [output-base]
where input should be the name of a DML source file. If
output-base is provided, it will be used to name the created
files. The name of a DML source file should normally have the suffix
".dml
". The input file must contain a
device
declaration.
The main output of dmlc
is a C file named
<output-base>.c
, which that can be compiled and
linked into a Simics module using the gcc
compiler. The compiler
also produces some other helper files with .h
and .c
suffix, which
the main output file includes.
The following are the available command line options to
dmlc
:
-h, --help
Print usage help.
-I path
Add path to the search path for imported modules.
-D name=definition
Define a compile-time parameter. The definition must be a literal expression, and can be a quoted string, a boolean, an integer, or a floating point constant. The parameter will appear in the top-level scope.
--dep
Output makefile rules describing dependencies.
-T
Show tags on warning messages. The tags can be used with
the --nowarn
and --warn
options.
-g
Generate artifacts that allow for easier source-level debugging. This generates a DML debug file leveraged by debug-simics, and causes generated C code to follow the DML code more closely.
--coverity
Adds Synopsys® Coverity® analysis annotations to suppress common false positives in generated C code created from DML 1.4 device models.
Analysis annotation generation impacts the generation of line directives in a
way that may cause debugging or coverage tools besides Coverity to display
unexpected behavior. Because of this, it's recommended that --coverity
is
only used when needed.
--warn=tag
Enable selected warnings. The tags can be found using
the -T
option.
--nowarn=tag
Suppress selected warnings. The tags can be found using
the -T
option.
--werror
Turn all warnings into errors.
--strict
Report errors for some constructs that will be forbidden in future versions of the DML language
--noline
Suppress line directives for the C preprocessor so that the C code can be debugged.
--info
Enable the output of an XML file describing register layout.
--version
Print version information.
--simics-api=version
Use Simics API version version.
--max-errors=N
Limit the number of error messages to N.