小编Aks*_*til的帖子

自动和静态任务之间有什么区别,为什么我们不能通过引用传递静态任务

静态和自动任务之间有什么区别.

program class_ref;
  int index,value;

 class holding_values;
   int ass_array[*];
   task assign_value (int value,int index);
       ass_array[index] = value;
   endtask 

   function void disp(int index);
       $display("%t  %M:ASSOSIATIVA VALUE%d ",$time,ass_array[index]);
   endfunction

endclass

initial begin
    holding_values  obc;
    index =5;
    value =88;
    obc = new();
    map(obc,value);
    obc.disp(index);
end


task map(ref holding_values obc,ref int value );
    value +=5;
    obc.assign_value(value,index);
    obc =null;
endtask

endprogram
Run Code Online (Sandbox Code Playgroud)

如果执行此代码,它将给出错误

参数参数在静态任务函数声明中是非法的

如果任务"map"自动运行程序.

为什么我们需要自动完成任务?静态和自动任务有什么区别?

system-verilog

5
推荐指数
2
解决办法
2万
查看次数

如何定义系统veriolg中的时间单位和时间精度

//`timescale 10ps/1fs
module time_presion();
    timeunit 100ps/10ps; //If We change this to 100ns/10ps it works fine
    parameter p=11.49;
    int a;
    initial begin
        $monitor("%t ,My values Changes %d",$time,a);
        #p a = 10;
        #p a = 30;
        #p a = 40;
        //#100us;
        #p a = 50;
        #1 $finish(1);
    end
endmodule
Run Code Online (Sandbox Code Playgroud)

当我运行此代码时,我得到错误

file: time_prcision.sv
    timeunit 100ps/10ps;
           |
ncvlog: *E,TUSERR (time_prcision.sv,4|11): timeunit is smaller than the specified time precision [IEEE Std 1800-2009].
    module worklib.time_presion:sv
        errors: 1, warnings: 0
Run Code Online (Sandbox Code Playgroud)

如果我将时间单位更改为100ns/10ps,那么代码可以正确运行上面代码中的错误

system-verilog

3
推荐指数
1
解决办法
1万
查看次数

如何使用结构的指针变量的typedef指向相同的结构varible

#include<stdio.h>
//This program is about structure and there pointer
//
typedef struct{
    int i;
    char c;
}str1,*strptr;

str1 str[5];
strptr *ptr;

int main(){
    ptr = &str;// This is shown as incompatible type assignment **warning**
    ptr->i=35; // **error**: request for member 'i' in something  
               //not a structure or union

    ptr->c='d';//**error**: request for member 'c' in 
                // something not a structure or union
    printf("My structure values are %d %c\n",str[0].i,str[0].c);

return 0;
}
Run Code Online (Sandbox Code Playgroud)

当我运行这个程序时,会出现一个警告和两个错误.请阅读注释行以获取警告和错误.

我错过了什么?

c struct pointers typedef

0
推荐指数
1
解决办法
105
查看次数

标签 统计

system-verilog ×2

c ×1

pointers ×1

struct ×1

typedef ×1