Académique Documents
Professionnel Documents
Culture Documents
Faculty of Engineering
Electronics and Communications Department
Prepared By:
Ahmed Reda
2014 1
Design of Combinational and Sequential Circuits Using Verilog
Outline
Introduction
Verilog Level
Structure of Program using “Verilog HDL”
Verilog Operator
Data type and Number representation
Control Statement
Assign and always statements
Design of Combinational Circuits
Examples
Home Work
2014 2
Design of Combinational and Sequential Circuits Using Verilog
Introduction
Two most popular HDLs used currently are Verilog and VHDL
Are compatible with Altera and Xilinx platform
2014 3
Design of Combinational and Sequential Circuits Using Verilog
Introduction (Cont.)
Verilog Level
A- Register-transistor-logic "RTL"
A
B F
Digital circuit
C
2014 5
Design of Combinational and Sequential Circuits Using Verilog
نقوم بوصف الدائره الرقمية بمجرد معرفه عالقة الدخل والخرج
Verilog Level
B-Gate Level
C y F
g2 g4
A
B g3 z
C
Ex:- for Verilog Code
And g1 (A,B,x)
And g2 (C,A,y)
And g3 (B,C,z)
Or g4 (x,y,z,F)
2014 6
Design of Combinational and Sequential Circuits Using Verilog
الخطوات-:
تحديد اسم ال Moduleوالى هو هيكون له نفس اسم الدئره الرقميه المراد عملها
تحديد اسم ال portsالى هيه (الدخل والخرج للدائره )
تحديد نوعيه ال portنفسه ()input ,output, input-output
تحديد عرض sizeلل portهل هو ()wire , Bus
تحديد Data typeبمعنى قيمه االشاره الموجوده داخل الدائره هتتخزن فى
( )Registerوال أل
2014 7
Design of Combinational and Sequential Circuits Using Verilog
a
x
b
y
c
Test
d z
2014 8
Design of Combinational and Sequential Circuits Using Verilog
Verilog Operator
X=2;
Y=6;
If X>Y // the result will be 0”zero”
2014 10
Design of Combinational and Sequential Circuits Using Verilog
Verilog Operator
2014 11
Design of Combinational and Sequential Circuits Using Verilog
2014 12
Design of Combinational and Sequential Circuits Using Verilog
Control Statement
A- Assign statement A
F
B
عاده يستخدم هذا االمر مع ال
combinational Circuit
Assign F= A &B;
B-Always statement
عاده يستخدم هذا االمر مع ال
sequential Circuit and Combinational
always@(..or..or..) always@(A or B)
begin begin
.. F=A&B;
.. end
end
2014 14
Design of Combinational and Sequential Circuits Using Verilog
2014 15
Design of Combinational and Sequential Circuits Using Verilog
Examples:-
A- Write a verilog code to impalement the shown circuit
A
B
C F
A
B
C
Solution
A
B F
1-Draw the block of the circuit Cirucit1
C
2-Relation between Input and Output
F=A.B+B.C+C.A
2014 16
Design of Combinational and Sequential Circuits Using Verilog
Examples:-
3-The code
always @ (A or B or C)
begin
F = (A&B)|(B&C)|(C&A);
End
End Module
2014 17
Design of Combinational and Sequential Circuits Using Verilog
Examples:-
B- Write a verilog code to impalement the Full Adder
Solution
Sum= A ^B^Cin
Cout= (A ^B).Cin +A.B
2014 18
Design of Combinational and Sequential Circuits Using Verilog
Examples:-
3-The code
always @ (A or B or Cin)
begin
Sum= X ^Y^Cin;
Cout= ((A ^B)&Cin) | (A&B);
End
End Module
2014 19
Design of Combinational and Sequential Circuits Using Verilog
Examples:-
C- Write a verilog code to impalement the Mux 4*1
Solution
S1 S2
2014 20
Design of Combinational and Sequential Circuits Using Verilog
Examples:-
3-The code
always @ (A or B or C or D or S1 or S2)
begin
case ({S1 , S2})
2'b00: F= A ;
2‘b01: F=B;
2'b10: F= C ;
2'b11: F= D ;
default:
F=0;
endcase
end
End Module 2014 21
Design of Combinational and Sequential Circuits Using Verilog
Home Work:-
2014 22