Thursday, January 8, 2009

Functions and Digital Logic

PCs are digital devices; they deal in zeros and ones only. All modern digital computers, in fact all the circuits in the PC, work by manipulating these binary numbers using hardware functions. These functions take one or more inputs and produce from them a pre-defined set of outputs. There are several different types of functions: mathematical functions take two binary numbers and perform arithmetic on them such as addition or subtraction. Logical functions allow for comparing values and performing logical operations on them such as "AND" and "OR". There are many other kinds of functions as well.

A simple digital function can be defined using a table that shows the inputs and the resulting outputs. For example, here is a table that defines a simple three-input "OR" function:

Input A

Input B

Input C

Output

0

0

0

0

0

0

1

1

0

1

0

1

0

1

1

1

1

0

0

1

1

0

1

1

1

1

0

1

1

1

1

1

As you can see, the output is 1 if input A is a 1 or input B is 1 or input C is 1. At its core, all computer hardware uses these types of fundamental building blocks. Simple logical functions like these are sometimes called gates (no, they weren't named after Bill. :^) ). Modern complicated processors don't actually use AND and OR gates to implement their logic (they integrate these functions into larger circuits), but the concepts are identical.

No comments:

Post a Comment