Lecture 8 StoredProgram Processors ESE 150 DIGITAL AUDIO

  • Slides: 63
Download presentation
Lecture #8 – Stored-Program Processors ESE 150 – DIGITAL AUDIO BASICS ESE 150 Spring

Lecture #8 – Stored-Program Processors ESE 150 – DIGITAL AUDIO BASICS ESE 150 Spring 2018 Based on slides © 2009 --2018 1 De. Hon

ESE 150 Spring 2018 SO FAR MIC A/D Music 1 freq 4 D/A speaker

ESE 150 Spring 2018 SO FAR MIC A/D Music 1 freq 4 D/A speaker pyschoacoustics s es pr EULA -------click OK sample 2 5, 6 m co Numbers correspond to course weeks domain conversion 10101 3 10101001101 MP 3 Player / i. Phone / Droid 2

ESE 150 Spring 2018 HOW PROCESS � How do we build a machine to

ESE 150 Spring 2018 HOW PROCESS � How do we build a machine to perform these operations? � � From Digital Samples compressed digital data Digital Samples With simple gates and registers can build a machine to perform any digital computation � …if we have enough of them. � 3

ESE 150 Spring 2018 ECONOMY AND UNIVERSALITY What if we only have a small

ESE 150 Spring 2018 ECONOMY AND UNIVERSALITY What if we only have a small number of gates? � OR … how many physical gates do we really need? � � � How do we perform computation with minimal hardware? How do we change the computation performed by our hardware? 4

ESE 150 Spring 2018 LECTURE TOPICS � � � � Setup Where are we?

ESE 150 Spring 2018 LECTURE TOPICS � � � � Setup Where are we? Memory One-gate processor Wide-Word, Stored-Program Processor Contemporary Processors: ARM, Arduino Next Lab 5

ESE 150 Spring 2018 7, 8, 9 COURSE MAP 10101001101 File. System CPU MIC

ESE 150 Spring 2018 7, 8, 9 COURSE MAP 10101001101 File. System CPU MIC 10 A/D 101 010 Music 1 EULA -------click OK freq 4 pyschoacoustics NIC s es pr 13 sample 2 5, 6 01 m co Numbers correspond to course weeks domain conversion 011 3 11 D/A speaker NIC MP 3 Player / i. Phone / Droid 12 6

ESE 150 Spring 2018 COURSE MAP – WEEK 9 MIC A/D Music 1 freq

ESE 150 Spring 2018 COURSE MAP – WEEK 9 MIC A/D Music 1 freq 4 D/A speaker pyschoacoustics s es pr EULA -------click OK sample 2 5, 6 m co Numbers correspond to course weeks domain conversion 3 10101001101 MP 3 Player / i. Phone / Droid 7

ESE 150 Spring 2018 QUICK REMINDER 8

ESE 150 Spring 2018 QUICK REMINDER 8

ESE 150 Spring 2018 MULTIPLEXER GATE � MUX When S=0, output=i 0 � When

ESE 150 Spring 2018 MULTIPLEXER GATE � MUX When S=0, output=i 0 � When S=1, output=i 1 � S i 0 i 1 Mux 2(S, i 0, i 1) 0 0 0 1 0 1 1 0 0 0 1 1 1 1 0 0 1 1 9

ESE 150 Spring 2018 STATE ELEMENT Latch or Register is a state element �

ESE 150 Spring 2018 STATE ELEMENT Latch or Register is a state element � Allows circuit to remember a value � Build computations that � Depend on past inputs � Reuse hardware in time � 10

ESE 150 Spring 2018 MUX CAN BE A PROGRAMMABLEGATE � Programmable Gate Can be

ESE 150 Spring 2018 MUX CAN BE A PROGRAMMABLEGATE � Programmable Gate Can be programmed to act as any gate � Use state (e. g. FF) to “program” truth table of a gate � Input 0 Input 1 0 0 0 1 1 Output 11

ESE 150 Spring 2018 NAND UNIVERSALITY � Can implement any combinational logic function out

ESE 150 Spring 2018 NAND UNIVERSALITY � Can implement any combinational logic function out of a collection of NAND 2 gates Or AND, OR, NOT combination � Or Programmable MUX gates (OR) � 12

ESE 150 Spring 2018 PRECLASS 1 � What Function? o 1=a&b | b&c |

ESE 150 Spring 2018 PRECLASS 1 � What Function? o 1=a&b | b&c | a&c; � o 2=a^b^c; � � How many gates? 13

ESE 150 Spring 2018 MEMORY 14

ESE 150 Spring 2018 MEMORY 14

