Professional Documents
Culture Documents
Uvm Util
Uvm Util
Cadence Design Systems, Inc. (Cadence), 2655 Seely Ave., San Jose, CA 95134, USA.
Trademarks: Trademarks and service marks of Cadence Design Systems, Inc. contained in this
document are attributed to Cadence with the appropriate symbol. For queries regarding Cadence's
trademarks, contact the corporate legal department at the address shown above or call
800.862.4522. All other trademarks are the property of their respective holders. Trademarks and
service marks of Cadence Design Systems, Inc. contained in this document are attributed to
Cadence with the appropriate symbol. For queries regarding Cadence's trademarks, contact the
corporate legal department at the address shown above or call 800.862.4522. Open SystemC,
Open SystemC Initiative, OSCI, SystemC, and Accellera Systems Initiative Inc. are trademarks or
registered trademarks of Open SystemC Initiative, Inc. in the United States and other countries and
are used with permission. All other trademarks are the property of their respective owners.
Restricted Permission: This publication is protected by copyright law and international treaties
and contains trade secrets and proprietary information owned by Cadence. Unauthorized
reproduction or distribution of this publication, or any portion of it, may result in civil and criminal
penalties. Except as specified in this permission statement, this publication may not be copied,
reproduced, modified, published, uploaded, posted, transmitted, or distributed in any way, without
prior written permission from Cadence. Unless otherwise agreed to by Cadence in writing, this
statement permits Cadence customers permission to print one (1) hard copy of this publication
subject to the following conditions:
1. The publication may be used only in accordance with a written agreement between Cadence
and its customer.
2. The publication may not be modified in any way.
3. Any authorized copy of the publication or portion thereof must include all original copyright,
trademark, and other proprietary notices and this permission statement.
4. The information contained in this document cannot be used in the development of like
products or software, whether for internal or external use, and shall not be used for the
benefit of any other party, whether or not for consideration.
Disclaimer: Information in this publication is subject to change without notice and does not
represent a commitment on the part of Cadence. Except as may be explicitly outlined in such
agreement, Cadence does not make, and expressly disclaims any representations or warranties as
to the completeness, accuracy, or usefulness of the information contained in this document.
Cadence does not warrant that use of such information will not infringe any third-party rights, nor
does Cadence assume any liability for damages or costs of any kind that may result from the use of
such information.
Cadence is committed to using respectful language in our code and communications. We are also
active in the removal and/or replacement of inappropriate language from existing content. This
product documentation may however contain material that is no longer considered appropriate but
still reflects long-standing industry terminology. Such content will be addressed at a time when the
related software can be updated without end-user impact.
Contents
1 7
Register Verification 7
Notes 7
Running Register Verifier and the Register Verifier Demo 8
Running Register Verifier 8
Running the Register Verifier Demo 12
Working with IP-XACT Files 14
Currently Supported IP-XACT Versions 14
IP-XACT File Format Structure 14
Defining Type Names with IP-XACT 15
Defining Single- and Multi-Dimensional Arrays with IP-XACT 15
Generating HDL Paths with IP-XACT 1685-2014 16
IP-XACT Entities and Their Conversion to e 16
component 17
memoryMaps 17
memoryMap 18
addressBlock 19
Register 22
Register field 26
IP-XACT Entities and Their Conversion to uvmreg 30
Registers and Register Fields 30
Memories 32
Register Files 32
Blocks and Sub-Blocks 33
Cadence IP-XACT Vendor Extensions for Register Verifier 35
Supported Input Documents 37
Supported Locations in IP-XACT File 38
Requirements 39
Vendor Extension Container 39
Field Data 40
Memory Map, Register and Address Block Description 41
Custom Access Policies for Specific Register Fields 44
Verification Properties 46
configure_code Command 94
mltypemap Limitations for this Release 96
Register Verification
The Register Verifier application is delivered under the Cadence® Xcelium™ Simulator release.
The application reads IP-XACT files (described in Working with IP-XACT Files) containing address
and register definitions and generates corresponding definitions in either vr_ad (in e) or reg_mem
(in SystemVerilog). This generated code can then be included in the verification environment.
In cases where the standard IP-XACT is not sufficient, vendor extensions are needed. A list of
supported vendor extensions and their descriptions is provided under Cadence IP-XACT Vendor
Extensions for Register Verifier.
Notes
Register Verifier is supported only on Linux.
iregGen is under deprecation, and support will be removed in a future version. Cadence
recommends that you migrate to Register Verifier. For instructions, see Migrating from
iregGen to Register Verifier.
This chapter includes the following sections:
Running Register Verifier and the Register Verifier Demo
Working with IP-XACT Files
IP-XACT Entities and Their Conversion to e
IP-XACT Entities and Their Conversion to uvmreg
Cadence IP-XACT Vendor Extensions for Register Verifier
Optimization in Register Verifier
Modeling Standard UVM Register Access Modes
Multiple Invocation in Register Verifier
Migrating from iregGen to Register Verifier
Syntax
reg_verifier
-top <top-file>
-domain vr_ad | uvmreg
-dut_name <dut-name>
[<global options...>] [<domain options>...]
Running this will read the file my_env.xml, parse the component named apb_subsystem, create e files
in directory reg_verifier_dir, and all defined types (register names, enums) will be prefixed with
"CMPNY_".
Parameters
Mandatory Flags
Global Options
-incdir <dir,...> Include directories for referenced IP-XACT files. All referenced IP-XACT
should be located (directly or indirectly) under these directories.
-target_dir <dir> Target generation directory (that is, the location of the generatede or SV
files).
Default: reg_verifier_dir
-cov Generate the coverage code for the register based on the input IP-XACT.
By default, coverage is off.
-out_file <prefix> Change the file prefix (default: cdns_uvmreg) of the generated files in the
output_directory/uvmreg directory. For more information, see the
discussion under “When the domain flag is vr_ad:” below.
-pkg=<name> Change the name of the package inside of which the register model
classes are generated. For more information, see the discussion under
“When the domain flag is uvmreg:” below.
- Generate the utils macros in the register class and no other class of
enable_callback register-file, memories, or blocks is impacted. The macros added are
“`uvm_register_cb(“name”, uvm_reg_cbs) ” and
“`uvm_set_super_type(“name”, uvm_reg)”. Note that this option will impact
the elaboration time.
To check the created files and verify that they conform to your expectations, you can load the test
file and issue the gen command in Cadence® Specman® Elite:
specman -p 'load reg_verifier/vr_ad/test.e;gen'
At the specman prompt, you can also print the generated map/s. For example:
specman> show map
specman> print @1
To integrate the created files in the environment, instantiate the created maps in the appropriate
location in your verification environment. (See the test.e or regs.e files, to see the exact type of
the created map.) For example:
<'
extend my_env {
am0 : AM0 vr_ad_map;
};
'>
NOTE: *.dat files contain static configuration values which are applied at runtime. This separation
aims at a faster turnaround upon changes.
The default prefix cdns_uvmreg in the name of the files generated in the output directory can be
changed by specifying the -out_file option. Note that specifying this option does not affect the
package name.
The name of the package in thecdns_uvmreg_rdb.sv file (or the prefix_rdb.sv file if you changed
the prefix using the -out_file option) can be changed. The default package name is my_pkg. If the -
pov_intf option is specified, the name intf_name_pkg overrides the name my_pkg. However,
specifying the -pkg option overrides both of those names with the specified name.
vr_ad
Here the demo script reads IP-XACT files and generates vr_ad definitions with the following
command:
reg_verifier -dut_name APB_SUBSYTEM_regs \
-top < install-dir>/tools/tti/examples/reg_verifier/ipxact_example.xml \
-domain vr_ad
The following command loads the files and displays the results:
specman -p 'load reg_verifier_dir/vr_ad/test; gen; print sys.mmap0.reg_list[1]; exit'
uvmreg
Here the demo script reads IP-XACT files and generates uvmreg definitions with the following
command:
reg_verifier -dut_name APB_SUBSYTEM_regs \
-top < install-dir>/tools/tti/examples/reg_verifier/ipxact_example.xml -domain
uvmreg
+define+CDNS_UVMREG_CONFIG_DATA_DIR=./reg_verifier_dir/uvmreg/$REG_VERIFIER_EXAMPLE_DIR/uvc_pkg.s
v \
$REG_VERIFIER_EXAMPLE_DIR/tb_top.sv \
$REG_VERIFIER_EXAMPLE_DIR/test.sv \
-coverage U -covoverwrite +access+rw \
+uvm_set_verbosity=uvm_test_top,REG_PREDICT,UVM_HIGH,connect \
+define+NUM_REGS=10 +UVM_RECORDING=1
<spirit:memoryMaps>
<spirit:memoryMap>
<spirit:name>am0</spirit:name>
<spirit:addressBlock>
<spirit:name>rf1</spirit:name>
<spirit:baseAddress>0x1000</spirit:baseAddress>
<spirit:range>0x100</spirit:range>
<spirit:width>8</spirit:width>
<spirit:register>
<spirit:name>reg0</spirit:name>
<spirit:addressOffset>0x0</spirit:addressOffset>
<spirit:size>8</spirit:size>
<spirit:access>write-only</spirit:access>
<spirit:reset>
<spirit:value>0x00</spirit:value>
<spirit:mask>0xff</spirit:mask>
</spirit:reset>
<spirit:field>
<spirit:name>reg1_f</spirit:name>
<spirit:bitOffset>0</spirit:bitOffset>
<spirit:bitWidth>8</spirit:bitWidth>
</spirit:field>
</spirit:register>
</spirit:addressBlock>
</spirit:memoryMap>
</spirit:memoryMaps>
<spirit:register>
<spirit:name>i_vendor_id_device_id_2</spirit:name>
<spirit:dim>2</spirit:dim> -
<spirit:dim>4</spirit:dim>
<spirit:dim>3</spirit:dim>
<spirit:addressOffset>0x40</spirit:addressOffset>
<spirit:size>32</spirit:size>
For single- or multi-diminsional arrays, you can generate HDL paths for the complete array
object or for each element in the array objects:
indexedAccessHandle is for use with memory mapped objects with a dimension, i.e.,
alternateRegister, register, and registerFile elements.
leafAccessHandle describes how to access the associated IP-XACT object.
Register field
component
The component is the central place holder for objects meta-data. In our context, the component is
a container of one or more memory maps (described below).
name
Name of the component, parsed by reg_verifier, mentioned in some of the comments in the
created e file.
memoryMaps
Described in detail below.
memoryMaps
The memoryMaps contains one or more memory maps.
memoryMap
Described in detail below.
memoryMap
Based on each memoryMap in the IP-XACT definition file, reg_verifier defines a subtype of
vr_ad_map.
The vr_ad_map_kind type is extended, adding the name of the new map
The new subtype is extended, adding all memory blocks as described in the IPXACT file.
All types used by this map will contain the map name as a prefix. This includes enums, register
files and registers.
The top level map should be instantiated in the verification environment.
Example
The following IPXACT definitions:
<spirit:memoryMaps>
<spirit:memoryMap>
<spirit:name>am0</spirit:name>
</spirit:memoryMap>
</spirit:memoryMaps>
memoryMap elements
name
The name of created map - a vr_ad_map_kind
addressBlock
Described below.
addressBlock
Based on each addressBlock in the IP-XACT definition file, reg_verifier defines a subtype of
vr_ad_reg_file.
The vr_ad_reg_file_kind type is extended, adding the name of the new file. The name of the
address map is used as a prefix for the name of the register file.
The new subtype of the reg file is extended, adding all registers as described in the IPXACT
file.
The register file is added to the address map.
Example
The following IPXACT definition:
<spirit:memoryMap>
<spirit:name>am0</spirit:name>
<spirit:addressBlock>
<spirit:name>rf1</spirit:name>
<spirit:baseAddress>0x1000</spirit:baseAddress>
<spirit:range>0x100</spirit:range>
<spirit:width>8</spirit:width>
<spirit:register>
<spirit:name>reg0</spirit:name>
</spirit:register>
</spirit:addressBlock>
</spirit:memoryMap>
addressBlock elements/attributes
name
Name of created register file, value added tovr_ad_reg_file_kind.
For example, the following:
<spirit:name>rf1</spirit:name>
baseAddress
The offset of the register file within its map.
For example, this:
<spirit:addressBlock>
<spirit:name>rf1</spirit:name>
<spirit:baseAddress>0x1000</spirit:baseAddress>
…
description
Copied as is into a comment, part of the register file header.
range
The size of created register file.
For example, this:
<spirit:range>0x100</spirit:range>
width
The addressing width of created registers file. The width in the IPXACT definition file is in bits, but
in e the width is in bytes.
For example, this:
<spirit:width>8</spirit:width>
Register
For each register defined in the IPXACT file, reg_verifier creates avr_ad_register.
The register name is prefixed with the name of the containing map and register file.
A new enum type is defined for each field defined with “values” (described below).
If no field is defined in the register, a field nameddata is defined and its width is the register’s
width.
If the fields defined in the registers have gaps (their total width is less than the register’s
width), reg_verifier pads the gaps with reserved fields.
Example 1: no fields
This is a definition of a write-only register, with no defined fields. A field named data I defined.
<spirit:register>
<spirit:name>reg0</spirit:name>
<spirit:addressOffset>0x0</spirit:addressOffset>
<spirit:size>8</spirit:size>
<spirit:access>write-only</spirit:access>
<spirit:reset>
<spirit:value>0x00</spirit:value>
</spirit:reset>
</spirit:register>
<spirit:register>
<spirit:name>reg3</spirit:name>
<spirit:description>register with unused offsets at both edges of register.
</spirit:description>
<spirit:addressOffset>0x3</spirit:addressOffset>
<spirit:size>8</spirit:size>
<spirit:field>
<spirit:name>f0</spirit:name>
<spirit:bitOffset>3</spirit:bitOffset>
<spirit:bitWidth>3</spirit:bitWidth>
</spirit:field>
</spirit:register>
The following is the created code. reg_verifier “filled the gaps”, that is it defined two reserved fields,
at offset 0 and offset 6.
Register Elements/Attributes
name
The name of the register. In the createde file, it will be
prefixed by name of memory map and register file.
uppercase
For example, this:
<spirit:name>reg3</spirit:name>
addressoffset
The address, offset, of the register in the register file.
For example, this:
<spirit:addressOffset>0x3</spirit:addressOffset>
Results in the following:
description
Copied as is into a comment, part of the register header.
size
The register size in bits. This value is used by reg_verifier to calculate whether there are gaps in
the register fields.
The sum of field widths should equal the size of the register. If it does not, the ipxact2crad adds
reserved fields to fill the gap.
access
Access policy of the register. This is the default value of access policy for each of the fields. It can
be overridden per each field, using the access element of the register field.
reset
Reset value of the register.
The reset has two elements:
value: value of reset
mask: optional, not implemented in first release
Register field
For each field in the register definition, reg_verifier defines a field in the newvr_ad_reg.
If the field defines values, a new enum is defined.
NOTE: Each field has its own enum type. Each enum type is prefixed with map, file, and register
names, thereby preventing name clashes.
If a field does not define access policy, it inherits the policy defined for the register. If no policy is
defined, it assumes read-write.
Example
The following IPXACT code defines a register with one field, at offset 3 and width 3.
<spirit:register>
<spirit:name>reg3</spirit:name>
<spirit:description>register with unused offsets at both edges of register.
</spirit:description>
<spirit:addressOffset>0x3</spirit:addressOffset>
<spirit:size>8</spirit:size>
<spirit:field>
<spirit:name>f0</spirit:name>
<spirit:bitOffset>3</spirit:bitOffset>
<spirit:bitWidth>3</spirit:bitWidth>
</spirit:field>
</spirit:register>
The following is the created code. reg_verifier "filled the gaps", that is it defined two reserved fields,
at offset 0 and offset 6.
name
The name of the created vr_ad_reg.
For example, this:
<spirit:field>
<spirit:name>f0</spirit:name>
<spirit:bitOffset>0</spirit:bitOffset>
<spirit:bitWidth>2</spirit:bitWidth>
</spirit:field>
bitOffset
Field offset in the register, directs the location of the field in the register.
bitWidth
Field width in bits.
For example, this:
<spirit:field>
<spirit:name>f0</spirit:name>
<spirit:bitOffset>0</spirit:bitOffset>
<spirit:bitWidth>2</spirit:bitWidth>
</spirit:field>
description
Copied as is into a comment, part of the register header.
access
Access policy of the field. The default is the access policy of the register.
For example, this:
<spirit:register>
<spirit:name>command</spirit:name>
<spirit:addressOffset>0x0</spirit:addressOffset>
<spirit:size>8</spirit:size>
<spirit:access>read-write</spirit:access>
<spirit:field>
<spirit:name>word_size</spirit:name>
<spirit:bitOffset>0</spirit:bitOffset>
<spirit:bitWidth>3</spirit:bitWidth>
<spirit:access>read-only</spirit:access>
</spirit:field>
<spirit:field>
<spirit:name>source_address_enable</spirit:name>
<spirit:bitOffset>3</spirit:bitOffset>
<spirit:bitWidth>5</spirit:bitWidth>
</spirit:field>
</spirit:register>
values
Based on the described values, reg_verifier defines new enum, and the field type is of this enum.
The new type is lowercase, prefixed with map, file, and register names, suffixed with '_t'.
The enum type is uppercase.
The field name is lowercase.
NOTE: Each field has its own enum type. Each enum type prefixed with map, file, and register
names, thereby preventing name clashes if there are multiple fields.
For example, the following lines, which define the field as having four legal values 0..3 and each
value having a name:
<spirit:register>
<spirit:name>reg4</spirit:name>
… some fields…
<spirit:field>
<spirit:name>dirs</spirit:name>
<spirit:bitOffset>2</spirit:bitOffset>
<spirit:bitWidth>2</spirit:bitWidth>
<spirit:access>write-only</spirit:access>
<spirit:values>
<spirit:value>0</spirit:value>
<spirit:name>north</spirit:name>
</spirit:values>
<spirit:values>
<spirit:value>1</spirit:value>
<spirit:name>south</spirit:name>
</spirit:values>
<spirit:values>
<spirit:value>2</spirit:value>
<spirit:name>east</spirit:name>
</spirit:values>
<spirit:values>
<spirit:value>3</spirit:value>
<spirit:name>west</spirit:name>
</spirit:values>
</spirit:field>
… some more fields…
<spirit:register>
Results in the following new enum defined, to be used only by this field.
type am0_rf1_reg4_dirs_t : [north = 0,south = 1,east = 2,west = 3] (bits : 2) ;
<spirit:register>
<spirit:name>ureg0</spirit:name>
<spirit:addressOffset>0</spirit:addressOffset>
<spirit:size>32</spirit:size>
<spirit:reset>
<spirit:value>0x12345678</spirit:value>
<spirit:mask>0xffffffff</spirit:mask>
</spirit:reset>
<spirit:field>
<spirit:name>destination</spirit:name>
<spirit:bitOffset>0</spirit:bitOffset>
<spirit:bitWidth>14</spirit:bitWidth>
</spirit:field>
……
……
</spirit:register>
With this IP-XACT input, the register class is built in thecdns_uvmreg_rdb.sv file. The configuration
of register and its fields is stored in cdns_uvmreg_config.dat file.
Register class generated is:
Every register class generated automatically is extended from thecdns_uvm_reg virtual class,
as it contains certain utility functions and pure virtual build() function. This cdns_uvm_reg
virtual class is extended from the uvm_reg class.
Memories
In IP-XACT, input for memories are represented fromspirit:addressBlock with spirit:usage value
equal to "memory." The memory configuration is defined as follows: name of the memory using
spirit:name, address offset using spirit:baseAddress, total number of memory locations using
spirit:range, width of each memory location using spirit:width and access from spirit:access.
The memory input in IP-XACT is represented as follows:
<spirit:addressBlock>
<spirit:name>mem</spirit:name>
<spirit:baseAddress>0x100</spirit:baseAddress>
<spirit:range>8</spirit:range>
<spirit:width>64</spirit:width>
<spirit:usage>memory</spirit:usage>
<spirit:volatile>false</spirit:volatile>
<spirit:access>read-write</spirit:access>
</spirit:addressBlock>
From this IP-XACT input, the memory class is generated in thecdns_uvmreg_rdb.sv file which also
includes the memory configuration.
Register Files
In IP-XACT input, the register files are defined fromspirit:registerFile. The register file contains
registers and register files. Register files can have deep hierarchy of register file inside register file.
The register filename is from spirit:name and address offset from spirit:adressOffset. The
register file input in IP-XACT is represented as follows:
<spirit:registerFile>
<spirit:name>reg_file_level2</spirit:name>
<spirit:addressOffset>0x40</spirit:addressOffset>
<spirit:range>4</spirit:range>
<spirit:register>
<spirit:name>ureg4</spirit:name>
. . .
. . .
</spirit:registerFile>
From this IP-XACT input, the register file class is generated incdns_uvmreg_rdb.sv, and the
configuration of the register file is stored in cdns_uvmreg_config.dat file. The register file class is
generated as follows:
<spirit:addressBlock>
<spirit:name>rfile0</spirit:name>
<spirit:baseAddress>0x0</spirit:baseAddress>
<spirit:width>32</spirit:width>
<spirit:register>
<spirit:name>ureg0</spirit:name>
. . .
</ spirit:register >
. . . .
. . .
</spirit:addressBlock>
From this IP-XACT input, reg_verifier generates the uvm_reg_block class inside
cdns_uvmreg_rdb.sv and the configuration of the sub-block inside cdns_uvmreg_config.dat .
The name generated for a given sub-block contains a concatenation of the names of the
blocks in the given hierarchy, starting with the top block. For example, for the following
hierarchy:
top_blk
sub_block1
sub_block11
sub_block2
The configuration for sub-blocks is same as for the register files in the configuration file.
The top level block in UVM register model is generated from thespirit:component in IP-XACT.
And the map inside the top level is created from spirit:memoryMap. For the top-level block, input
<spirit:component …… . . . . .. >
. . . . .
<spirit:name>APB_SUBSYTEM_regs</spirit:name>
<spirit:version>1.4</spirit:version>
<spirit:memoryMaps>
<spirit:memoryMap>
<spirit:name>mmap0</spirit:name>
<spirit:addressBlock>
. . . .
. . .
</spirit:component>
From this IP-XACT input, the top-level block class is created which instantiates all the sub-blocks
inside the top-level block class in cdns_uvmreg_rdb.sv file. The code for the top-level block class is
as follows:
Example
<spirit:component>
<spirit:vendorExtensions>
<!-- VENDOR extension elements go here -->
</spirit:vendorExtensions>
</spirit:component>
Requirements
The Cadence vendor extension grammar includes type definitions from the following non-Cadence
grammars:
IP-XACT grammar, namespace
[http://www.spiritconsortium.org/XMLSchema/SPIRIT/1685-2009]
Therefore a complete grammar-based check on an IP-XACT file with vendor extensions will require
access to the following grammar location:
http://www.spiritconsortium.org/XMLSchema/SPIRIT/1685-2009/index.xsd.
Example
<spirit:vendorExtensions>
<cadence:extensions>
<cadence:xPolicy cadence:classname=”my_policy”/
</cadence:extensions>
</spirit:vendorExtensions>
HDL Information
The user can add HDL hierarchy information. The topology provided by the IP-XACT
component/instance hierarchy may not be the exact hierarchy of register or address blocks. This
property allows the user to specify the HDL representation of such elements. Defining HDL path for
a slice of e.g. a register can be done by an optional field data parent.
Example
<cadence:extensions>
<cadence:hdlAccess cadence:path="dut.reg1"/>
<cadence:hdlAccess cadence:path="clkdomain1.reg1" cadence:domain="GATELEVEL"/>
</cadence:extensions>
Field Data
The user can specify a slice of a register, register field or address block using this construct.
Example
<cadence:extensions>
<cadence:hdlAccess cadence:path="top.dut.reg2_slice0_4">
<cadence:fieldData cadence:bitOffset="0x0" cadence:size="5" />
</cadence:hdlAccess>
</cadence:extensions>
General Attributes
The user can add an attribute value to some elements.
Example
<cadence:extensions>
<cadence:attribute cadence:name="aliasName">newName</cadence:attribute>
</cadence:extensions>
Endianess
The user can specify the endianess of a memory map or address block in case it cannot be
detected based on the endianess of an associated bus interface.
Example
<cadence:extensions>
<cadence:endianess>big</cadence:endianess>
</cadence:extensions>
Example
<cadence:extensions>
<cadence:resetValue cadence:cause="POWER_ON">
<cadence:value>0x11</cadence:value>
<cadence:mask>0xff</cadence:mask>
</cadence:resetValue>
</cadence:extensions>
Example
<cadence:extensions>
<cadence:isFifoWithDepth>5</cadence:isFifoWithDepth>
</cadence:extensions>
The custom register definition may be completed by a set of property elements inside the customer
register container.
field (aregField).
<cadence:extensions>
<cadence:customRegister cadence:type="indirectAccess">
<cadence:property cadence:name="addrReg" cadence:value="reg1"/>
<cadence:property cadence:name="aregField" cadence:value="idx1"/>
</cadence:customRegister>
</cadence:extensions>
<spirit:field>
<spirit:name>rsvd</spirit:name>
<spirit:bitOffset>16</spirit:bitOffset>
<spirit:bitWidth>16</spirit:bitWidth>
<spirit:access>read-only</spirit:access>
<spirit:vendorExtensions>
<cadence:extensions>
<cadence:accessPolicy type="xPolicy_pkg:my_access_field" >
<!-- add the xPolicy element for that field here-->
<cadence:attribute
cadence:name="NO_REG_ACCESS_TEST" cadence:type="bit">1
</cadence:attribute>
</cadence:accessPolicy>
</cadence:extensions
</spirit:vendorExtensions>
</spirit:field>
package xPolicy_pkg;
import uvm_pkg::*;
`include "uvm_macros.svh"
import cdns_uvmreg_utils_pkg::*;
bit no_factory = 0;
//////////////////////////////////////////////////////
// Custom xPolicy
//////////////////////////////////////////////////////
class my_access_field extends uvm_reg_field;
`uvm_object_utils(my_access_field)
local bit is_locked = 0;
local static bit m_wres = define_access("my_access_field");
function new(string name = "my_access_field");
super.new(name);
endfunction
virtual task pre_write(uvm_reg_item rw);
// Prevent the write if the reg is_locked
// please note that the comparison of the value needs more logic
if (is_locked && rw.value[0]==value && rw.value.size()==1) is_locked=0;
else if(!is_locked) is_locked=1;
else rw.value = '{value};
endtask
virtual function void reset(string kind = "HARD");
super.reset(kind);
is_locked=0;
endfunction
endclass
endpackage
You must also add the custom policy declaration to the compile flow before the register data base
so that the data can refer to the custom field type. For example:
xrun -uvmhome default ./xPolicy_pkg.sv ./cdns_uvmreg_utils_pkg.sv \
./cdns_uvmreg_rdb.sv ./quicktest.sv -vclass_ext +UVM_TESTNAME=qt_test
Verification Properties
In case of a specification inside a register file, the coverage directive will be applied to all enclosed
register files and registers.
Example
<cadence:extensions>
<cadence:collectCoverage Cadence:accessMode="READ"/>
</cadence:extensions>
Example
<spirit:field>
<spirit:name>Field1</spirit:name>
<spirit:access>read-write</spirit:access>
<spirit:modifiedWriteValue>modify</spirit:modifiedWriteValue>
<spirit:readAction>modify</spirit:readAction>
<spirit:vendorExtensions>
<cadence:extensions>
<cadence:accessBehavior>VERY_SPECIAL</cadence:accessBehavior>
</cadence:extensions>
</spirit:vendorExtensions>
</spirit:field>
The example shows a register modeled with a UVM access mode UM (read-able). It shall behave
according to a user defined scheme called VERY_SPECIAL. It is the user's responsibility to make
sure that the register access behavior VERY_SPECIAL is encoded in the VE, because Register
Verifier cannot implement the required update/checking code; it does not follow standard
update/checking modes.
Example
<cadence:extensions>
<cadence:xPolicy classname=”my_policy”/>
</cadence:extensions>
Register field
There is some 'inheritance', meaning that a register field inherits the access right from its enclosing
container if (a) the register field has no access rights set and (b) the enclosing container has it set.
IP-XACT defines three more child entities on a register field that are used to determine access right
or "behavior".
<spirit:modifiedWriteValue/>
<spirit:readAction/>
<spirit:testable/>
The combination the register access value and those three child elements on a register field allow
modeling of UVM register access modes as follows. Within the table the value "unspecified" refers
to a situation where the property is not provided in the IP-XACT file.
NOTE: The following table is relevant for UVM e only. For details relevant to UVM SV, see the
tables in Section 5.5.1.4 “IP-XACT Field Access Mapping” in the Accellera Universal Verification
Methodology (UVM) User’s Guide.
For description on the UVM access modes, see the description ofset_access in the Accellera
Universal Verification Methodology (UVM) Class Reference.
where two different packages, my_pkg1 and my_pkg2 , can be complied and simulated together.
To generate multiple invocation using -multi_invocation , you need to:
Compile the centrally
located cdns_uvmreg_utils_pkg in <xcelium_install>/sia/lib/sv/cdn_reg/utils/cdns_uvmreg
_utils_pkg.sv file.
For every database/snapshot you create and want to use in the uvm_test or uvm_env classes,
add the call to cdns_uvmreg_utils_pkg::setup() before registering
(register_model/top_level_block).
To call the setup function, you need to provide the following details:
cdns_uvmreg_utils_pkg::setup("<path_to_config_files>", <package_name>::factory, "
<prefix_name_of_config_files>");
where,
<path_to_config_files> - Path to the generated config files(*.dat)
<package_name> - Package name generated in the rdb file that contains the register model
classes
<prefix_name_of_config_files> - Prefix name of the generated files. This name is the same
as that you use with the reg_verifier option “-out_file” at the time of generation.
Consider the given example of the testbench where setup function is called:
cdns_uvmreg_utils_pkg::setup("./",my_pkg1::factory,"my_files_1");
model0 = my_pkg1::APB_SUBSYTEM_regs_uvm_reg_ex_version_1_4::type_id::create
("model0",this);
model0.build();
model0.lock_model();
cdns_uvmreg_utils_pkg::setup("./",my_pkg2::factory,"my_files_2");
model1 = my_pkg2::AHB_SUBSYTEM_regs_uvm_reg_ex_version_1_4::type_id::create
("model1",this);
model1.build();
model1.lock_model();
.....
You can also have a look at the example by generating the test using the-quicktest option along
with the -multi_invocation option.
Limitations:
Name collisions:
For multi invocation, you need to make sure of the name collisions of register model classes
by checking the input of reg_verifier .
You need to ensure that the type names are different. If they are not different, you need to
generate the multi-invocation code with the -no_uvm_factory reg_verifier option. This does
not generate any errors at the time of compilation and simulation.
Location
The location of Register Verifier (“reg_verifier”) is:
<Xcelium_install_dir>/tools/tti/bin/reg_verifier. The old register generator iregGen is also
present in the same old location and will be continuing to ship until all its features are in Register
Verifier.
Input XML
Register Verifier supports 1.2, 1685-2009, 1.4 and 1.5 IP-XACT input formats. Note that the input
XML is always validated whenever it is given to Register Verifier, whereas input validation is done
separately (if requested) in iregGen. In the input XML, the schema location is changed slightly for
Register Verifier from that for iregGen. The component root node for Register Verifier is:
<spirit:component
xmlns:spirit="http://www.spiritconsortium.org/XMLSchema/SPIRIT/1685-2009"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cadence="http://www.cadence.com/SPIRIT/1685-2009/vendorExtensions"
xsi:schemaLocation="http://www.spiritconsortium.org/XMLSchema/SPIRIT/1685-2009
http://www.spiritconsortium.org/XMLSchema/SPIRIT/1685-2009/index.xsd">
Register Verifier always validates the XML using the above component root node, whenever it is
executed. So the user must always ensure that the header is correct.
Vendor-Extensions
Vendor extensions have been encapsulated in a "cadence:extensions" container in order to check
it. Previously in iregGen vendor-extensions format was:
<spirit:vendorExtensions>
<vendorExtensions:hdl_path>dut</vendorExtensions:hdl_path>
</spirit:vendorExtensions>
<spirit:vendorExtensions>
<cadence:extensions>
<cadence:hdlAccess>dut</cadence: hdlAccess>
</cadence:extensions>
</spirit:vendorExtensions>
Comparing vendor-extensions of Register Verifier to iregGen, one of the following scenarios might
happen:
iregGen had a vendor extension whereas there is native support in IP-XACT. For this
scenario, in Register Verifier, the vendor extension has been removed and user currently
needs to migrate to IP-XACT native. Such scenarios are:
Type Names
In iregGen, type names of the components were supported using "vendorExtensions:type".
For details on Register Verifier vendor-extensions, see Cadence IP-XACT Vendor Extensions for
Register Verifier.
There are other vendor-extensions which are not yet supported in Register Verifier but which were
supported in iregGen. They are rawConstraint, rawCode, is_fifo_with_depth, indirect_addr_reg,
indirect_areg_reg, constraint, attribute. These vendor-extensions will have a new name when
supported in Register Verifier.
Commmand-Line
Once the input XML is ready for Register Verifier, the next step is that user should identify the top
level component name in the input XML that is to be mentioned in command-line.
There are many options in Register Verifier for generating a register model (see Running Register
Verifier and the Register Verifier Demo).
Some options for generating are mandatory:
"-top" - Input XML file name.
"-dut_name" - Top level component name.
"-domain uvmreg" - For generating UVM register model.
Using these options, the user can generate a UVM register model.
For example:
reg_verifier -top my_env.xml -domain uvmreg -dut_name apb_system -quicktest
Generation is internally divided. First, the input XML is validated using XML schema. Then, the
XML data is parsed and the register model is generated in an output directory (default:
"reg_verifier_dir"), as follows: The "uvmreg" directory is automatically created within the output
directory, and the register model files are generated in the uvmreg directory.
Output
The generated output contains following files:
reg_verifier_dir/uvmreg/cdns_uvmreg_config.dat . Configuration file listing the configuration
of all Register Model components.
reg_verifier_dir/uvmreg/cdns_uvmreg_hdlpaths.dat . All hdl_path definitions of all Register
Model components.
reg_verifier_dir/uvmreg/cdns_uvmreg_rdb.sv . All classes of the Register model components
generated in Register Model file.
reg_verifier_dir/uvmreg/cdns_uvmreg_utils_pkg.sv. Package file containing all utilization
functions and structures.
To test the generated files, the user can generate the quicktest as follows:
1. Adding "-quicktest" option in the reg_verifier command-line option.
mltypemap Examples
The following sections contain simple, runnable examples for mltypemap. The examples are
divided into sections based on the three source languages (e, SystemVerilog, or SystemC) and
show how to convert to each of the other two:
Mapping from e
Mapping from e to SystemVerilog
Mapping from e to SystemC
Mapping from SystemVerilog
Mapping from SystemVerilog to e
Mapping from e
This section shows how to convert frome to either SystemVerilog or SystemC, using three files:
run_mltypemap.sh— Invokes xrun with the mltypemap option, and specifies a Tcl run file
and e input file
test.e — The e source file. Its types will be mapped to either SystemVerilog or SystemC.
do.tcl — The configuration file, specific for each output language.
Configures mltypemap using the configuration commands described in Configuring
mltypemap
Invokes the mapping process using the maptypes command described inInvoking
mltypemap
The mapped type is msg. It is mapped along with its two subtypes big_msg and small_msg.
File: run_mltypemap.sh
xrun \
-mltypemap_input do.tcl \
test.e
File: test.e
<'
package dt;
type kind_t : [GOOD, BAD];
struct msg {
kind : kind_t;
!top_unit : any_unit; // pointer to unit - do not map
};
struct big_msg like msg {
private counter : int; // note: private fields are not mapped by default
data : list of byte;
};
File: do.tcl
Output Files
The output of the xrun command for the SystemVerilog target language is three files, with base
name sv_dt:
File: do.tcl
Output Files
The output of the xrun command for the SystemC target language is three files, with base
name sc_dt:
sc_dt.h—Contains the types definitions in SC.
sc_dt.cpp—Contains implementation of UVM member functions for the mapped types.
sc_dt_ser.e—Contains serialization configuration code for e.
File: run_mltypemap.sh
xrun \
-uvm \
-mltypemap_input do.tcl \
test.svh
File: test.svh
`ifndef TEST_SVH
`define TEST_SVH
`include "uvm_macros.svh"
package dt;
import uvm_pkg::*;
class data extends uvm_object;
bit [63:0] addr;
byte bytes[];
int do_not_map_me;
`uvm_object_utils_begin(data)
`uvm_field_int(addr,UVM_ALL_ON)
`uvm_field_array_int(bytes,UVM_ALL_ON)
`uvm_field_int(do_not_map_me,UVM_ALL_ON)
`uvm_object_utils_end
function new (string name="data");
super.new(name);
endfunction
endclass : data
File: do.tcl
Output Files
The output of the xrun command for the e target language is five files, with base name sn_dt:
File: do.tcl
# map the scope dt to sc_dt
configure_scope -scope sv:dt -to_scope sc_dt
Output Files
The output of the xrun command for the SystemC target language is three files, with base
name sc_dt:
sc_dt.h—Definitions of mapped types in SC.
sc_dt.cpp—Implemenation of UVM member methods in SC.
sc_dt_ser.sv—Contains serialization code for SV.
File: run_mltypemap.sh
xrun \
-uvm \
-mltypemap_input do.tcl \
test.cpp \
-sysc \
-compile
File: test.cpp
#include "test.h"
namespace dt {
packet::packet() {}
packet::~packet() {}
void packet::do_print(ostream& os) const {
os << "packet = " << name << endl;
}
void packet::do_pack(uvm_packer& p) const {
p << addr << name << data;
}
void packet::do_unpack(uvm_packer& p) {
p >> addr;
p >> name;
p >> data;
}
void packet::do_copy(const uvm_object* rhs) {
const packet* drhs = DCAST<const packet*>(rhs);
if (!drhs) { cerr << "ERROR in do_copy" << endl; return; }
addr = drhs->addr;
name = drhs->name;
data = drhs->data;
}
bool packet::do_compare(const uvm_object* rhs) const {
const packet* drhs = DCAST<const packet*>(rhs);
if (!drhs) { cerr << "ERROR in do_compare" << endl; return true; }
return
addr == drhs->addr &&
name == drhs->name &&
data == drhs->data;
}
}
File: test.h
#ifndef PACKET_H
#define PACKET_H
#include "ml_uvm.h"
using namespace uvm;
namespace dt {
class packet : public uvm_object {
public:
// use macro to generate necessary methods that factory needs
UVM_OBJECT_UTILS(packet)
packet();
virtual ~packet();
// implement mandatory pure virtual methods
virtual void do_print(ostream& os) const;
virtual void do_pack(uvm_packer& p) const;
virtual void do_unpack(uvm_packer& p);
virtual void do_copy(const uvm_object* rhs);
virtual bool do_compare(const uvm_object* rhs) const;
public:
sc_int<64> addr;
std::string name;
std::vector<sc_int<8> > data;
};
// register the data object with the factory
UVM_OBJECT_REGISTER(packet)
}; // namespace dt
#endif
Mapping SystemC to e
File: do.tcl
# configure the scope
configure_scope -scope sc:dt -to_scope sn_dt
File: do.tcl
# configure the scope
configure_scope -scope sc:dt -to_scope sv_dt
Invoking mltypemap
mltypemap is a TCL-based tool that is invoked from xrun. When you invoke mltypemap, you must
enter the appropriate mltypemap-related flags plus all the compilation flags necessary for xrun to
compile the files and elaborate the snapshot (in the case of SystemVerilog inputs).
When you invoke mltypemap, xrun performs the following steps:
1. Compile all the source files.
NOTE: When working with SystemC input, the input file must be a single CPP file and the
argument -sysc has to be given. More than one input file is currently not supported for
SystemC.
2. Elaborate the design (in case of SystemVerilog).
3. Invoke mltypemap and display its TCL prompt.
4. Abort.
This section contains the following information:
xrun Arguments for Invoking mltypemap
xrun Examples
xrun Arguments
Argument Description
- Identifies the name of an input file that contains TCL commands for
mltypemap_input mltypemap. Typically this file contains mltypemap configuration
input-file commands and one or more mltypemap map commands.
xrun Examples
To invoke xrun with e files:
xrun -mltypemap_input do.tcl file.e
NOTE: Refer to the Xcelium Simulator Reference for information about xrun options such as -
compile and -sysc.
maptypes Command
Syntax
maptypes -to_lang lang -from_type type-name -base_name base-name
Syntax example
maptypes –to_lang sv –from_type e:ahb::ahb_packet –base_name ahb_datatypes
Parameters
Parameter Description
-to_lang The name of the target language. The accepted language names are:
lang
e (or sn)
sv
sc
The language names are case insensitive. This parameter is mandatory and can
be repeated.
NOTE: When types are mapped to two or more target languages, Cadence
recommends doing so in a single invocation.
-from_type The name of the source type. The type-name must be the full name (including
type-name package/namespace qualifiers) and must contain the language prefix (e, SV,
SC).
This parameter is mandatory and may repeat. Examples:
-from_type e:my_pkg::my_struct
-from_type sv:package1::my_data_item
- The base name for the output files. This parameter is mandatory.
base_name The base name can contain a directory path to a folder. For example:
base-name
-base_name my_types
-base_name my_dir/my_dt
Description
As described above, you use the mltypemap TCL command maptypes to invoke the mapping
process.
Note that the input to mltypemap must be a type defined inside a package, and, therefore, its name
must be qualified with the package name:
In e, all types that are not defined explicitly inside a package, are defined inside the package
“main”. To map such a type, the “main” qualifier has to be used (for example, -from_type
e:main::packet).
In SystemVerilog, only types defined inside a package are supported. Types defined inside a
module, or types defined inside the compilation scope are not supported.
In SystemC, types should be defined in namespace, or in the global namespace. Types
defined inside classes are currently not supported.
Example
The following command generates type definitions in SystemVerilog for the e type ahb_packet:
NOTES:
Four-value scalars are not supported, and an error is given if a field on such a type is passed.
When the input language is SystemVerilog, mltypemap can be configured to map four-value
scalars as two-value scalars, the configuration can be done globally using configure_code -
lang sv -map_all_as_2value, or per field using configure_field option -map_as_2value . See
also configure_field Command and configure_code Command.
When mapping scalars of size 8,16,32, or 64 bits to SystemC, the mapping can be controlled
using configuration option -use_cpp_type or -use_sc_type . See also configure_field
Command.
e SystemVerilog SystemC
struct packed struct Not supported Supported only when mapping from
SV to e. When mapping from e to
struct unpacked struct Not supported
Not supported unpacked array Not supported Mapping SC/SV static array is not
supported.
See comment See comment See comment Named events are ignored; no error
is generated.
Example:
event e;
Mapping Classes
A class is mapped by mapping all its fields. By default, the mapped fields are the public, non static
fields.
When a class is mapped, all its subtypes are mapped as well. Also, the parent classes of this class
are mapped. By default, the name of the mapped class is as the name of the source class.
You can change the default settings with the configure_type command (seeconfigure_type
Command).
Mapping a Field
A field is mapped into a corresponding field in the target language. The default name of the field is
its source name. The access level (private/local, protected or public) of the field is the same access
level as the source field.
By default, only public, non static fields are passed. The mapping of a field can be configured using
the configure_field command. (see configure_field Command).
When a non-public field is passed, you can specify the setter/getter methods for the source field, as
well as for the target field.
Limitation: Setters/getters are not supported in the current release.
Static Fields
By default, static fields are not mapped. Mapping of static fields is not supported, and a run-time
error is given if a static field is configured to be passed.
Randomization Modifier
“rand” or “randc” fields in SystemVerilog are mapped to a generated field ine. Generated fields
in e are mapped to “rand” field in SV.
SystemVerilog types defined inside a module or defined inside the compilation scope are not
supported.
This command causes mltypemap to generate a SystemVerilog adapter configuration file ine.
pre_generate() is also {
associate_struct(“vr_ahb::my_struct”,”sv_vr_ahb::my_sv_struct”,{“opcode”;”addr”});
};
where:
The first parameter: vr_ahb::my_struct is the e type.
As noted in SystemVerilog Adapter Configuration Generation, mltypemap can generate the adapter
configuration code as part of the type conversion process. In this case,
the associate_struct() code will be generated.
NOTE: You must instantiate the adapter configuration struct in youre environment.
//sv_types.svh
package sv_types;
import uvm_pkg::*;
`include "uvm_macros.svh"
typedef struct {
bit [7:0] opcode;
bit [15:0] addr;
} sv_data;
`uvm_object_utils_begin(sv_trans)
`uvm_field_int(trans_id, UVM_ALL_ON)
`uvm_object_utils_end
endclass // sv_trans
endpackage // sv_types
The first Tcl command-line configures mltypemap to generate adapter configuration code that will
be used to configure the method port.
The second Tcl command performs the actual code generation.
The final step is to instantiate the adapter configuration under the unit that contains the UVM
method ports.
//sn_dt_sv_types.e
<'
package sv_types;
//------------------------------------
//Source: SystemVerilog
//Source type: sv_types::sv_data
//Source Location: sv_types.svh:10
struct sv_data {
!%opcode : byte;
!%addr : uint(bits:16);
}; // end struct sv_data
//----------------------------------
//Source: SystemVerilog
//Source type: sv_types::sv_trans
//Source Location: sv_types.svh:12
struct sv_trans like any_sequence_item {
!%trans_id : int;
!%trans : sv_data;
}; // end struct sv_trans
'>
// sn_dt_adapter_config.e
<'
unit sn_dt_adapter_config like sv_adapter_unit {
post_generate() is also {
associate_class("sv_types::sv_trans",
"sv_types::sv_trans",{"trans_id";"trans"});
associate_struct("sv_types::sv_data",
"sv_types::sv_data",{"opcode";"addr"});
};
};
'>
In this case, the struct packet has two when subtypes, "BIG packet" and "SMALL packet". By
default, all fields defined under when will be flattened into the type packet, and their default names
will be "BIG__data" and "SMALL__data".
If a struct in e contains a field whose type is a when subtype, this field is mapped to a field whose
type is the base type of the when subtype. For example:
struct data {
rp : RED packet;
};
In this case, the mapped type of “data” will have a field whose type is the mapped type of “packet”,
not of “RED packet”. For example, if the target language is SV, then:
class data {
packet rp;
};
package user_pkg;
type packet_kind : [BIG,SMALL];
struct packet {
kind : packet_kind;
when BIG packet {
data: byte;
};
when SMALL packet {
data : int(bits:100);
};
};
Suppose further that you would like to skip the field "SMALL'packet.data". The proper command
would be:
configure_type -type "e:SMALL user_pkg::packet" -skip_field data
You can use the command configure_type to configure the mapping of the enum type and the
command configure_enum_item to configure the mapping of the enum items themselves. (See
configure_type Command and configure_enum_item Command.)
Example
Given the following enum in e:
type color : [RED = 10; GREEN = 20 ; BLUE = 30];
Mapping Typedefs
For a source typedef, a target typedef is created. You can use the commandconfigure_type to
configure the mapping of the typedef, specifically the target’s name. (See the configure_type
Command.)
Notes
Specman only supports numeric typedefs. If the output language ise, all non-numeric
typedefs (to classes or aliases for other types) are not created. The underlying types are
used instead.
Typedefs defined inside a class scope are created in the target language inside a namespace
with the class’s name, and not inside a class scope.
Example
Given the following typedef in SystemVerilog:
typedef bit signed[17:0] int18;
Example
Given the following queue in SystemVerilog:
rand byte unsigned f8[$];
Configuring mltypemap
This section describes the TCL API for mltypemap configuration. The configuration commands are
usually written before the maptypes command. When maptypes command is invoked, it will apply
all the configuration commands to the built types. If a configuration command was not applied to
any instance, a non-fatal error is given. Cadence recommends looking for these errors because
they might indicate typos in the configuration commands.
There are four configuration commands used to configure type-related entities: configure_scope,
configure_type, configure_field, and configure_enum. The configure_code command is used
for global configuration regarding the generated code. In addition, there is a print_type command
that can be used to get information about types and the configuration commands applied to them.
For some configuration properties, sub-matches can be used to set the new value of the
configuration. This is done by using $0,..,$9 in the appropriate property, and by adding () to group
the sub-matches in the regular expression (where $0 refers to the full match).
For example, to map all fields of type packet starting with sv_ to start with sn_, the following
command can be given:
configure_field -type sv:sv_ahb::packet -field {/^sv_(.*)/} -to_name {sn_$1} …
For simple regular expressions containing only the expression for any number of characters (.*),
the regular expression can be written as a wildcard (*), and without slashes. That is, the following
are equal:
-type e:/vr_ahb::my.*bus/
-type e:vr_ahb::my*bus
When a given property is reconfigured multiple times, the last configuration command wins and no
warning is given.
To get more information about the configuration, use theprint_type command, which prints the
configuration commands that have been applied to a given type.
This section describes the following commands:
configure_scope Command
configure_type Command
configure_field Command
configure_enum_item Command
print_type Command
configure_code Command
configure_scope Command
Syntax
configure_scope -scope scope-name-or-regex -to_name field-name
Syntax Example
configure_scope -scope e:vr_ahb -to_name cdn_ahb
Parameters
Argument Description
-scope scope- Name of source scope. This name should include the language prefix. For
name-or-regex example: -scope e:vr_ahb
-to_name field- The name of the target scope. This name can contain $0..$9 to refer to the
name sub-matches of the scope-name-or-regex.
Description
This command should be used to configure properties of a scope (only its target name).
Note that a scope of a type can be defined usingconfigure_scope or configure_type. If both
commands are relevant for a specific type, then the configure_type command takes effect,
because it is more specific.
configure_type Command
Syntax
configure_type
-type source-type-name-or-regex
-skip_field field-name-or-regex
-pass_field field-name-or-regex
-to_name name
-to_scope scope-name
-use_existing
-skip_type
Syntax Example
configure_type –type e:vr_ahb::ahb_burst -skip_field driver \
-skip_field parent_unit -to_name AhbBusrt
Parameters
Parameter Description
-type source- Name of the source type. This name should be qualified and must include the
type-name- language prefix. For example:
or-regex -type sv:cdn_ahb::ahb_burst
-skip_field Name of a field to be skipped. This parameter can be repeated for several
field-name- fields and a regular expression can be used. This should be used to tell
or-regex mltypemap to skip fields which are passed by default.
-pass_field Name of field to be passed. The parameter can be repeated for several fields
field-name- and a regular expression can be used. This should be used to tell mltypemap
or-regex to pass fields which are skipped by default.
-to_name Target name of the type. The target name should be the simple, non qualified
name name. For example, “-to_name packet”. Note that this name can contain $0..$9,
which refer to sub-matches in the source-type-name-or-regex.
-to_scope Name of the scope where the type has to be defined. By default, the target
scope-name scope is the same as the scope of the source type. Note that the scope can be
set also using the configure_scope command; in this case, the configure_type
command wins since it is more specific.
- Tells mltypemap to not generate a type definition for this type, but rather to use
use_existing the existing definition. mltypemap assumes that this type already exists with the
name as given with -to_name . This configuration should typically be used to
support consecutive invocations of mltypemap, for example, if part of the
hierarchy was already generated by previous invocation.
-skip_type Tells mltypemap to skip this type. Relevant only if this type has to be generated
as a subtype of a parent type. In this case, the type and all its subtypes will be
skipped. This configuration should be used if a sub-hierarchy of a mapped
class is not relevant for ML communication.
Description
Use this command to configure properties of an exported type. The-type argument should be used
to describe the source type. The other parameters are used for the configuration itself.
See Also
Referencing when Subtypes in Configuration Commands
configure_field Command
Syntax
configure_field
-type source-type-name-or-regex
-field field-name-or-regex
-to_name field-name
-norand | -rand | -randc
-public | -protected | -private
-pack | -nopack
-print | -noprint
-compare | -nocompare
-copy | -nocopy
-dec | -hex | -bin
-to_cpp_pointer
-use_cpp_type | -use_sc_type
-map_as_2value
-map_as_longint
-map_as_queue
Syntax Example
configure_field –type sv:vr_axi::axi_packet -field data \
-to_name AxiData -nopack -hex
Parameters
Parameter Description
-type source- Name of source type. This name should be qualified and should include the
type-name-or- language prefix. The name can contain regular expressions. For example:
regex -type sv:cdn_axi::axi_packet
-to_name field- The target name of the field. This name can contain $0..$9 to refer to sub-
name matches in field-name-or-regex.
-norand | -rand | Controls the randomization type of the target field. Relevant only if target is
-randc e or SystemVerilog. The default is the same as the source field.
-pack | -nopack Controls whether this field should be part of the packing.
Default is -pack.
-print | -noprint Controls whether this field is printed. Has no affect if the target language is
e.
Default is -print.
-compare | - Controls whether this field should be part of the comparing. Has no affect if
nocompare the target language is e.
Default is -compare.
-copy | -nocopy Controls whether this field should be part of the copying. Has no affect if
the target language is e.
Default is -copy.
-dec | -hex | -bin Sets the radix for this field. Has no effect if the target language ise.
-to_cpp_pointer Relevant when the target language is SystemC. Indicates that the field
should be mapped into pointer in C++.
-map_as_queue Instructs mltypemap to map the specified field from a SystemC vector or an
e list into a SystemVerilog queue. Relevant only when the-lang is SV.
(This flag does not affect fields that are not part of a SystemC vector or an
e list.)
Note that the mapping to SystemVerilog queues can be done globally using
the configure_code -map_all_as_queue command. When -
map_all_as_queue is specified, this option has no impact.
Description
Use this command to configure properties of an exported field. The-type and -field parameters
should be used to describe the source field. The other parameters are used for the configuration
itself.
See Also
Referencing when Subtypes in Configuration Commands
configure_enum_item Command
Syntax
configure_enum_item
-type source-type-name-or-regex
-item enum-item-name-or-regex
-to_name enum-item-name
Syntax Example
configure_enum_item –type sv:vr_ahb::color –item RED –to_name AHB_RED
Parameters
Parameter Description
-type source- Name of source enumerated type. This name should be qualified and should
type-name-or- include the language prefix. The name can contain regular expressions.
regex
-item enum- Name of the source enumerated item. This name can contain regular
item-name-or- expressions.
regex
-to_name The target name of the enumerated item. The target name can contain
enum-item- $0..$9 refer to sub-matches in the enum-item-name-or-regex.
name
Description
Use this command to configure the target name of an enumerated type item. The-type and -item
parameters should be used to describe the source item.
print_type Command
Syntax
print_type -type source-type-name-or-regex
Syntax Example
print_type -type sv:vr_ahb::burst
Parameters
Parameter Description
-type source-type- Name of type to be printed. The name can contain regular
name-or-regex expressions. This argument can be repeated.
Description
Print information about a specific type or types. The command prints basic information about the
type, plus its configuration properties (if any configuration has been applied to the type).
See Also
Referencing when Subtypes in Configuration Commands
configure_code Command
Syntax
configure_code
-lang SV | SC | SN | e
-header_code code
-gen_adapter_config
-adapter_config_name adapter-config-unit-name
-ovm | -uvm
-unilang | -uvm_ml_oa
-map_all_64bit_as_longint
-map_all_as_2value
-map_all_as_queue
-only_physical_fields
-skip_unsupported_type
Syntax Example
configure_code -lang sv -header_code {`include "my_kind_pkg.svh"}
Parameters
Parameter Description
-header_code code Instructs mltypemap to add the code at top of the generated
header code.
-pass_field <field name> This field is mapped even if -only_physical_fields is used and
the field is not physical.
Description
Use this command for general configuration of the generated code.
The -header_code option is used to insert code into the generated header code. This is useful, for
example, when existing types are used and their header file has to be imported/included.
The -gen_adapter_config and -adapter_config_name options are used to instruct mltypemap to
generate adapter unit code for the e-over-SV flow. The generated adapter config code implements
the necessary logic to allow the mapped types to be passed between the source and target
languages through method ports.
The -unilang | -uvm_ml_oa option instructs mltypemap whether to generate code that is
appropriate for the standard Cadence UVM multi-language solution (UVM-ML OA) or the
deprecated UVM-ML solution. The -unilang option is deprecated and should not be used.
The -map_all_64bit_as_longint option instructs mltypemap to map all SystemVerilog and
SystemC 64-bit scalars as e longint. Unsigned scalars are mapped to e longuint. Note that this can
be configured also per-field using the configure_field -map_as_longint command. Note, however,
that when the global configuration is given, the per-field configuration has no impact.
The -map_all_as_2value option instructs mltypemap to map all four-value scalars as two-value
scalars. Note that this can be configured also per-field using the configure_field -map_as_2value
command. Note, however, that when the global configuration is given, the per-field configuration
has no impact.
The -map_all_as_queue option instructs mltypemap to map all SystemC vectors and e lists as
SystemVerilog queues. Note that this can be configured also per-field using the configure_field -
map_as_queue command. Note, however, that when the global configuration is given, the per-field
configuration has no impact.
The -only_physical_fields instructs mltypemap to map only physical fields from Specman to
SystemVerilog or SystemC. Consider the given example that -only_physical_fields maps only
physical fields, except the field f4 of inner struct:
configure_code -only_physical_fields
configure_type -from_type e:dt::inner -pass_field f4
The -skip_unsupported_type option causes mltypemap to continue its type mapping process and
recover from mapping errors encountered. Erroneous types and fields will be skipped. The user
can use the generated output to analyze and fix the errors.