top of page
General Syntax

module module_name(< port list>);

declaration

logical portion

endmodule

  • module is a keyword which is followed by the name of module.

  • module_name an identifier that uniquely names the module.By this module name we can call this module in any other module.

  • Port list a list of input,and output variables.

  • Declaration section describe the type of each variable e.g. reg, wire, output, input etc. used through-out the module

  • Logical portion decides working of your module

  • endmodule simply denotes the end of module.

Description

Example

module halfadder(a, b, s, c);     //here a,b,s,c are variables either output or input
input a;
input b;                                 //all the variables declared with keyword denoting their types
output s;                   //helping variables(e.g. wire,reg) are also declared here
output c;


xor x1(s,a,b);          //syntax of logical part varies as per level of modeling

and a1(c,a,b); 

 

endmodule

}

}

Structure

Anchor 1
Anchor 2
Anchor 3
bottom of page