ESE 150 Spring 2018 RANDOM ACCESS MEMORY � A Memory: Series of locations �

ESE 150 Spring 2018 RANDOM ACCESS MEMORY � A Memory: Series of locations � Can write values a slot (specified by address) � Read values from (by address) � Return last value written � 15

ESE 150 Spring 2018 TWO PIECES OF A MEMORY 1. 2. Element to remember

ESE 150 Spring 2018 TWO PIECES OF A MEMORY 1. 2. Element to remember a value Way to address/select that element 16

ESE 150 Spring 2018 COULD BUILD MEMORY W/ MUXES & LATCHES … COLLECTION OF

ESE 150 Spring 2018 COULD BUILD MEMORY W/ MUXES & LATCHES … COLLECTION OF REGISTERS 17

ESE 150 Spring 2018 RANDOM ACCESS MEMORY (RAM) WITH CAPACITOR MEMORIES Din Decoder Read

ESE 150 Spring 2018 RANDOM ACCESS MEMORY (RAM) WITH CAPACITOR MEMORIES Din Decoder Read Address Learn more: ESE 370 Dout 18

ESE 150 Spring 2018 KEY ENGINEERING PROPERTY � Store state compactly in memory �

ESE 150 Spring 2018 KEY ENGINEERING PROPERTY � Store state compactly in memory � A(memory cell) small � � A(mem) < A(gate) Depends on few inputs/outputs � Memory cells share inputs and ouptuts 19

ESE 150 Spring 2018 ONE-GATE PROCESSOR 20

ESE 150 Spring 2018 ONE-GATE PROCESSOR 20

ESE 150 Spring 2018 IDEA Store register and gate outputs in memory � Compute

ESE 150 Spring 2018 IDEA Store register and gate outputs in memory � Compute one gate at a time � � Using a single physical gate 21

ESE 150 Spring 2018 BASIC IDIOM Repeat: 1. Read gate value from memory 2.

ESE 150 Spring 2018 BASIC IDIOM Repeat: 1. Read gate value from memory 2. Perform operation on gate 3. Write result back to memory 22

ESE 150 Spring 2018 OPERATION 23

ESE 150 Spring 2018 OPERATION 23

ESE 150 Spring 2018 OPERATION SEQUENCE Missing C step? Missing description? 24

ESE 150 Spring 2018 OPERATION SEQUENCE Missing C step? Missing description? 24

ESE 150 Spring 2018 OBSERVE � We can sequentialize operations, reusing the single gate

ESE 150 Spring 2018 OBSERVE � We can sequentialize operations, reusing the single gate � As long as we can specify the operation to be performed � What are we specifying? � (break it down, what information need? ) 25

ESE 150 Spring 2018 INSTRUCTION Call this specification an instruction � Instructs the programmable,

ESE 150 Spring 2018 INSTRUCTION Call this specification an instruction � Instructs the programmable, reusable operators on what to perform � 26

ESE 150 Spring 2018 EXPANDING THE STRUCTURE: INPUT Add a multiplexer to bring in

ESE 150 Spring 2018 EXPANDING THE STRUCTURE: INPUT Add a multiplexer to bring in inputs � Allow as option to write into data memory � 27

ESE 150 Spring 2018 EXPANDING THE STRUCTURE: OUTPUT � Add way to load a

ESE 150 Spring 2018 EXPANDING THE STRUCTURE: OUTPUT � Add way to load a designated output register 28

ESE 150 Spring 2018 EXPANDED CONTROL = INSTRUCTION Group the full control into instruction

ESE 150 Spring 2018 EXPANDED CONTROL = INSTRUCTION Group the full control into instruction � Set of bits that tells the structure what to do � 29

ESE 150 Spring 2018 FILLIN MISSING INSTRUCTION 30

ESE 150 Spring 2018 FILLIN MISSING INSTRUCTION 30

ESE 150 Spring 2018 INSTRUCTION BITS Instructions are just a set of bits �

ESE 150 Spring 2018 INSTRUCTION BITS Instructions are just a set of bits � Type – 2 bits � Gate. Op – 4 bits � In 1 – 3 bits � � Assume 8 slots In 2 – 3 bits � Out – 3 bits � 31

ESE 150 Spring 2018 INSTRUCTION BITS EXAMPLE � Fillin Missing 32

ESE 150 Spring 2018 INSTRUCTION BITS EXAMPLE � Fillin Missing 32

ESE 150 Spring 2018 INSTRUCTION SEQUENCE CONTROL � How provide the sequence of instructions?

ESE 150 Spring 2018 INSTRUCTION SEQUENCE CONTROL � How provide the sequence of instructions? 33

