Quantcast
Channel: Jason Andrews Blog
Viewing all articles
Browse latest Browse all 33813

RE: same value for a RANDC variable of base class in extended class objects

$
0
0
It would help if you pasted the output that you're getting, as well as the actual code you're using. The code you pasted above doesn't compile. I modified it by moving the "module tst;" line to the top of the file and adding "include uvm_pkg::*;" and including the uvm_macros.svh file to get it to compile. I also had to change "rand" to "randc" for "index". What I see when I run it, is a list of unique IDs: --------------- Index Name --------------- x016 c2_11 x020 c1_0 x04e c1_10 x052 c1_12 x069 c1_9 x06d c2_2 x09b c1_17 x0a1 c1_1 x0a4 c2_8 x0ab c1_3 x0b2 c2_16 x0b5 c2_0 x0b8 c1_15 x0de c2_9 x0ed c2_10 x0f9 c2_14 x109 c2_19 x111 c1_4 x11a c2_13 x11e c1_2 x194 c1_11 x1be c2_6 x219 c1_18 x271 c2_1 x274 c1_6 x27e c1_14 x288 c2_7 x2e4 c2_15 x301 c2_3 x30a c2_17 x325 c2_18 x327 c1_19 x332 c1_5 x33c c2_4 x34a c2_5 x352 c2_12 x361 c1_7 x3c0 c1_16 x3cb c1_13 x3cc c1_8 Aside from that, I think perhaps you have a misunderstanding about how inheritance works. "index" is not a shared variable between class instances; there is one instance of "index" for every class instance. Thus if you have 2 instances of c1, there are two separate memory locations for "index", one for the first instance of c1 and one for the second instance. If both class instances start with the same seed, then they will both generate the same sequence of values for "index". If you want a truly unique "index" that isn't reused in any instance of c, c1 or c2, then make "index" a static variable so that the memory is shared between all the class instances. As a final point, "SimVision" is the GUI debugger, the simulator is called Incisive.

Viewing all articles
Browse latest Browse all 33813

Trending Articles