bigrice911
Member level 3
system verilog questions
Hi, guys!
I want to write a class in systemverilog which can implement calculate generic array's sum, product.
eg.
class arth_oper;
.....;
endclass
module test_class();
....
//when I call it
int a [] = {1, 2, 3, 4};
int b = a.sum //b = 10;
int c = a.product; //c = 24
logic [7:0] array [2:0];
for(int i=0; i<8; i++)
array = i;
a_s = array.sum; //a_s = 0+1+2+...+8
...
endmodule
Do you got me? can anybody show me an example on how to write this class in sv?
I know sv may support this class(sum, product), but Questa61 dosen't support it, so I want to write one...
Many many Th@nks!
Hi, guys!
I want to write a class in systemverilog which can implement calculate generic array's sum, product.
eg.
class arth_oper;
.....;
endclass
module test_class();
....
//when I call it
int a [] = {1, 2, 3, 4};
int b = a.sum //b = 10;
int c = a.product; //c = 24
logic [7:0] array [2:0];
for(int i=0; i<8; i++)
array = i;
a_s = array.sum; //a_s = 0+1+2+...+8
...
endmodule
Do you got me? can anybody show me an example on how to write this class in sv?
I know sv may support this class(sum, product), but Questa61 dosen't support it, so I want to write one...
Many many Th@nks!