Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

nested Class in Modelsim

Status
Not open for further replies.

sunidrak

Full Member level 1
Joined
Apr 12, 2012
Messages
97
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
Bengaluru, India
Activity points
1,738
Does ModelSim support nested class testbench codes...Can any body tell in which verilog simulator does this code works ? This code is shownig error in my Modelsim SE


** Error: C:/Sunil_Labs/Lab1/example2.sv(31): (vlog-60) Nested class declarations not yet supported.


////////////CODE/////////////////

class figure;
virtual function void draw();
$display("figure:draw");
endfunction

function void compute_area();
$display("figure:compute_area");
endfunction
endclass


class polygon extends figure;
virtual function void draw();
$display("polygon:draw");
endfunction
function void compute_area();
$display("polygon:compute_area");
endfunction
endclass


class square extends polygon;
virtual function void draw();
$display("square:draw");
endfunction
function void compute_area();
$display("square:compute_area");
endfunction


class square extends polygon;
virtual function void draw();
$display("square:draw");
endfunction
function void compute_area();
$display("square:compute_area");
endfunction
endclass


module top;
figure f;
polygon p;
square s;
initial begin
s = new();
f = s;
p = s;
p.draw();
p.compute_area();
f.draw();
f.compute_area();
s.draw();
s.compute_area();
end
endmodule
 

You do not need nested classes for this example, you simply forgot an endclass statement.
 

You do not need nested classes for this example, you simply forgot an endclass statement.
Hi Sir,

Actually I got this example from OVM cookbook where it has given this example to show the use of virtual function, so in ModelSim it is showing error as it wont support nested class declaration ,So I want to know whether its invalid to declare nested class or Questa sim supports it?
so please guide about this

Regards
SUNIL
 

ModelSim eventually supported nested class declarations in versions after 10.1

But the example code you show here will never compile because there is a missing endclass. Even with nested classes, there needs to be a matching endclass for each class declaration. The error message is misleading because the intent was never to have an nested class. The fix is not to add an endclass, but to remove the duplicated class square text.
 
ModelSim eventually supported nested class declarations in versions after 10.1

But the example code you show here will never compile because there is a missing endclass. Even with nested classes, there needs to be a matching endclass for each class declaration. The error message is misleading because the intent was never to have an nested class. The fix is not to add an endclass, but to remove the duplicated class square text.


Hi sir
Oh great, Now I got you and your post really helped thank You so much :)


Regards
SUNIL
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top