Logic Design / Processor and Control Units Tony Diep.

27
Logic Design / Processor and Control Units Tony Diep

Transcript of Logic Design / Processor and Control Units Tony Diep.

Page 1: Logic Design / Processor and Control Units Tony Diep.

Logic Design / Processor and Control Units

Tony Diep

Page 2: Logic Design / Processor and Control Units Tony Diep.

Topics to be discuss…

• Functional properties of digital integrated circuits

• Instruction sets• Number presentation• Register and ALU organization• Data paths

Page 3: Logic Design / Processor and Control Units Tony Diep.

Logic Gates

• Binary information is represented in digital computer called signals.

• Electrical signal as voltages are chosen to represent 2 recognizable states

0.5 volt = 0, 1.5 volt = 1

Page 4: Logic Design / Processor and Control Units Tony Diep.

Logic Gates

• Gates are logic circuits that manipulate binary information.

• Gates are blocks of hardware that produce signals of binary 1 or 0 when input logic requirement are satisfied.

Page 5: Logic Design / Processor and Control Units Tony Diep.

Logic Gates

Page 6: Logic Design / Processor and Control Units Tony Diep.

Logic Gates

Page 7: Logic Design / Processor and Control Units Tony Diep.

Logic Gates

• NAND gate

• NOR gate

• Exclusive OR

Page 8: Logic Design / Processor and Control Units Tony Diep.

Combinational & Sequential Circuits

• A CC can be described by a truth table is having the binary relationship when the n input variables and the m output variable.

• A SC employ signals that affect storage elements (flip-flop) only at discrete instants of time. Synchronization is achieved by time device called clock pulse generator that produces periodic train of clock pulses.

Page 9: Logic Design / Processor and Control Units Tony Diep.

Flip - Flop

• Flip-flop is part of the electronic component responsible for the storage of data in memory.

• SR, JK, D flip-flops• Difference among various flip-flops

is in the number of inputs they possess and the manner in which inputs affect the binary state.

Page 10: Logic Design / Processor and Control Units Tony Diep.

Simple SR Flip-Flop

A "set/reset" flip-flop in which activating the "S" input will switch it to one stable state and activating the "R" input will switch it to the other state.

Page 11: Logic Design / Processor and Control Units Tony Diep.

JK Flip-Flop

• An edge triggered SR flip-flop with extra logic such that only one of the R and S inputs is enabled at any time. This prevents a race condition which can occur when both inputs of an RS flip-flop are active at the same time. In a JK flip-flop the R and S inputs are renamed J and K. The set input (J) is only enabled when the flip-flop is reset and K when it is set.

Page 12: Logic Design / Processor and Control Units Tony Diep.

D Flip-Flop

• A digital logic device that stores the status of its "D" input whenever its clock input makes a certain transition (low to high or high to low). The output, "Q", shows the currently stored value.

Page 13: Logic Design / Processor and Control Units Tony Diep.

Instruction Set

• Vocabulary of machine language.

• Popular MIPS instruction set used Sony, NEC, Silicon Graphic.

Page 14: Logic Design / Processor and Control Units Tony Diep.

MIPS Instruction

• Million Instructions Per Second (MIPS)

• Operates on two source operands and places the result in one destination operand.

• Translation from C to MIPS assembly language instructions is performed by compiler.

Page 15: Logic Design / Processor and Control Units Tony Diep.

Simples MIPS Instructions

• add a, b, c -- meaning a = b + c • sub a, b, c -- meaning a = b - c

• C statement -- f=(g+h) – (i+j) • add t0, g, h #temp variable t0 contains

g+h add t1, i, j #temp variable t1 contains i+j sub f, t0, t1 #f gets t0 – t1, which is

(g+h) - (i+j)

Page 16: Logic Design / Processor and Control Units Tony Diep.

Number Representation

• Base 2 representation

• Example: 1011 base 2 in a MIPS word (32 bits) is

Page 17: Logic Design / Processor and Control Units Tony Diep.

Unsigned and Sign

• Two’s complement -- meaning leading 0s mean positive, and leading 1s mean negative.

• Sign bit determine a number is positive or negative (with 0 considered positive)

Page 18: Logic Design / Processor and Control Units Tony Diep.

Binary to Decimal Conversion

Page 19: Logic Design / Processor and Control Units Tony Diep.

Addition and Subtraction

• Addition in binary starts from right to left, with carries passed to the next digit to the left.

• Subtracting can be done directly such as 7 – 6, or via addition using the two’s complement representation of –6.

Page 20: Logic Design / Processor and Control Units Tony Diep.

ALU

• Arithmetic Logic Unit• A device that performs the

arithmetic operations like addition and subtraction or logical operation like AND and OR.

• ALU can be constructed w/ 4 hardware building blocks (AND, OR, Inverter, and Multiplexor).

Page 21: Logic Design / Processor and Control Units Tony Diep.

1-Bit ALU

• 1-bit ALU for AND and OR

Page 22: Logic Design / Processor and Control Units Tony Diep.

1-Bit Adder

1-bit adder has 3 inputs and 2 outputs.

Page 23: Logic Design / Processor and Control Units Tony Diep.

1-Bit ALU w/ Addition

1-bit ALU that performs AND, OR, and addition.

Page 24: Logic Design / Processor and Control Units Tony Diep.

32-bit ALU

A 32-bit ALU constructed from 32 1-bit ALUs

Page 25: Logic Design / Processor and Control Units Tony Diep.

Building Data Path

• For every instruction, the first 2 steps are identical:• Send the Program Counter (PC) to the

memory that contains the code and fetch the instruction from that memory

• Read one or two registers, using fields of the instruction to select the registers to read.

Page 26: Logic Design / Processor and Control Units Tony Diep.

Building Data Path

An abstract view of the implementation of the MIPS subset.

PC supplies instruction address to the instruction memory

Register operands used by an instruction are specified by fields of that instructions

Register operands can be operated on to compute a memory address (for load or store)

If the instruction is an arithmetic-logical instruction, the result from the ALU must be written to a register

Page 27: Logic Design / Processor and Control Units Tony Diep.

Reference

• CS 444 Lecture Notes• Computer Organization & Design

by David Patterson and John L Hennessy

• http://www.brunel.ac.uk/~castjjg/hndcfund/material/logic/part5.htm