quick.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

   

space.gif

   

space.gif

  ../images/main/bulllet_4dots_orange.gif Extern Module

To support separate compilation, extern declarations of a module can be used to declare the ports on a module without defining the module itself. An extern module declaration consists of the keyword extern followed by the module name and the list of ports for the module.

   

space.gif

   

space.gif

  ../images/main/bullet_star_pink.gif Example : Extern Module
   

space.gif


  1 extern module counter (input clk,enable,reset, 
  2   output logic [3:0] data);
  3 
  4 //+++++++++++++++++++++++++++++++++++++++++++++++++
  5 // Extern Module
  6 //+++++++++++++++++++++++++++++++++++++++++++++++++
  7 module extern_module();
  8 
  9 logic clk = 0;
 10 always  #1  clk++;
 11 logic enable, reset;
 12 wire [3:0] data;
 13 
 14 counter U(clk,enable,reset,data);
 15 
 16 initial begin
 17   $monitor("@%0dns reset %b enable %b data %b",
 18      $time,reset,enable,data);
 19   reset <= 1;
 20    #10  reset <= 0;
 21    #1  enable <= 1;
 22    #10  enable <= 0;
 23    #4  $finish;
 24 end
 25 
 26 endmodule
You could download file extern_module.sv here
   

space.gif


  1 //=================================================
  2 // Module declration 
  3 //=================================================
  4 module counter(input clk,enable,reset, 
  5 output logic [3:0] data);
  6 
  7   always @ (posedge clk)
  8     if (reset) data <= 0;
  9     else if (enable) data ++;
 10 
 11 endmodule
You could download file extern_counter.sv here
   

space.gif

  ../images/main/bullet_star_pink.gif Simulation : Extern Module
   

space.gif

 @0ns reset 1 enable x data xxxx
 @1ns reset 1 enable x data 0000
 @10ns reset 0 enable x data 0000
 @11ns reset 0 enable 1 data 0000
 @13ns reset 0 enable 1 data 0001
 @15ns reset 0 enable 1 data 0010
 @17ns reset 0 enable 1 data 0011
 @19ns reset 0 enable 1 data 0100
 @21ns reset 0 enable 0 data 0101
   

space.gif

   

space.gif

   

space.gif

   

space.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

  

Copyright © 1998-2014

Deepak Kumar Tala - All rights reserved

Do you have any Comment? mail me at:deepak@asic-world.com