system verilog - copy an object to a handle in systemverilog -
i have 1 module, mod1, includes 1 class, my_test. inside mod1 there instance of module mod2 , mod2 includes class, my_config. "my_test" class includes my_config class. want copy object of my_config class handle of class instantiated inside mod2 module. below code snippets, can follow. my_test, my_config, mod1, mod2 in different files.
class my_test; my_config cfg_2; // instance of my_config class // here object created // here have assigned values properties of my_config class ... endclass : my_test module mod2; my_config cfg_1; // instance of my_config class // mod2 file includes my_config class ... endmodule : mod2 `include "my_test.sv" // included inside file "mod1" module mod1; mod2 m2(..); // module instance of module mod2 // mod1 file includes my_test class m2.cfg_1 = cfg_2; // cfg_1 instance of my_config, inside mod2 // in above line trying copy object cfg_2 handle cfg_1 // getting error in above line. ... endmodule : mod1 can please me out. thanks
you don't show instance of my_test here, assuming create under name my_test_inst, following:
module mod1(); //... // can add procedural code in initial blocks initial m2.cfg_1 = my_test_inst.cfg_2 endmodule
Comments
Post a Comment