Docsity

Constructing Computer - Computer Organization and Design - Lecture Slides, Slides of Computer Aided Design (CAD)

Partial preview of the text

Download Constructing Computer - Computer Organization and Design - Lecture Slides and more Slides Computer Aided Design (CAD) in PDF only on Docsity!

Constructing a Computer

• Creating a general purpose computing device involves

a lot of logic

• Putting together an entire processor at the gate-level

isn’t very feasible

• For the next set of classes, we’ll put together a toolbox

of useful logic circuits that we can use in our processor:

  • Multiplexors
  • Arithmetic-Logic Unit ( ALU )
  • Registers
  • Memories

State Logic – D Flip-Flop

• A state element that is edge-sensitive

– Want changes in output ONLY on the transition of the Clk signal

from 0  1 (or from 1  0)

D Q

Q

positive edge-triggered flip-flop

Combinational Logic

• Changes in input values are reflected immediately (subject

to the speed of light and electrical delays) on the outputs

• Each gate has an associated “electrical delay”

• Delays are often ignored for the purpose of the logic

design (but not for the real implementation!)

• As soon as inputs change, the outputs change – no

memory of what happened before

  • (at least conceptually)

Converting Boolean Algebra into Gates

  • C = SA + SB
  • What does this device do?
  • A steering device: S steers/switches A or B onto the output C

A

B

C

S

1-Bit ALU

• ALU = Arithmetic Logic Unit

  • A combinational logic device that performs arithmetic and logic operations on a set of inputs (in most cases, 2)
  • Not clocked – slowed only by electrical delays (combinational logic)

• For example, if we require 4 operations:

  • ADD
  • SUB
  • AND
  • OR

1-Bit ALU (AND and OR)

• AND an OR are simple to implement!

• Need 1 bit of control to select

between the two operations

1 Bit Binary Addition

– The combinational logic for Sum (S) is

or

– The combinational logic for Carry out (C) is

– These two portions together is called a “half-adder”:

A

S

B

AB S

AB C

AB HA CS

Hypothetical

• How would I add together two 4-bit numbers?

• String them together

– Need some mechanism for carries

1 Bit Binary Addition

• S = Cin A B + Cin A B + Cin A B + Cin A B

= Cin(A B + A B) + Cin (A B + A B)

= Cin (A  B) + Cin (A  B)

= Cin  (A  B)

= Cin  A  B

• Cout = Cin A B + Cin A B + Cin A B + Cin A B

= A B + B Cin + A Cin (the “majority”

function)

1 Bit Binary Addition

  • The combinational logic for Sum (S) is
  • The combinational logic for Carry Out (C) is
  • The result is called a “full-adder”:

CinAB FA CoutS

S

AB

Cin

Detecting Overflow

  • Overflow = Cin  Cout of the full adder corresponding to the MSB

A0 FA

B

S

Cout

Cin

FA

A

B1 Cout S

Cin

FA

A

B2 Cout S

Cin

A3 FA

B

S

Cout

Cin

Overflow

4-Bit Subtraction

  • Computing C = A - B where A, B, and C are all 4-bit values
  • Note: C = A + (B + 1)
  • Inputs need to be A and B
  • LSB Cin  1

FA

A

B0' Cout S

Cin

A1 FA

B1'

S

Cout

Cin

A2 FA

B2'

S

Cout

Cin

FA

A

B3' Cout S

Cin

Overflow

4x1 MUX

  • A 4x1 MUX provides for 4 1-bit inputs (A,B,C,D) and a single 1-bit output
  • 4 inputs requires 2 select bits (S1 and S0)
  • S1:S0 steer one of four inputs onto a single 1-bit output line
  • Function table: (^) S1 S0 Output

0 0 A

0 1 B

1 0 C

1 1 D

A

C Output

B

D

S1 S

Design of a 1-Bit ALU

  • Requires:
    • 4x1 MUX
    • 2x1 MUX
    • 1 FA
    • 1 AND
    • 1 OR
    • 1 NOT

FA

A

B

Cin C1 C

Cout

C

4x1 MUX