Академический Документы
Профессиональный Документы
Культура Документы
Course Objectives
To learn how to design digital (i.e. boolean) circuits To Understand how a simple computer works Its hardware components What they are built from How to design them Also, how to design digital circuits other than computers Today A grand overview How have we been able to make a Machine that can do complex things Add and multiply really fast Weather forecast, design of medicinal drugs Speech recognition, Robotics, Artificial Intelligence.. Web browsers, internet communication protocols Starting at (almost) the lowest level Gates to Gates
Introduction to CS231
The Controllable Switch No hands Voltage controls if the switch is on or off High voltage at input: switch on Otherwise it is off
Introduction to CS231
Introduction to CS231
Input1
Output is high if both the inputs input1 AND input2 are high Output If either of the inputs is low, the output is low.
OR Gate
Input1
Output
Input2
I.e. Output is high if either of the inputs (or both) are high (input1 OR input2)
Introduction to CS231
Basic Gates
There are three basic kinds of logic gates AND of two inputs OR of two inputs NOT (complement) on one input
Operation:
Logic gate:
Two Questions: How can we implement such switches? What can we build with Gates? And How?
Introduction to CS231
Introduction to CS231
Introduction to CS231
Decimal review
1 100
6 10
2 1
3 1/10
7 1/100
These weights are all powers of the base, which is 10. We can rewrite this:
1 102
6 101
2 100
3 10-1
7 10-2
5 10-3
Digits Weights
To find the decimal value of a number, multiply each digit by its weight and sum the products.
(1 x 102) + (6 x 101) + (2 x 100) + (3 x 10-1) + (7 x 10-2) + (5 x 10-3) = 162.375
Now we can see why addition is easier with decimal system than the roman system. The idea of positional weights and carry!
Introduction to CS231
10
0 1
0 1
1 0
1 0
0 1
Introduction to CS231
11
We can use the same trick to convert binary, or base 2, numbers to decimal. This time, the weights are powers of 2. Example: 1101.01 in binary
1 23 1 22 0 21 1 20 . 0 2-1 1 2-2 Binary digits, or bits Weights (in base 10)
The decimal value is: (1 x 23) + (1 x 22) + (0 x 21) + (1 x 20) + (0 x 2-1) + (1 x 2-2) = 8 + 4 + 0 + 1 + 0 + 0.25 = 13.25
Powers of 2: 20 = 1 21 = 2 22 = 4 23 = 8 24 25 26 27 = 16 = 32 = 64 = 128 28 = 256 29 = 512 210 = 1024 Useful abbreviations: K = 2 10 = 1,024 M = 220 = 1,048,576 G = 2 30 = 1,073,741,824
Introduction to CS231
12
1 + 1
1 1 1 1
1 0 1 0
0 1 1 0
1 0 1
Introduction to CS231
13
Lets do simple stuff first: Can we add two numbers each with just 1 bit? Bit: binary digit 0+0 = 0, 0+1 = 1 , 1+0 = 1, and 1+1 = ??? 2. But 2 is not a symbol. 10 (just as 5 + 5 is 10 in decimal) Result is 0 with 1 carried over to the next bit.. Whats 1 and 0? High and low voltage respectively. Half adder Result Carry
Introduction to CS231
14
Result
This circuit is so common, that it has a name an symbol as a gate by itself: Exclusive OR
Introduction to CS231
Exclusive OR
15
0 0 1 1
+0 +1 +0 +1
=0 =1 =1 = 10
Introduction to CS231
16
But what we really need to do is add three bits: the augend and addend, and the carry in from the right. 1 + 1
X 0 0 0 0 1 1 1 1 Y 0 0 1 1 0 0 1 1 C in 0 1 0 1 0 1 0 1 C out 0 0 0 1 0 1 1 1
1 1 1 1
S 0 1 1 0 1 0 0 1
1 0 1 0
0 1 1 0
1 0 1
0 0 0 0 1 1 1 1
+0 +0 +1 +1 +0 +0 +1 +1
+0 +0 +0 +1 +0 +1 +0 +1
= 00 = 01 = 01 = 10 = 01 = 10 = 10 = 11
17
Introduction to CS231
Introduction to CS231
18
A 4-bit adder
Four full adders together can make a 4-bit adder There are nine total inputs to the 4-bit adder: two 4-bit numbers, A3 A2 A1 A0 and B3 B2 B1 B0 an initial carry in, CI The five outputs are: a 4-bit sum, S3 S2 S1 S0 a carry out, CO
Introduction to CS231
19
Lets put our initial example into this circuit: A=1011, B=1110 1 1 1 0 1 1 0 1
1 1 1 0
1 0
0 1
Step 1: Fill in all the inputs, including CI=0 Step 2: The circuit produces C1 and S0 (1 + 0 + 0 = 01) Step 3: Use C1 to find C2 and S1 (1 + 1 + 0 = 10) Step 4: Use C2 to compute C3 and S2 (0 + 1 + 1 = 10) Step 5: Use C3 to compute CO and S3 (1 + 1 + 1 = 11) The final answer is 11001
Introduction to CS231
20
Introduction to CS231
21
22
Data
Memory
Program
Introduction to CS231
23
Summary
Controllable Switches are easy to make These switches can be used to put together Logic Gates Logic Gates can be put together to make half adder, full adders and multi-bit adders So we can see they can be used for other such circtuits as well Logic Gates can be used to make circtuits that remember or store data A Computer includes, at its heart : An ALU (Arithmetic Logic Unit) Instruction Decoding and associated circuits Memory Stored Program
Introduction to CS231
24