• how to set interface arrays : Illegal index into array of interfaces


    error information

    Illegal index into array of interfaces

     

    the reason 

    link 

    http://forums.accellera.org/topic/677-ies-102-using-config-db-to-set-array-of-interfaces/
     

    https://forum.verificationacademy.com/forum/verification-methodology-discussion-forum/uvm-forum/24462-setting-array-interfaces-uvm-config-database
    copy as

    The problem is that an array of instances (module, interface, or program), is not the same as an aggregate data type you know as an array variable. An array variable is a collection of identically typed elements.

    With an array variable, you know what arrayvar[1].somthing refers to is identical in definition to arrayvar[2].something, except that is located somewhere else memory. You can simply multiply the variable index value by some constant value to find the offset in memory where it is located.

    An array of instances is just a shortcut for declaring a set of numbered instances. Because of Verilog generate and parameter overrides statements, with an array of instances, you don't necessarily have a regular array. It's possible what arrayinst[1].something refers to something completely different than what arrayinst[2].something does. So the compiler requires a constant index value to know what that particular something is. You typically use a generate/for_loop to do this.

     

    and please note

    What you need to do is pull the loop outside the initial block

    code snippet
    for(genvar i=0;i<N;i++) begin : for_loop 
    initial begin : config
    string if_name;
    $sformat(if_name, "IF[%0d]", i);
    uvm_config_db#(virtual my_if_type)::set(uvm_root::get(), "*", if_name, my_if[i]);
    end : config
    end : for_loop
  • 相关阅读:
    PHP 去除HTML标签 HTML实体转字符 br转
    PHP while使用
    js滚动条滚动到某个元素位置
    js按键监听
    用onerror处理图片获取失败问题
    windows 查看端口占用以及关闭该进程
    js获取当前时间戳 不需毫秒数
    escape,encodeURI,encodeURIComponent的区别
    php 获取中文长度 截取中文字符串
    将时间转换为xxx天前 xxx..前
  • 原文地址:https://www.cnblogs.com/testset/p/3447590.html
Copyright © 2020-2023  润新知