This section explains the MDD format through an example of an MDD file and its corresponding Tcl file.
Example: MDD File
The following is an example of an MDD file for the uartlite driver.
option psf_version = 2.1;
option is a keyword identified by the tool. The
option name following the option keyword is a
directive to the tool to do a specific action. Here the psf_version of the MDD file is defined as 2.1. This is the only option
that can occur before a BEGIN DRIVER construct.
BEGIN DRIVER uartlite
The BEGIN DRIVER construct defines the start of a driver named
uartlite.
option supported_peripherals = (mdm axi_uartlite);
option driver_state = ACTIVE;
option copyfiles = all;
option VERSION = 3.0;
option NAME = uartlite;
The NAME option indicates the name of the
driver. The VERSION option indicates the version of
the driver. The COPYFILES option indicates the
files to be copied for a “level” 0 uartlite driver.
BEGIN INTERFACE stdin
BEGIN INTERFACE defines an interface the driver supports. The
interface name is stdin.
PROPERTY header = xuartlite_l.h;
FUNCTION name = inbyte, value = XUartLite_RecvByte;
END INTERFACE
An Interface contains a list of standard functions. A driver defining an interface should have values for the list of standard functions. It must also specify a header file in which all the function prototypes are defined.
PROPERTY defines the properties associated with the construct
defined in the BEGIN construct. The header is a property with the
value xuartlite_l.h, defined by the stdin
interface. FUNCTION defines a function supported by the interface.
The inbyte function of the stdin interface has the value
XUartLite_RecvByte. This function is defined in the header file
xuartlite_l.h.
BEGIN INTERFACE stdout
PROPERTY header = xuartlite_l.h;
FUNCTION name = outbyte, value = XUartLite_SendByte;
END INTERFACE
BEGIN INTERFACE stdio
PROPERTY header = xuartlite_l.h;
FUNCTION name = inbyte, value = XUartLite_RecvByte;
FUNCTION name = outbyte, value = XUartLite_SendByte;
END INTERFACE
END is used with the construct name that was used in the
BEGIN statement. Here END is used with
BLOCK and DRIVER constructs to indicate the
end of each BLOCK and DRIVER construct.
Example: Tcl File
The following is the uartlite.tcl file corresponding to the
uartlite.mdd file described in the previous section. The
“uartlite_drc” procedure would be invoked for the uartlite driver while running DRCs
for drivers. The generate routine generates constants in a header file and a c file
for uartlite driver, based on the driver definition segment in the MSS file.
proc generate {drv_handle} {
::hsi::utils::define_include_file $drv_handle "xparameters.h"
"XUartLite" "NUM_INSTANCES" "C_BASEADDR"
"C_HIGHADDR" "DEVICE_ID" "C_BAUDRATE" "C_USE_PARITY" "C_ODD_PARITY"
"C_DATA_BITS"
::hsi::utils::define_config_file $drv_handle "xuartlite_g.c"
"XUartLite" "DEVICE_ID" "C_BASEADDR"
"C_BAUDRATE" "C_USE_PARITY" "C_ODD_PARITY" "C_DATA_BITS"
::hsi::utils::define_canonical_xpars $drv_handle "xparameters.h"
"UartLite" "DEVICE_ID" "C_BASEADDR"
"C_HIGHADDR" "C_BAUDRATE" "C_USE_PARITY" "C_ODD_PARITY" "C_DATA_BITS"
}