CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... ·...
Transcript of CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... ·...
![Page 1: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/1.jpg)
Instructor: Alexander Stoytchev
http://www.ece.iastate.edu/~alexs/classes/
CprE 281: Digital Logic
![Page 2: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/2.jpg)
Intro to Verilog
CprE 281: Digital Logic Iowa State University, Ames, IA Copyright © Alexander Stoytchev
![Page 3: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/3.jpg)
Administrative Stuff
• HW3 is due on Monday Sep 12 @ 4p
![Page 4: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/4.jpg)
Administrative Stuff • HW4 is out
• It is due on Monday Sep 19 @ 4pm.
• Please write clearly on the first page (in BLOCK CAPITAL letters) the following three things:
§ Your First and Last Name § Your Student ID Number § Your Lab Section Letter
• Also, please § Staple your pages
![Page 5: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/5.jpg)
Administrative Stuff TA Office Hours:
• 11:00am-1:00pm on Wednesdays (Jinyuan Jia)
Location: TLA (Coover Hall - first floor)
• 9:50am-11:50am on Thursday (Siyuan Lu)
Location: TLA (Coover Hall - first floor)
![Page 6: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/6.jpg)
Administrative Stuff • Midterm Exam #1
• When: Friday Sep 23.
• Where: This classroom
• What: Chapter 1 and Chapter 2 plus number systems
• The exam will be open book and open notes (you can bring up to 3 pages of handwritten notes).
• More details to follow.
![Page 7: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/7.jpg)
Quick Review
![Page 8: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/8.jpg)
NAND followed by NOT = AND
x1 x2 f 0 0 0 0 1 0 1 0 0 1 1 1
x 1 x 2
x 1 x 2 ⋅
x1 x2 f 0 0 1 0 1 1 1 0 1 1 1 0
x 1 x 2 ⋅
f 0 0 0 1
x 1 x 2
x 1 x 2 ⋅
![Page 9: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/9.jpg)
DeMorgan’s Theorem
![Page 10: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/10.jpg)
DeMorgan’s Theorem
x x
y y
x + y =x y
x y ⋅
![Page 11: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/11.jpg)
Sum-Of-Products
x 1 x 2 x 3 x 4
![Page 12: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/12.jpg)
Sum-Of-Products
x 1 x 2 x 3 x 4
AND
AND
OR
![Page 13: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/13.jpg)
Sum-Of-Products
x 1 x 2 x 3 x 4
AND
AND
OR
x 1 x 2 ⋅ x 1 x 2
x 1 x 2 ⋅
x 3 x 4 ⋅ x 3 x 4
x 3 x 4 ⋅
x 1 x 2 ⋅ x 3 x 4 ⋅ +
![Page 14: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/14.jpg)
Sum-Of-Products
x 1 x 2 x 3 x 4
AND
AND
OR
x 1 x 2 ⋅ x 1 x 2
x 1 x 2 ⋅
x 3 x 4 ⋅ x 3 x 4
x 3 x 4 ⋅
x 1 x 2 ⋅ x 3 x 4 ⋅ +
AND
AND
OR
![Page 15: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/15.jpg)
Sum-Of-Products
x 1 x 2 x 3 x 4
AND
AND
OR
x 1 x 2 ⋅ x 1 x 2
x 1 x 2 ⋅
x 3 x 4 ⋅ x 3 x 4
x 3 x 4 ⋅
x 1 x 2 ⋅ x 3 x 4 ⋅ +
![Page 16: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/16.jpg)
Sum-Of-Products
x 1 x 2 x 3 x 4
AND
AND
OR
x 1 x 2 ⋅ x 1 x 2
x 1 x 2 ⋅
x 3 x 4 ⋅ x 3 x 4
x 3 x 4 ⋅
x 1 x 2 ⋅ x 3 x 4 ⋅ +
NAND
![Page 17: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/17.jpg)
Sum-Of-Products
x 1 x 2 x 3 x 4
AND
AND
OR
x 1 x 2
x 1 x 2 ⋅
x 3 x 4
x 3 x 4 ⋅
x 1 x 2 ⋅ x 3 x 4 ⋅ +
![Page 18: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/18.jpg)
Sum-Of-Products
x 1 x 2 x 3 x 4 x 5
x 1 x 2 x 3 x 4 x 5
x 1 x 2 x 3 x 4 x 5
![Page 19: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/19.jpg)
2-1 Multiplexer (Definition)
• Has two inputs: x1 and x2
• Also has another input line s
• If s=0, then the output is equal to x1
• If s=1, then the output is equal to x2
![Page 20: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/20.jpg)
Graphical Symbol for a 2-1 Multiplexer
f
s
x 1 x 2
0
1
[ Figure 2.33c from the textbook ]
![Page 21: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/21.jpg)
Let’s Derive the SOP form
s x1 x2
s x1 x2
s x1 x2
s x1 x2
f (s, x1, x2) = s x1 x2 s x1 x2 s x1 x2 s x1 x2 + + +
![Page 22: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/22.jpg)
Let’s simplify this expression
f (s, x1, x2) = s x1 x2 s x1 x2 s x1 x2 s x1 x2 + + +
f (s, x1, x2) = s x1 (x2 + x2) s (x1 +x1 )x2 + +
f (s, x1, x2) = s x1 s x2 +
![Page 23: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/23.jpg)
Circuit for 2-1 Multiplexer
f
x 1
x 2
s f
s
x 1 x 2
0
1
(c) Graphical symbol (b) Circuit
[ Figure 2.33b-c from the textbook ]
![Page 24: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/24.jpg)
Analogy: Railroad Switch
http://en.wikipedia.org/wiki/Railroad_switch]
![Page 25: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/25.jpg)
Analogy: Railroad Switch
http://en.wikipedia.org/wiki/Railroad_switch]
select x1 x2
f
![Page 26: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/26.jpg)
Analogy: Railroad Switch
http://en.wikipedia.org/wiki/Railroad_switch]
select x1 x2
f This is not a perfect analogy because the trains can go in either direction, while the multiplexer would only allow them to go from top to bottom.
![Page 27: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/27.jpg)
More Compact Truth-Table Representation
0 0 0 0 0 0 1 0 0 1 0 1 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1
(a) Truth table
s x1 x2 f (s, x1, x2)
[ Figure 2.33 from the textbook ]
0
1
f (s, x1, x2) s x1
x2
![Page 28: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/28.jpg)
4-1 Multiplexer (Definition)
• Has four inputs: w0 , w1, w2, w3
• Also has two select lines: s1 and s0
• If s1=0 and s0=0, then the output f is equal to w0
• If s1=0 and s0=1, then the output f is equal to w1
• If s1=1 and s0=0, then the output f is equal to w2
• If s1=1 and s0=1, then the output f is equal to w3
We’ll talk more about this when we get to chapter 4, but here is a quick preview.
![Page 29: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/29.jpg)
Graphical Symbol and Truth Table
[ Figure 4.2a-b from the textbook ]
![Page 30: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/30.jpg)
The long-form truth table
[http://www.absoluteastronomy.com/topics/Multiplexer]
![Page 31: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/31.jpg)
4-1 Multiplexer (SOP circuit)
[ Figure 4.2c from the textbook ]
![Page 32: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/32.jpg)
0
w 0 w 1
0 1
w 2 w 3
0 1
f 0 1
s 1 s
Using three 2-to-1 multiplexers to build one 4-to-1 multiplexer
[ Figure 4.3 from the textbook ]
![Page 33: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/33.jpg)
Analogy: Railroad Switches
http://en.wikipedia.org/wiki/Railroad_switch]
![Page 34: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/34.jpg)
Analogy: Railroad Switches
http://en.wikipedia.org/wiki/Railroad_switch]
s1
w0
f
w1 w2 w3
![Page 35: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/35.jpg)
Analogy: Railroad Switches
http://en.wikipedia.org/wiki/Railroad_switch]
s1
w0
f
w1 w2 w3
these two switches are controlled together
s0
![Page 36: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/36.jpg)
Using three 2-to-1 multiplexers to build one 4-to-1 multiplexer
![Page 37: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/37.jpg)
Using three 2-to-1 multiplexers to build one 4-to-1 multiplexer
f s1
s0
w0
w1
w2
w3
![Page 38: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/38.jpg)
That is different from the SOP form of the 4-1 multiplexer shown below, which uses less gates
![Page 39: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/39.jpg)
w 8 w 11
s 1 w 0
s 0
w 3
w 4 w 7
w 12
w 15
s 3 s 2
f
16-1 Multiplexer
[ Figure 4.4 from the textbook ]
![Page 40: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/40.jpg)
[http://upload.wikimedia.org/wikipedia/commons/2/26/SunsetTracksCrop.JPG]
![Page 41: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/41.jpg)
7-Segment Display Example
![Page 42: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/42.jpg)
Display of numbers
[ Figure 2.34 from the textbook ]
![Page 43: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/43.jpg)
Display of numbers
![Page 44: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/44.jpg)
Display of numbers
b = 1
e = s0 c = s1
f = s1 s0
g = s1 s0 a = s0
d = s0
![Page 45: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/45.jpg)
Intro to Verilog
![Page 46: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/46.jpg)
History • Created in 1983/1984
• Verilog-95 (IEEE standard 1364-1995)
• Verilog 2001 (IEEE Standard 1364-2001)
• Verilog 2005 (IEEE Standard 1364-2005)
• SystemVerilog
• SystemVerilog 2009 (IEEE Standard 1800-2009).
![Page 47: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/47.jpg)
HDL
• Hardware Description Language
• Verilog HDL
• VHDL
![Page 48: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/48.jpg)
Verilog HDL != VHDL
• These are two different Languages!
• Verilog is closer to C
• VHDL is closer to Ada
![Page 49: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/49.jpg)
[ Figure 2.35 from the textbook ]
![Page 50: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/50.jpg)
“Hello World” in Verilog
[http://en.wikipedia.org/wiki/Verilog]
![Page 51: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/51.jpg)
x 1 x 2
x 1 x 2 +
AND gate
x x x 1 x 2
x 1 x 2 ⋅
The Three Basic Logic Gates
[ Figure 2.8 from the textbook ]
OR gate NOT gate
![Page 52: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/52.jpg)
How to specify a NOT gate in Verilog
NOT gate
x x
![Page 53: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/53.jpg)
x y
How to specify a NOT gate in Verilog
NOT gate
we’ll use the letter y for the output
![Page 54: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/54.jpg)
x y
How to specify a NOT gate in Verilog
NOT gate
not (y, x)
Verilog code
![Page 55: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/55.jpg)
How to specify an AND gate in Verilog
AND gate
and (f, x1, x2)
Verilog code
x 1 x 2
x 1 x 2 ⋅ f=
![Page 56: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/56.jpg)
How to specify an OR gate in Verilog
OR gate
or (f, x1, x2)
Verilog code
x 1 x 2
x 1 x 2 + f=
![Page 57: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/57.jpg)
2-1 Multiplexer
[ Figure 2.36 from the textbook ]
![Page 58: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/58.jpg)
Verilog Code for a 2-1 Multiplexer
[ Figure 2.37 from the textbook ] [ Figure 2.36 from the textbook ]
![Page 59: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/59.jpg)
Verilog Code for a 2-1 Multiplexer
[ Figure 2.40 from the textbook ] [ Figure 2.36 from the textbook ]
![Page 60: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/60.jpg)
Verilog Code for a 2-1 Multiplexer
[ Figure 2.42 from the textbook ] [ Figure 2.36 from the textbook ]
![Page 61: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/61.jpg)
Verilog Code for a 2-1 Multiplexer
[ Figure 2.43 from the textbook ] [ Figure 2.36 from the textbook ]
![Page 62: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/62.jpg)
Another Example
![Page 63: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/63.jpg)
Let’s Write the Code for This Circuit
[ Figure 2.39 from the textbook ]
![Page 64: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/64.jpg)
[ Figure 2.38 from the textbook ]
Let’s Write the Code for This Circuit
module example2 (x1, x2, x3, x4, f, g, h); input x1, x2, x3, x4; output f, g, h;
and (z1, x1, x3); and (z2, x2, x4); or (g, z1, z2); or (z3, x1, ~x3); or (z4, ~x2, x4); and (h, z3, z4); or (f, g, h);
endmodule
[ Figure 2.39 from the textbook ]
![Page 65: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/65.jpg)
[ Figure 2.41 from the textbook ]
Let’s Write the Code for This Circuit
[ Figure 2.39 from the textbook ]
module example4 (x1, x2, x3, x4, f, g, h); input x1, x2, x3, x4; output f, g, h; assign g = (x1 & x3) | (x2 & x4); assign h = (x1 | ~x3) & (~x2 | x4); assign f = g | h;
endmodule
![Page 66: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/66.jpg)
Yet Another Example
![Page 67: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/67.jpg)
A logic circuit with two modules
[ Figure 2.44 from the textbook ]
![Page 68: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/68.jpg)
The adder module
[ Figure 2.12 from the textbook ]
![Page 69: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/69.jpg)
The adder module
[ Figure 2.45 from the textbook ]
![Page 70: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/70.jpg)
The display module
b = 1
e = s0 c = s1
f = s1 s0
g = s1 s0 a = s0
d = s0
![Page 71: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/71.jpg)
The display module
b = 1
e = s0
c = s1
f = s1 s0
g = s1 s0
a = s0
d = s0
[ Figure 2.46 from the textbook ]
![Page 72: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/72.jpg)
Putting it all together
![Page 73: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/73.jpg)
Questions?
![Page 74: CprE 281: Digital Logic - Computer Engineeringalexs/classes/2016_Fall_281/slides_PDF/09_Intro... · Administrative Stuff • HW4 is out • It is due on Monday Sep 19 @ 4pm. • Please](https://reader034.fdocuments.net/reader034/viewer/2022042021/5e7841c9f620486ba559a0da/html5/thumbnails/74.jpg)
THE END