0% found this document useful (0 votes)
6 views

03_verilog C Examples

The document provides examples of hardware description language (HDL) code for digital circuits, specifically a majority circuit and a 3-input XOR circuit. Each module includes input and output definitions, as well as specified delays for various logic gates used in the circuits. The code demonstrates the structure and syntax of HDL for designing combinational logic circuits.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

03_verilog C Examples

The document provides examples of hardware description language (HDL) code for digital circuits, specifically a majority circuit and a 3-input XOR circuit. Each module includes input and output definitions, as well as specified delays for various logic gates used in the circuits. The code demonstrates the structure and syntax of HDL for designing combinational logic circuits.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Hardware Description

Language
(Examples)

HDL
Majority Circuit

2
Majority Circuit

`timescale 1ns/100ps
module maj3 (a, b, c, y);
input a, b, c;
output y;
wire im1, im2, im3;
and #(4)
(im1, a, b),
(im2, b, c),
(im3, c, a);
or #(3) (y, im1, im2, im3);
endmodule

3
Delays

4
Delays

5
Delays
`timescale 1ns/100ps
module xor3_mtm (a, b, c, y);
input a, b, c;
output y;
wire a_, b_, c_;
wire im1, im2, im3, im4;
not #(2)
( a_, a ),
( b_, b ),
( c_, c );
nand #(3)
( im1, a_, b_, c ),
( im2, a_, b, c_ ),
( im3, a, b_, c_ ),
( im4, a, b, c );
nand #(3) (y, im1, im2, im3, im4);
endmodule

You might also like