Module 2 - Part6
Module 2 - Part6
Module 2 - Part6
MODULE 2
Part 6 Introduction to HDL
Module: it is a keyword used to describe module name and input output port list
Input : keyword used to declare the input ports
Output : keyword used to declare output ports
Endmodule: keyword to end the module, semicolon is not used for endmodule
// single line comments
/* */ multi-line comments
Writing Module Body:
• Module body describes the logic of the circuit
• There are three different models to write the module body
1. Structural Model
2. Data flow Model
3. Behavioral Model
Keywords used to declare gates:
And, or, not, nand, nor, xor, xnor
Syntax for 2 input OR gate: or(output, input1, input2)
Syntax for Not gate: not(output, input)
2. Structural Model
3. Behavioral Model
Programs:
module testckt(a,b,c,x,y);
input a,b,c;
output x,y;
wire or_op1, or_op2; // internal connections
or g1 (or_op1, a,b); // g1 is upper OR gate
or g2 (or_op2, b,c); // g2 is lower OR gate
nor g3(x, c, or_op1); // g3 is NOR gate
nand g4 (y, or_op1, or_op2); // g4 is NAND gate
endmodule