ESE 150 Spring 2018 INSTRUCTION MEMORY Add Memory to hold set of Instructions �

ESE 150 Spring 2018 INSTRUCTION MEMORY Add Memory to hold set of Instructions � Counter to sequence instructions � 34

ESE 150 Spring 2018 UNIVERSAL PROCESSOR � Can change computation simply be changing contents

ESE 150 Spring 2018 UNIVERSAL PROCESSOR � Can change computation simply be changing contents of instruction memory 35

ESE 150 Spring 2018 REVIEW � � Single active compute element (programmable gate) Sequence

ESE 150 Spring 2018 REVIEW � � Single active compute element (programmable gate) Sequence in time Store state in memory Use Instruction memory to select and sequence operations 36

ESE 150 Spring 2018 STORED-PROGRAM PROCESSOR 37

ESE 150 Spring 2018 STORED-PROGRAM PROCESSOR 37

ESE 150 Spring 2018 “STORED PROGRAM” COMPUTER Can build physical machines that perform any

ESE 150 Spring 2018 “STORED PROGRAM” COMPUTER Can build physical machines that perform any computation. � Can be built with limited hardware that is reused in time. � Historically: this was a key contribution of Penn’s Moore School � ENIAC EDVAC � Computer Engineers: Eckert and Mauchly � (often credited to Von Neumann) � 38

ESE 150 Spring 2018 BASIC IDEA � Express computation in terms of a few

ESE 150 Spring 2018 BASIC IDEA � Express computation in terms of a few primitives � E. g. Add, Multiply, OR, AND, NAND Provide one of each hardware primitive � Store intermediates in memory � Sequence operations on hardware to perform larger computation � Store description of operation sequence in memory as well – hence “Stored Program” � By filling in memory, can program to perform any computation � 39

ESE 150 Spring 2018 BUILDING OUT How limited? � How might improve? � 40

ESE 150 Spring 2018 BUILDING OUT How limited? � How might improve? � 40

ESE 150 Spring 2018 BEYOND SINGLE GATE � Single gate extreme to make the

ESE 150 Spring 2018 BEYOND SINGLE GATE � Single gate extreme to make the high-level point � � Usually reuse larger blocks � � Except in some particular cases, not practical Adders Multipliers Get more done per cycle than one gate Now it’s a matter of engineering the design point � � Where do we want to be between one gate and full circuit extreme? How many gate evaluations should we physically compute each cycle? 41

ESE 150 Spring 2018 WORD-WIDE PROCESSORS � Common to compute on multibit words Add

ESE 150 Spring 2018 WORD-WIDE PROCESSORS � Common to compute on multibit words Add two 16 b numbers � Multiply two 16 b numbers � Perform bitwise-XOR on two 32 b numbers � � More hardware � � 16 full adders, 32 XOR gates All programmable gates doing the same thing � So don’t require more instruction bits 42

ESE 150 Spring 2018 MULTIBIT BUS SYMBOLS 43

ESE 150 Spring 2018 MULTIBIT BUS SYMBOLS 43

ESE 150 Spring 2018 ARITHMETIC AND LOGIC UNIT (ALU) � A common primitive logic

ESE 150 Spring 2018 ARITHMETIC AND LOGIC UNIT (ALU) � A common primitive logic is the ALU Can perform any of a number of operations on a series of words (strings of bits) � Operations: Add, subtract, shift-left, shift-right, bitswise xor, and, or, invert, …. � Operates on “words” � � Identify a set of control bits that select the operation it forms � Makes it “programmable” 44

ESE 150 Spring 2018 ALU OPS (ON 8 BIT WORDS) � XOR 00011000 00010100

ESE 150 Spring 2018 ALU OPS (ON 8 BIT WORDS) � XOR 00011000 00010100 = � � xor 0 x 18 to 0 x 14 result is: ADD 00011000 00010100 = Add 0 x 18 to 0 x 14 � Add 24 to 20 � � SUB 00011000 00010100 = � � Subtract 0 x 14 from 0 x 18 …result is: INV 00011000 XXXX = � � result is: Invert the bits in 0 x 18 . . . gives us: SLL 00011000 XXXX = � Shift left 0 x 18 … gives us: 45

ESE 150 Spring 2018 ALU ENCODING Each operation has some bit sequence � ADD

ESE 150 Spring 2018 ALU ENCODING Each operation has some bit sequence � ADD 0000 � SUB 0010 � INV 0001 � SLL 1110 � SLR 1100 � AND 1000 � 46

ESE 150 Spring 2018 ALU-BASED WORD-WIDE PROCESSOR 47

