Edit code - EDA Playground
Warning! This exercise has been opened in another tab; autosave has been disabled. Close this tab or refresh to reactivate.

 Languages & Libraries

 Tools & Simulators

 Examples

208


25
 
1
//-------------------------------------------------------------------------
2
//                      www.verificationguide.com
3
//-------------------------------------------------------------------------
4
class packet;
5
  bit [31:0] addr;
6
  bit [31:0] data;
7
  
8
  //task declaration - extern indicates out-of-body declaration
9
  extern virtual task display();
10
endclass
11
12
//task implementation outside class body
13
task packet::display();
14
  $display("Addr = %0d Data = %0d",addr,data);
15
endtask
16
    
17
module extern_method;
18
  initial begin
19
    packet p;
20
    p = new();
21
    p.addr = 10;
22
    p.data = 20;
23
    p.display(); 
24
  end
25
endmodule
xxxxxxxxxx
1
 
1
430 views and 0 likes     
A short description will be helpful for you to remember your playground's details
 
100:0