M
mrfirmware
Guest
Forgive a poor C programmer but I'm having a hard time figuring some
of the mundane linkage rules with SystemVerilog. I would expect to do
something like this:
// top_tb.sv:
module top;
Thing thing;
thing.test();
....
endmodule : top;
// thing.sv
class Thing;
task test
....
endtask : test
endclass : Thing
Then compile them both together via something like: vlog top_tb.sv
thing.sv. Later, vsim'ing my little testbench demo code vsim complains
** Error: Failed to find 'test' in hierarchical name. If I wrap the
class within a module/endmodule I can access the methods but this
seems clumsy. E.g.
// thing.sv
module Thing;
class obj;
task test
....
endtask : test
endclass : obj
endmodule : Thing
I can now invoke test() via thing.obj.test() but yuck.
Also, I seem unable to pass a ref to test() when it is a class, vsim
complains, Fatal: (SIGSEGV) Bad pointer access. Same exact code but
strip the class from the file so that it's a plain module and all is
well. I can pass a reference to my typedef to test() no problem. What
am clearly not understanding?
Thanks,
--
- Mark
of the mundane linkage rules with SystemVerilog. I would expect to do
something like this:
// top_tb.sv:
module top;
Thing thing;
thing.test();
....
endmodule : top;
// thing.sv
class Thing;
task test
....
endtask : test
endclass : Thing
Then compile them both together via something like: vlog top_tb.sv
thing.sv. Later, vsim'ing my little testbench demo code vsim complains
** Error: Failed to find 'test' in hierarchical name. If I wrap the
class within a module/endmodule I can access the methods but this
seems clumsy. E.g.
// thing.sv
module Thing;
class obj;
task test
....
endtask : test
endclass : obj
endmodule : Thing
I can now invoke test() via thing.obj.test() but yuck.
Also, I seem unable to pass a ref to test() when it is a class, vsim
complains, Fatal: (SIGSEGV) Bad pointer access. Same exact code but
strip the class from the file so that it's a plain module and all is
well. I can pass a reference to my typedef to test() no problem. What
am clearly not understanding?
Thanks,
--
- Mark