cop3502: introduction to computer science

15
COP3502: Introduction to Computer Science Yashas Shankar Hardware

Upload: dinah

Post on 11-Jan-2016

32 views

Category:

Documents


0 download

DESCRIPTION

COP3502: Introduction to Computer Science. Hardware. Yashas Shankar. Overview of what you will learn this 2 weeks. Machine only know 0 and 1 what can we do with it, and how? Information are represented by electrical signals 0 usually refer to low voltage or no current - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: COP3502: Introduction to Computer Science

COP3502: Introduction to Computer Science

Yashas Shankar

Hardware

Page 2: COP3502: Introduction to Computer Science

Overview of what you will learn this 2 weeks Machine only know 0 and 1 what can we do

with it, and how? Information are represented by electrical signals

0 usually refer to low voltage or no current 1 usually refer to high voltage or has current

Use switches to implement hardware instructions AND OR NOT ADD MUL

How to store 0s and 1s into a storage (memory, hard drive, etc)

Page 3: COP3502: Introduction to Computer Science

Normally open switch

IN OUT

Control

IN = 0, Control = 0 OUT = 0IN = 0, Control = 1 OUT = 0IN = 1, Control = 0 OUT = 0IN = 1, Control = 1 OUT = 1

INOUT 0 1

CONTROL 0 0 01 0 1

Page 4: COP3502: Introduction to Computer Science

Normally closed switch

IN OUTControl

IN = 0, Control = 0 OUT = 0IN = 0, Control = 1 OUT = 0IN = 1, Control = 0 OUT = 1IN = 1, Control = 1 OUT = 0

INOUT 0 1

CONTROL 0 0 11 0 0

Page 5: COP3502: Introduction to Computer Science

LOGIC There are only 2 values

0 (zero): usually stands for FAULT or no current 1 (one): usually stands for TRUE or have current

Most common rules for logics AND

Example: X and Y are even numbers OR

X is even number or Y is even number NOT

X is not an even number

Page 6: COP3502: Introduction to Computer Science

AND

** P AND Q are true P is true AND Q is true **** Note: we use concatenation for AND **

ANDP Q PQ1 1 11 0 00 1 00 0 0

Page 7: COP3502: Introduction to Computer Science

OR

** P OR Q is true P is true OR Q is true OR both are true**** Note: we use + for OR **

ORP Q P + Q1 1 11 0 10 1 10 0 0

Page 8: COP3502: Introduction to Computer Science

NOTIf P is true NOT P is falseIf P is false NOT P is trueWe use ‘ for NOTP P’0 11 0

Page 9: COP3502: Introduction to Computer Science

AND GATE

ANDP Q PQ1 1 11 0 00 1 00 0 0

P

QPQ

P PQ

Q

Normally open switch

Page 10: COP3502: Introduction to Computer Science

NOT GATE

NOTP P’1 00 1

P P’

1 P’P

Normally closed switch

Page 11: COP3502: Introduction to Computer Science

OR GATE

ORP Q P + Q1 1 11 0 10 1 10 0 0

P

QP + Q

How to build an OR gate?P + Q = (P’Q’)’** OR gate can be built from NOT gate and AND gates **

Page 12: COP3502: Introduction to Computer Science

Binary Arithmetic

Addition+ 0

10 0 11 1 10

Multiplicationx 0 10 0 01 0 1

Page 13: COP3502: Introduction to Computer Science

Building instructions from AND, OR, and NOT gatesExample#1: Instruction PQ + P’Q’ (see Figure

7.6)Example#2: One-bit half adder (HA) (see Figure

7.7)Example#3: One-bit full adder (FA) (see Figure

7.8)Example#4: Four-bit full adder (see Figure 7.10)

Page 14: COP3502: Introduction to Computer Science

Multiplexor Multiplexor (multi-way switch) is typically used

to select values or instructions Select A or B Select ADD or MUL

A 2-way multiplexor (Figure 7.11) A 2-function arithmetic unit (Figure 7.12)

Page 15: COP3502: Introduction to Computer Science

Truth table Example#1 (P’Q’)’ Example#2 (PQ + P’Q’) Example#3 (P’Q + PQ’) Example#4 (a + b)c