01 IntroDigitalCircuits
01 IntroDigitalCircuits
CSC 1074
Digital Logic Design
Which Book will be Used?
Alan B. Marcovitz
Third Edition
McGraw Hill
2010
What will I Learn in this Course?
Towards the end of this course, you should be able to:
Represent numbers and perform arithmetic in various number systems.
Model simple combinational and sequential circuits using Verilog HDL and
use tools to simulate and verify correctness of design.
Digital computers
Data communication
Digital phones
Digital cameras
Representing Fractions
Binary Codes
Analog versus Digital
Analog means continuous
Analog parameters have continuous range of values
Example: temperature is an analog parameter
Temperature increases/decreases continuously
Other analog parameters?
Sound, speed, voltage, current, time
Voltage
Time
Digitization of Analog Signals – cont’d
Voltage
Time
Voltage
Time
Representing Fractions
Binary Codes
How do Computers Represent Digits?
Binary digits (0 and 1) are the simplest to represent
Using electric voltage
Voltage Level
High = 1
Used in processors and digital circuits
High voltage = 1, Low voltage = 0 Unused
7 6 5 4 3 2 1 0
1 0 0 1 1 1 0 1
27 26 25 24 23 22 21 20
Some common
powers of 2
Positional Number Systems
Different Representations of Natural Numbers
37 = (100101)2
Remainder1 = d0
Remainder2 = d1
3 5 3 0 5 5 2 3 6 2 4 Octal
1 1 1 0 1 0 1 1 0 0 0 1 0 1 1 0 1 0 1 0 0 1 1 1 1 0 0 1 0 1 0 0 32-bit binary
E B 1 6 A 7 9 4 Hexadecimal
Converting Octal & Hex to Decimal
Examples:
Representing Fractions
Binary Codes
Representing Fractions
A number Nr in radix r can also have a fraction part:
Nr = å
i=0
di × ri + å
j = -m
dj × rj
Examples of Numbers with Fractions
(2409.87)10 = 2×103 + 4×102 + 9 + 8×10-1 + 7×10-2
7 2 6 1 3 . 2 4 7 4 5 2 Octal
1 1 1 0 1 0 1 1 0 0 0 1 0 1 1 . 0 1 0 1 0 0 1 1 1 1 0 0 1 0 1 0 1 Binary
7 5 8 B . 5 3 C A 8 Hexadecimal
Representing Fractions
Binary Codes
Binary Codes
How to represent characters, colors, etc?
Define the set of all represented elements
Assign a unique binary code to each element of the set
Given n bits, a binary code is a mapping from the set of
elements to a subset of the 2n binary numbers
Coding Numeric Data (example: coding decimal digits)
Coding must simplify common arithmetic operations
2(n - 1) < M ≤ 2n
Null-terminated String
Array of characters followed by a NULL character
Printable ASCII Codes
0 1 2 3 4 5 6 7 8 9 A B C D E F
2 space ! " # $ % & ' ( ) * + , - . /
3 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
4 @ A B C D E F G H I J K L M N O
5 P Q R S T U V W X Y Z [ \ ] ^ _
6 ` a b c d e f g h i j k l m n o
7 p q r s t u v w x y z { | } ~ DEL
Examples:
ASCII code for space character = 20 (hex) = 32 (decimal)
ASCII code for 'L' = 4C (hex) = 76 (decimal)
ASCII code for 'a' = 61 (hex) = 97 (decimal)
Control Characters
The first 32 characters of ASCII table are used for control
Control character codes = 00 to 1F (hexadecimal)
Not shown in previous slide
Examples of Control Characters
Character 0 is the NULL character used to terminate a string
Character 9 is the Horizontal Tab (HT) character
Character 0A (hex) = 10 (decimal) is the Line Feed (LF)
Character 0D (hex) = 13 (decimal) is the Carriage Return (CR)
The LF and CR characters are used together
They advance the cursor to the beginning of next line