Docsity

Hardware Description Language-Digital Logic Design-Lecture Slides, Slides of Digital Logic Design and Programming

Toggle sidebar
bg1
Hardware Description Language
(HDL)
Describes the hardware of digital systems
in a textual form.
Specifically oriented to describe hardware
structures and behaviors.
Represent logic diagrams, Boolean
expressions and other more complex
circuits.
Documentation Language, used to
represent and document digital systems in
a form that can be read by both human
and computers.
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Hardware Description Language-Digital Logic Design-Lecture Slides and more Slides Digital Logic Design and Programming in PDF only on Docsity!

Hardware Description Language

(HDL)

 Describes the hardware of digital systems

in a textual form.

 Specifically oriented to describe hardware

structures and behaviors.

 Represent logic diagrams, Boolean

expressions and other more complex

circuits.

 Documentation Language, used to

represent and document digital systems in

a form that can be read by both human

and computers. docsity.com

Verilog HDL Vs. VHDL

 Two standard HDLs supported by IEEE

(Institute for Electrical and Electronics

Engineers).

 Verilog is easier to learn & use than

VHDL.

 Verilog is very C-like and liked by electrical

and computer engineers as most learn the

C language in college.

 VHDL is very Ada-like and most engineers

have no experience with Ada.

Module Representation (Cntd.)

 Module is declared by the keyword

“ module” and is always terminated by the

keyword “endmodule”

 Lets start with a simple example to

illustrate some aspects of the language.

HDL Example-

//Description of simple circuit

module smpl_circuit(A,B,C,x,y);

input A, B, C;
output x, y;
wire e;
and g1(e, A, B);
not g2(y, c);
or g3(x, e, y);
endmodule

/*Description of simple circuit */

module smpl_circuit(A,B,C,x,y); input A, B, C; output x, y; wire e; and g1(e, A, B); not g2(y, c); or g3(x, e, y); endmodule

 module description ends with the

keyword “ endmodule ”.

 Each statement is terminated with

a semicolon but there is no semicolon after endmodule.

 Port list is enclosed in parenthesis

and commas are used to separate elements of a list.

 The statement is terminated with

a semicolon.

 Next I/p & o/p declaration, which

ports are i/p and which are o/p.

 Internal connection are declared

as wires.

 Predefined primitive gates are

keywords almost 12 in total.

 Each gate declaration consists of

an optional name (such as g1, g & g3).

 Followed by the gate o/ps

declared 1st & then i/ps, each separated with commas and enclosed in ()s.

HDL for combinational ckts.

 There are alternatives available for describing

combinational ckts, and can be described in anyone of the following modeling techniques:

 Gate level modeling: using instantiation of primitive gates

and user-defined modules.

 Dataflow modeling: using continuous assignment

statements with the keyword assign.

 Behavioral modeling: using procedural assignment

statements with keyword always.

 Dataflow modeling is mostly used for describing

combinational ckts whereas behavioral is used to describe digital systems at a higher level of abstraction such as Sequential logic ckts.

Another Example of Gate level Modeling:

// Gate – level description of a 2-to-4 line decoder module decoder_gtl(A, B, E, D) input A, B, E; output [0:3]D; wire Anot, Bnot, Enot; not n1 (Anot, A), n2(Bnot, B), n3(Enot, E); nand n4(D[0], Anot, Bnot, Enot), n5(D[1], Anot, B, Enot), n6(D[2], A, Bnot, Enot), n7(D[3], A, B, Enot); endmodule

Dataflow Modeling:

 Uses a number of operators that act on operands to

produce desired results.

 Verilog HDL provides 30 operator types.
 Arithmetic and logical operation are different and so are

their symbols, such as + is used for arithmetic addition and logic AND uses the symbol &.

 There are special symbols for OR, NOT, XOR etc.
 The concatenation operands provides the mechanism for

appending multiple operands, e.g. two operands with two bits each can be concatenated to form a operand with four bits.

Behavioral Modeling: (cntd).

 Represent the digital ckt at a ftnl and algorithmic

level.

 It is used mostly to describe sequential ckts, but

can be used also to describe combinational ckts.

 Behavioral descriptions use the keyword

“always” followed by the list of procedural
assignment statements.

 The target o/p of procedural assignments must

be of the reg data type. Contrary to the wire data
type, where the target o/p of an assignment may
be continuously updated, a reg data type retains
its value until a new value is assigned.
Example of behavioral dataflow:

/* behavioral description of 4-to-1 line decoder*/ module mux4_to_1_bhl(i0, i1, i2,i3, select, y); input i0, i1,i2,i3; input [1:0]select; output y; reg y; Always @ (i0 or i1 or i2 or i3 or select) case ( select) 2‟b 00 : y = i0; 2‟b 01 : y = i1; 2‟b 10 : y = i2; 2‟b 11 : y = i3; endcase endmodule

Example of instantiation:

module halfadder( s , c, x, y); input x, y; output s, c; //instantiation primitive gates xor (s, x, y); and ( c, x, y); endmodule

module fulladder( s, c , x, y , z); input x,y,z; output s,c; wire s1, d1,d2; halfadder ha1(s1, d1, x, y), ha2( s, d2, s1,z); or g1(c, d2, d1); endmodule

Module _4bitadder( s, c4, a,b,c0); Input [3:0] a,b; Input c0; Output [3:0]s; Output c4; Wire c1, c2,c3;

fulladder f1(s[0], c1, a[0], b[0], c0), f1(s[1], c2, a[1], b[1], c1), f2(s[2], c3, a[2], b[2], c2), f3(s[3], c4, a[3], b[3], c3), endmodule