UVM寄存器模型(一) —— ralgen脚本

本文详细介绍了如何使用ralgen脚本来生成UVM中的寄存器模型,包括ralgen的命令行选项,如-ttopname、-Idir、-uvm等,以及如何生成覆盖率模型和HTML文档。同时,提到了ralgen-full64-h命令用于查看帮助信息。
摘要由CSDN通过智能技术生成


前言

ralgen是VCS工具自带的脚本,用于uvm中生成寄存器模型,本文主要介绍uvmgen脚本。首先,介绍在uvm中,利用ralgen脚本,生成寄存器仿真模型RAL model的命令;然后,列出了ralgen -full64 -h帮助中的内容,供查阅。


一、uvm寄存器模型的生成命令

生成RAL model的命令:
ralgen [options] -t topname -I dir -uvm {filename.ralf}

  • -t topname
    RALF文件中顶层模块或者系统的名称,生成的RAL model文件名称为ral_topname.sv
  • -I dir(注意是i的大写,不是L的小写)
    ralgen搜索源文件的可选目录列表
  • -uvm
    声明是UVM方法学
  • filename.ralf
    .ralf后缀不是必须的。对于多个文件的情况,指定顶层的RALF文件,在这个文件通过source来包含其他文件。

options

  • -all_fields_rand
    允许你配置所有可写字段为rand (is_rand_bit设置为1),而不需要指定约束块。生成的代码只标记字段,默认情况下这些字段的约束定义为rand。
  • -b
    为声明了完整hdl_path的reg和mem生成后门访问代码
  • -B, gen_byte_addr
    生成具有字节级地址粒度的RAL模型。
  • -c a
  • -c b
  • -c f
    -c表示覆盖率coverage,上面三个依次表示“Address Map” “Register Bits” “Field Values”功能覆盖率模型。
  • -c s
    为只读bit位生成单独的仓,以便为ralgen生成的bit级覆盖,读取只读寄存器的1和0。在-c s选项旁边指定-c b选项会导致错误。
  • -e
    为每个抽象类生成空约束
  • -f < filename >
    在一个文件里声明ralgen选项
  • -gen_html
    生成RAL模型及其HTML UVM文档。它的相关文件被转储到ral_top_path_name_doc目录下。如果指定此选项而没有使用-uvm选项,则会出现错误。
  • -top_macro < string_which_overrides_default_macro >
    允许您使用不同的宏而不是name_TOP_PATH来指定对应于RAL模型的DUT实例的绝对路径。

二、ralgen -full64 -h 帮助命令

通过ralgen -full64 -v和ralgen -full64 -h这两个命令,可以查看ralgen的版本和帮助,具体内容如下,供查阅。

hefei@ubuntu:~/Desktop/proj/top_env/run$ ralgen -full64 -v
ralgen version 1.17.0 (Requires RAL Version 1.16.0 or above)
hefei@ubuntu:~$ ralgen -full64 -h

Usage:
======
ralgen -h
ralgen -v
ralgen -l <lang> [-gen_c] -t <top> -f <file> [-top_domain <domainname>] [-B|-gen_byte_addr] [-I <dir1>:...:<dirN>] [(-e|-ext_ud)] [-b [-p <top_path>] -gen_vif_bkdr] [-q] [-qf <pattern_file>] [-R <dirname>] [-no_bkdr_cb] [-gen_html] <RALF-file>
ralgen -ipxact2ralf <ipxact-file>

Where
       <lang>                   = Target Language. Currently, supported are 'sv', 'ov' and 'c'.
       <top>                    = Name of top-level block/system
                                  of your RALF spec.
Options:
        -h          : prints this help message.

        -v          : prints ralgen version info.

        -t  topname : name of top-level block or sytem in the RALF file

        -f  file    : A file containing different ralgen options

        -l  sv|ov|c : specifies target language of the RAL Model.

        -uvm        : generates UVM RAL model.

        -o fname    : Output file name. By default, uses ral_topname.
                      A language-appropriate suffix will be automatically appended.

        -g, -gen_c  : generates C interface to the RAL model. Invalid with <lang> == 'c'.
                      Not yet supported.

        -b          : triggers/activates backdoor code generation.
                      By default, backdoor code is not generated.

        -gen_vif_bkdr
                    : Generates backdoor access using virtual interface reference.
                      This option can only be used with option '-b'.

        -no_vif_self_inst
                    : Omits generating initial block inside interface for self registering.
                      This option can only be used with option '-gen_vif_bkdr'.

        -c  b|s|a|f|F : generate the specified coverage models.
                        b: bit-level, generates single bin for 1/0 for RO bits
                        s: bit-level, generates separate bins for 1/0 for RO bits
                        a: address map
                        f: field values, only if 'cover +f' is specified in RALF spec
                        F: field values, even if 'cover +f' is not specified in RALF spec
                      'b' and 's' coverage models cannot be specified at the same time
                      Other combination of coverage models can be specified at the same time

        -single_plan
                    : generate the hvp as single plan.
        -q          : executes ralgen in quiet mode where all warnings are
                      suppressed.

        -qf <pattern_file>
                    : This option can be used whenever user wants to ignore a 
                      bunch of known (kind of accaptable for a given RALF) 
                      command line messages (typically used with warning messages).
                      <pattern_file> will need to contain the list of messages (1 per line)
                      or regular expressions (supported by egrep) of the list of 
                      messages (1 per line) that should not be showed by ralgen.

        -e, -ext_ud : Add undefined (external) constraint declarations in block and system classes.

        -I <dir1>:...:<dirN>
                    : list of folders to sequentially search 'source'd RALF files.

        -flds_out_reg  all | none | no_uniq:
                    : controls the field handle generation in blocks.
                        all : generates all field handles in blocks (same as not providing -flds_all_reg)
                        none : generates no field handles in blocks
                        no_uniq : generates no field handles for uniquely named in blocks
        -d, -top_domain
                    : When the <top>-level block/system has multiple domains, 
                      you must specify the top level domain name for which you need to 
                      generate RAL C Model/Interface. Note: This option is valid only when 
                      RAL C Model/Interface is generated.

        -p <top_path>, -top_path <top_path>
                    : Specifies the absolute top level XMR backdoor path of the DUT instance.
                      This switch is used only for supporting VHDL backdoor.

        -top_macro <top_macro>
                    : Specifies the top level macro to be used in backdoor access.
                      when -top_macro is not provided, ralgen uses <uppercase_topname>_TOP_PATH as the top level macro.

        -full64
                    : Executes ralgen in 64 bit mode.

        -R <RTL_dir_name>
                    : Specifies the directory in which RTL files will be generated.

        -B, -gen_byte_addr
                    : Generates RAL model with byte-level address granularity.

        -ipxact2ralf <ipxact-file>
                    : Generates RALF file from the specified IPXACT file.

        -no_bkdr_cb : With this option, backdoor pre/post_read/write callback invokation code
                      is not genereated. This option can only be used with option '-b'.

        -a, -auto_mirror
                    : Generate code required for automatic mirror update.

        -gen_html   : Generates HTML doc for the register model.
                      This option can only be used when generating UVM RAL model.


总结

ralgen脚本用来生成uvm中的寄存器模型,本文主要介绍了ralgen脚本的用法。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值