CommunityCategory: GLISTERCustomizing the header and footer strings of the SystemVerilog module files generated by GLISTER

GLISTER

Customizing the header and footer strings of the SystemVerilog module files generated by GLISTER

SA Support Team Staff 2025-08-21

I need to insert some texts at the beginning of the SystemVerilog module files netlisted by GLISTER. For instance, the following is a typical module file from GLISTER, starting with some comment lines and an include statement.

// XMODEL/SystemVerilog netlist for prims_ex:tb_channel.schematic
// Generated on Aug 16 23:38:08 2025

`include "xmodel.h"

module tb_channel (
    `output_xreal out
);

// ... omitted ...

endmodule   // tb_channel

I'd like to include a few more lines, for example, that include an additional package file and import its contents, as highlighted below.

// XMODEL/SystemVerilog netlist for prims_ex:tb_channel.schematic
// Generated on Aug 16 23:38:08 2025

`include "xmodel.h"
`include "my_special_pkg.sv"

import my_special_pkg::*;

module tb_channel (
    `output_xreal out
);

// ... omitted ...

endmodule   // tb_channel

Is there a way to do this?

1 Answers
SA Support Team Staff 2025-08-21

Sure, there is. The SKILL variables 'xmodelModuleFileHeader' and 'xmodelModuleFileFooter' define the header and footer strings of SystemVerilog module files generated by GLISTER, respectively. Their default values are as follows.

xmodelModuleFileHeader->default = "`include \"xmodel.h\"\n"
xmodelModuleFileFooter->default = ""

So, the variable 'xmodelModuleFileHeader' can be modified to insert your custom lines at the beginning of the module files. For example,

xmodelModuleFileHeader->default = strcat(
    "`include \"xmodel.h\"\n"
    "`include \"my_special_pkg.sv\"\n\n"
    "import my_special_pkg::*;\n"
)
xmodelModuleFileFooter->default = ""

Note that double quotation marks used inside the string must be escaped using backslashes and line breaks are represented by '\n'. This example uses the strcat() function to display the text line by line.

Also, if you enclose an environment variable name in ${…}, its value will be substituted into the string.

xmodelModuleFileHeader->default = strcat(
    "`include \"xmodel.h\"\n"
    "`include \"${MYPKG_PATH}/my_special_pkg.sv\"\n\n"
    "import my_special_pkg::*;\n"
)
xmodelModuleFileFooter->default = ""

In the above examples, we've set the 'default' attribute of the variables, which specifies the header and footer strings for all SystemVerilog simulators. However, one may want to define the header and footer strings for a specific SystemVerilog simulator. The following example shows how to set different header strings for VCS and Xcelium, by defining the attributes that correspond to the simulator names. The supported simulator attributes are: vcs, xcelium, ncverilog, questa, and modelsim.

xmodelModuleFileHeader->vcs = strcat(
    "`include \"xmodel.h\"\n\n"
    "`ifndef _SNPS_MSV_NETTYPE_PKG_\n"
    "`define _SNPS_MSV_NETTYPE_PKG_\n"
    "`include \"${VCS_HOME}/etc/snps_msv/snps_msv_nettype_pkg.svp\"\n"
    "import snps_msv_nettype_pkg::*;\n"
    "`endif"
)
xmodelModuleFileHeader->xcelium = strcat(
    "`include \"xmodel.h\"\n"
    "import cds_rnm_pkg::*;\n"
)
xmodelModuleFileHeader->questa = strcat(
    "`include \"xmodel.h\"\n"
    "import mgc_rnm_pkg::*;\n"
)

In a similar fashion, the SKILL variables 'xmodelWrapperModuleFileHeader' and 'xmodelWrapperModuleFileFooter' define the header and footer strings of SystemVerilog module files wrapping SPICE netlists for co-simulation purposes. Their default values are as follows.

xmodelWrapperModuleFileHeader->default = "`include \"xmodel.h\"\n"
xmodelWrapperModuleFileFooter->default = ""