ESE 150 Spring 2018 ALU-BASED WORD-WIDE PROCESSOR 47

ESE 150 Spring 2018 BEYOND LINEAR SEQUENCE So far, processor can run a fixed

ESE 150 Spring 2018 BEYOND LINEAR SEQUENCE So far, processor can run a fixed sequence � Might like to � Repeat sequence � Conditionally execute instruction or sequence � 48

ESE 150 Spring 2018 BRANCHING Allow PC to be loaded � Add Instruction bits

ESE 150 Spring 2018 BRANCHING Allow PC to be loaded � Add Instruction bits (or instruction) to control loading � � BRANCH Slot=In 0 49

ESE 150 Spring 2018 BRANCHING � How Branch to top of loop? � Conditionally

ESE 150 Spring 2018 BRANCHING � How Branch to top of loop? � Conditionally branch to top of loop? � Implement if-then? � 50

ESE 150 Spring 2018 BRANCHING � � � Conditional in slot 4 Slot 7

ESE 150 Spring 2018 BRANCHING � � � Conditional in slot 4 Slot 7 – true target Slot 8 – false target S 5=S 4<<1 S 4=S 5|S 4 (repeat width) S 5=!S 4 S 6=S 4*S 7 // 0 or S 7 S 5=S 5*S 8 // S 8 or 0 S 5=S 5+S 6 // target BRANCH S 5 51

ESE 150 Spring 2018 CONTEMPORARY PROCESSORS 52

ESE 150 Spring 2018 CONTEMPORARY PROCESSORS 52

ESE 150 Spring 2018 IPOD PROCESSOR � Compare ARM 7 53

ESE 150 Spring 2018 IPOD PROCESSOR � Compare ARM 7 53

ESE 150 Spring 2018 ARDUINO AVR ATmega 328/P Datasheet 54

ESE 150 Spring 2018 ARDUINO AVR ATmega 328/P Datasheet 54

ESE 150 Spring 2018 ARDUINO AVR Adds separate Data Memory from Register File �

ESE 150 Spring 2018 ARDUINO AVR Adds separate Data Memory from Register File � (common, omitted above for simplicity) � ATmega 328/P Datasheet 55

ESE 150 Spring 2018 ARDUINO AVR � 8 -bit architecture � � 32 x

ESE 150 Spring 2018 ARDUINO AVR � 8 -bit architecture � � 32 x 8 Register File � � � 32 register 8 b wide 16 b instructions � � 8 b wide ALU “most” instructions 32 KB program memory � � Flash 2 KB data memory SRAM ATmega 328/P Datasheet 56

ESE 150 Spring 2018 INSTRUCTIONS: TWO OPERAND Typically 2 -operand, where one operation is

ESE 150 Spring 2018 INSTRUCTIONS: TWO OPERAND Typically 2 -operand, where one operation is both source and destination � ADD R 1, R 2 � � � Says: R 1+R 2 Use to make code more compact 57

ESE 150 Spring 2018 AVR INSTRUCTIONS ATmega 328/P Datasheet 58

ESE 150 Spring 2018 AVR INSTRUCTIONS ATmega 328/P Datasheet 58

ESE 150 Spring 2018 BRANCHING INSTRUCTIONS ATmega 328/P Datasheet 59

ESE 150 Spring 2018 BRANCHING INSTRUCTIONS ATmega 328/P Datasheet 59

ESE 150 Spring 2018 DATA MEMORY READ / WRITE (LOAD/STORE) ATmega 328/P Datasheet 60

ESE 150 Spring 2018 DATA MEMORY READ / WRITE (LOAD/STORE) ATmega 328/P Datasheet 60

ESE 150 Spring 2018 NEXT LAB Look at Instruction-Level code for Arduino � Understand

ESE 150 Spring 2018 NEXT LAB Look at Instruction-Level code for Arduino � Understand performance from instruction-level code � � But first… � Lecture back here on Wednesday 61

ESE 150 Spring 2018 BIG IDEAS Memory stores data compactly � Can implement large

ESE 150 Spring 2018 BIG IDEAS Memory stores data compactly � Can implement large computations on small hardware by reusing hardware in time � � � Storing computational state in memory Can store program control in instruction memory Change program by reprogramming memory � Universal machine: Stored-Program Processor � 62

ESE 150 Spring 2018 LEARN MORE CIS 240 – processor organization and assembly �

ESE 150 Spring 2018 LEARN MORE CIS 240 – processor organization and assembly � CIS 371 – implement and optimize processors � � � Including FPGA mapping in Verilog ESE 370 – implement memories (and gates) using transistors 63