Embedded Systems Design: A Unified Hardware/Software Introduction 1 Chapter 2: Custom single-purpose processors.

Slides:



Advertisements
Similar presentations
Part 4: combinational devices
Advertisements

컴퓨터구조론 교수 채수환. 교재 Computer Systems Organization & Architecture John D. Carpinelli, 2001, Addison Wesley.
Logical Design.
Chapter 2 Logic Circuits.
Embedded Systems Design: A Unified Hardware/Software Introduction 1 Chapter 2: Custom single-purpose processors.
Embedded Systems Design: A Unified Hardware/Software Introduction 1 Chapter 2: Custom single-purpose processors.
Fall 2007 L15: Combinational Circuits Lecture 15: Combinational Circuits Complete logic functions Some combinational logic functions –Half adders –Adders.
Chapter 7. Register Transfer and Computer Operations
Chapter 4 Gates and Circuits.
Dr. Turki F. Al-Somani VHDL synthesis and simulation – Part 3 Microcomputer Systems Design (Embedded Systems)
From Combinational to Sequential Circuits to Simple Processors
Microprocessors & Embedded Systems
Chapter 2: Custom single-purpose processors
RT-Level Custom Design. This Week in DIG II  Introduction  Combinational logic  Sequential logic  Custom single-purpose processor design  Review.
Chapter 4 Processor Technology and Architecture. Chapter goals Describe CPU instruction and execution cycles Explain how primitive CPU instructions are.
1 Introduction Chapters 2 & 3: Introduced increasingly complex digital building blocks –Gates, multiplexors, decoders, basic registers, and controllers.
CPEN Digital System Design Chapter 9 – Computer Design
George Mason University ECE 448 – FPGA and ASIC Design with VHDL Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts,
From Combinational to Sequential Circuits to Simple Processors
CS 105 Digital Logic Design
Introduction to Digital Logic Design Appendix A of CO&A Dr. Farag
Embedded Systems Design: A Unified Hardware/Software Introduction 1 Microprocessors.
1 2-Hardware Design Basics of Embedded Processors.
1 CHAPTER 4: PART I ARITHMETIC FOR COMPUTERS. 2 The MIPS ALU We’ll be working with the MIPS instruction set architecture –similar to other architectures.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Logic Circuits I.
Digital Logic. 4 Why is 32-bit or 64-bit significant in terms of speed, efficiency? 4 Difference between OR and XOR 4 What is a mux for? PLA 4 Two kinds.
Digital Logic Design Review Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office: Ahmad Almulhem, KFUPM 2010.
Chapter 2Basic Digital Logic1 Chapter 2. Basic Digital Logic2 Outlines  Basic Digital Logic Gates  Two types of digital logic circuits Combinational.
Hussein Bin Sama && Tareq Alawneh
1 2-Hardware Design Basics of Embedded Processors (cont.)
CprE / ComS 583 Reconfigurable Computing
Chap 7. Register Transfers and Datapaths. 7.1 Datapaths and Operations Two types of modules of digital systems –Datapath perform data-processing operations.
Chapter 7 Logic Circuits 1.State the advantages of digital technology compared to analog technology. 2. Understand the terminology of digital circuits.
1 Lecture 6 BOOLEAN ALGEBRA and GATES Building a 32 bit processor PH 3: B.1-B.5.
CHAPTER-2 Fundamentals of Digital Logic. Digital Logic Digital electronic circuits are used to build computer hardware as well as other products (digital.
CDA 3101 Fall 2013 Introduction to Computer Organization The Arithmetic Logic Unit (ALU) and MIPS ALU Support 20 September 2013.
PART 3 Digital Logic 1.Logic Gates 2.Logic Circuits 3.Memory 4.Sequential Circuits 5.LC-3 Data Path.
DLD Lecture 26 Finite State Machine Design Procedure.
Kavita Bala CS 3410, Spring 2014 Computer Science Cornell University.
Instructor:Po-Yu Kuo 教師:郭柏佑
Logic Design / Processor and Control Units Tony Diep.
Chapter 3 Digital Logic Structures. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 3-2 Transistor: Building.
1 2-Hardware Design Basics of Embedded Processors.
Appendix C Basics of Digital Logic Part I. Florida A & M University - Department of Computer and Information Sciences Modern Computer Digital electronics.
IAY 0600 Digital Systems Design Register Transfer Level Design (GCD example) Lab. 7 Alexander Sudnitson Tallinn University of Technology.
Instructor : Po-Yu Kuo 教師:郭柏佑 Ch. 3 Digital Logic Structures EL 1009 計算機概論 ( 電子一 B) Introduction to Computer Science.
Introduction to Computing Systems and Programming Digital Logic Structures.
Chapter 3 Digital Logic Structures
ECE 448 Lecture 6 Finite State Machines State Diagrams vs. Algorithmic State Machine (ASM) Charts.
Dr. Turki F. Al-Somani VHDL synthesis and simulation.
1 DLD Lecture 16 More Multiplexers, Encoders and Decoders.
1 2-Hardware Design Basics of Embedded Processors (cont.)
Processor Organization and Architecture Module III.
Digital Logic Structures. Transistor: The Digital Building Block Microprocessors contain LOTS of transistors –Intel Pentium 4 (2000): 48 million –IBM.
Chapter 3 Boolean Algebra and Digital Logic T103: Computer architecture, logic and information processing.
Prof. Sin-Min Lee Department of Computer Science
Register Transfer Specification And Design
2-Hardware Design Basics of Embedded Processors (cont.)
Introduction Introduction to VHDL Entities Signals Data & Scalar Types
Instructor:Po-Yu Kuo 教師:郭柏佑
Chap 7. Register Transfers and Datapaths
Chapter 2: Custom single-purpose processors
Basics of digital systems
Fundamentals & Ethics of Information Systems IS 201
ECE 448 Lecture 6 Finite State Machines State Diagrams vs. Algorithmic State Machine (ASM) Charts.
Instructor:Po-Yu Kuo 教師:郭柏佑
Chapter 2: Custom single-purpose processors
Chapter 2: Custom single-purpose processors
Chapter 2: Custom single-purpose processors
EMBEDDED SYSTEMS Prof. Ch.Ramesh Embedded Systems 1.
Presentation transcript:

Embedded Systems Design: A Unified Hardware/Software Introduction 1 Chapter 2: Custom single-purpose processors

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 2 Outline Introduction Combinational logic Sequential logic Custom single-purpose processor design RT-level custom single-purpose processor design

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 3 Introduction Processor –Digital circuit that performs a computation tasks –Controller and datapath –General-purpose: variety of computation tasks –Single-purpose: one particular computation task –Custom single-purpose: non-standard task A custom single-purpose processor may be –Fast, small, low power –But, high NRE, longer time-to-market, less flexible

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 4 CMOS transistor on silicon Transistor –The basic electrical component in digital systems –Acts as an on/off switch –Voltage at “gate” controls whether current flows from source to drain –Don’t confuse this “gate” with a logic gate source drain oxide gate IC packageIC channel Silicon substrate

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 5 CMOS transistor implementations Complementary Metal Oxide Semiconductor We refer to logic levels –Typically 0 is 0V, 1 is 5V Two basic CMOS types –nMOS conducts if gate=1 –pMOS conducts if gate=0 –Hence “complementary” Basic gates –Inverter, NAND, NOR x F = x' 1 inverter 0 F = (xy)' x 1 x y y NAND gate 0 1 F = (x+y)' x y x y NOR gate 0 gate source drain nMOS Conducts if gate=1 gate source drain pMOS Conducts if gate=0

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 6 Basic logic gates F = x y AND F = (x y)’ NAND F = x  y XOR F = x Driver F = x’ Inverter x F F = x + y OR F = (x+y)’ NOR x F x y F F x y x y F x y F x y F F = x y XNOR F y x x 0 y 0 F x 0 y 0 F x 0 y 0 F x 0 y 0 F x 0 y 0 F x 0 y 0 F xF xF

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 7 Combinational logic design A) Problem description y is 1 if a is equal to 1, or b and c is equal to 1. z is 1 if b or c is equal to 1, but not both. D) Minimized output equations a bc y y = a + bc z z = ab + b’c + bc’ a bc C) Output equations y = a'bc + ab'c' + ab'c + abc' + abc z = a'b'c + a'bc' + ab'c + abc' + abc B) Truth table Inputs abc Outputs yz E) Logic Gates a b c y z

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 8 Combinational components enable input e all O’s 0 if e=0 carry-in input Ci sum = A + B + C status outputs carry, zero, etc. O = I0 if S=0..00 I1 if S=0..01 … Im if S=1..11 O0 =1 if I=0..00 O1 =1 if I=0..01 … On =1 if I=1..11 sum = A+B (first n bits) carry = (n+1)’th bit of A+B less = 1 if A<B equal =1 if A=B greater=1 if A>B O = A op B op determined by S. n-bit, m x 1 Multiplexor O … S0 S(log m) n n I(m-1) I1I0 … log n x n Decoder … O1O0O(n-1) I0 I(log n -1) … n-bit Adder n A B n sumcarry n-bit Comparator nn AB lessequalgreater n bit, m function ALU n n AB … S0 S(log m) n O

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 9 Sequential components Q = 0 if clear=1, I if load=1 and clock 8, I(prev) else. Q = 0 if clear=1, Q(prev)+1 if count=1 and clock 8. clear n-bit Register n n load I Q shift IQ n-bit Shift register n-bit Counter n Q

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 10 Sequential logic design A) Problem Description You want to construct a clock divider. Slow down your pre- existing clock so that you output a 1 for every four clock cycles x=0 x=1 x=0 a=1 a=0 B) State Diagram C) Implementation Model Combinational logic State register a x I0 I1 Q1 Q0 D) State Table (Moore-type) Inputs Q1Q0a Outputs I1I x Given this implementation model –Sequential logic design quickly reduces to combinational logic design

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 11 Sequential logic design (cont.) Q1Q0 I1 I1 = Q1’Q0a + Q1a’ + Q1Q0’ a a 1 10 I0 Q1Q0 I0 = Q0a’ + Q0’a x = Q1Q0 x a Q1Q0 E) Minimized Output EquationsF) Combinational Logic a Q1 Q0 I0 I1 x

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 12 Custom single-purpose processor basic model controller and datapath controllerdatapath … … external control inputs external control outputs … external data inputs … external data outputs datapath control inputs datapath control outputs … … a view inside the controller and datapath controllerdatapath … … state register next-state and control logic registers functional units

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 13 Example: greatest common divisor GCD (a) black-box view x_i y_i d_o go_i 0: int x, y; 1: while (1) { 2: while (!go_i); 3: x = x_i; 4: y = y_i; 5: while (x != y) { 6: if (x < y) 7: y = y - x; else 8: x = x - y; } 9: d_o = x; } (b) desired functionality y = y -x 7: x = x - y 8: 6-J: x!=y 5: !(x!=y) x<y!(x<y) 6: 5-J: 1: 1 !1 x = x_i 3: y = y_i 4: 2: 2-J: !go_i !(!go_i) d_o = x 1-J: 9: (c) state diagram First create algorithm Convert algorithm to “complex” state machine –Known as FSMD: finite- state machine with datapath –Can use templates to perform such conversion

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 14 State diagram templates Assignment statement a = b next statement a = b next statement Loop statement while (cond) { loop-body- statements } next statement loop-body- statements cond next statement !cond J: C: Branch statement if (c1) c1 stmts else if c2 c2 stmts else other stmts next statement c1 c2 stmts !c1*c2 !c1*!c2 next statement othersc1 stmts J: C:

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 15 Creating the datapath Create a register for any declared variable Create a functional unit for each arithmetic operation Connect the ports, registers and functional units –Based on reads and writes –Use multiplexors for multiple sources Create unique identifier –for each datapath component control input and output y = y -x 7: x = x - y 8: 6-J: x!=y 5: !(x!=y) x<y!(x<y) 6: 5-J: 1: 1 !1 x = x_i 3: y = y_i 4: 2: 2-J: !go_i !(!go_i) d_o = x 1-J: 9: subtractor 7: y-x8: x-y5: x!=y6: x<y x_iy_i d_o 0: x0: y 9: d n-bit 2x1 x_sel y_sel x_ld y_ld x_neq_y x_lt_y d_ld < 5: x!=y != Datapath

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 16 Creating the controller’s FSM Same structure as FSMD Replace complex actions/conditions with datapath configurations y = y -x 7: x = x - y 8: 6-J: x!=y 5: !(x!=y) x<y!(x<y) 6: 5-J: 1: 1 !1 x = x_i 3: y = y_i 4: 2: 2-J: !go_i !(!go_i) d_o = x 1-J: 9: y_sel = 1 y_ld = 1 7: x_sel = 1 x_ld = 1 8: 6-J: x_neq_y 5: !x_neq_y x_lt_y!x_lt_y 6: 5-J: d_ld = 1 1-J: 9: x_sel = 0 x_ld = 1 3: y_sel = 0 y_ld = 1 4: 1: 1 !1 2: 2-J: !go_i !(!go_i) go_i Controller subtractor 7: y-x8: x-y5: x!=y6: x<y x_iy_i d_o 0: x0: y 9: d n-bit 2x1 x_sel y_sel x_ld y_ld x_neq_y x_lt_y d_ld < 5: x!=y != Datapath

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 17 Splitting into a controller and datapath y_sel = 1 y_ld = 1 7: x_sel = 1 x_ld = 1 8: 6-J: x_neq_y=1 5: x_neq_y=0 x_lt_y=1x_lt_y=0 6: 5-J: d_ld = 1 1-J: 9: x_sel = 0 x_ld = 1 3: y_sel = 0 y_ld = 1 4: 1: 1 !1 2: 2-J: !go_i !(!go_i) go_i Controller Controller implementation model y_sel x_sel Combinational logic Q3Q0 State register go_i x_neq_y x_lt_y x_ld y_ld d_ld Q2Q1 I3I0I2I1 subtractor 7: y-x8: x-y5: x!=y6: x<y x_iy_i d_o 0: x0: y 9: d n-bit 2x1 x_sel y_sel x_ld y_ld x_neq_y x_lt_y d_ld < 5: x!=y != (b) Datapath

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 18 Controller state table for the GCD example

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 19 Completing the GCD custom single-purpose processor design We finished the datapath We have a state table for the next state and control logic –All that’s left is combinational logic design This is not an optimized design, but we see the basic steps … … a view inside the controller and datapath controllerdatapath … … state register next-state and control logic registers functional units

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 20 We often start with a state machine –Rather than algorithm –Cycle timing often too central to functionality Example –Bus bridge that converts 4-bit bus to 8-bit bus –Start with FSMD –Known as register-transfer (RT) level –Exercise: complete the design RT-level custom single-purpose processor design Problem Specification WaitFirst4RecFirst4Start data(3..0)=data_in WaitSecond4 rdy_in=1 rdy_in=0 RecFirst4End rdy_in=1 RecSecond4Start data(7..4)=data_in RecSecond4End rdy_in=1 rdy_in=0 rdy_in=1 rdy_in=0 Send8Start data_out=data rdy_out=1 Send8End rdy_out=0 FSMD Bridge A single-purpose processor that converts two 4-bit inputs, arriving one at a time over data_in along with a rdy_in pulse, into one 8-bit output on data_out along with a rdy_out pulse. Sender 4 data_in(4) rdy_in data_out(8) rdy_out 8 Receiver clock

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 21 RT-level custom single-purpose processor design (cont’) WaitFirst4RecFirst4Start data_lo_ld=1 WaitSecond4 rdy_in=1 rdy_in=0 RecFirst4End rdy_in=1 RecSecond4Start data_hi_ld=1 RecSecond4End rdy_in=1 rdy_in=0 rdy_in=1 rdy_in=0 Send8Start data_out_ld=1 rdy_out=1 Send8End rdy_out=0 (a) Controller rdy_inrdy_out data_lodata_hi data_in(4) (b) Datapath data_out data_out_lddata_hi_ld data_lo_ld clk to all registers data_out Bridge

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 22 Optimizing single-purpose processors Optimization is the task of making design metric values the best possible Optimization opportunities –original program –FSMS –datapath –FSM

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 23 Optimizing the original program Analyze program attributes and look for areas of possible improvement –number of computations –size of variable –time and space complexity –operations used multiplication and division very expensive

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 24 Optimizing the original program (cont’) 0: int x, y; 1: while (1) { 2: while (!go_i); 3: x = x_i; 4: y = y_i; 5: while (x != y) { 6: if (x < y) 7: y = y - x; else 8: x = x - y; } 9: d_o = x; } 0: int x, y, r; 1: while (1) { 2: while (!go_i); // x must be the larger number 3: if (x_i >= y_i) { 4: x=x_i; 5: y=y_i; } 6: else { 7: x=y_i; 8: y=x_i; } 9: while (y != 0) { 10: r = x % y; 11: x = y; 12: y = r; } 13: d_o = x; } original programoptimized program replace the subtraction operation(s) with modulo operation in order to speed up program GCD(42, 8) - 9 iterations to complete the loop x and y values evaluated as follows : (42, 8), (43, 8), (26,8), (18,8), (10, 8), (2,8), (2,6), (2,4), (2,2). GCD(42,8) - 3 iterations to complete the loop x and y values evaluated as follows: (42, 8), (8,2), (2,0)

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 25 Optimizing the FSMD Areas of possible improvements –merge states states with constants on transitions can be eliminated, transition taken is already known states with independent operations can be merged –separate states states which require complex operations (a*b*c*d) can be broken into smaller states to reduce hardware size –scheduling

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 26 Optimizing the FSMD (cont’) int x, y; 2: go_i !go_i x = x_i y = y_i x<yx>y y = y -xx = x - y 3: 5: 7: 8: d_o = x 9: y = y -x 7: x = x - y 8: 6-J: x!=y 5: !(x!=y) x<y!(x<y) 6: 5-J: 1: 1 !1 x = x_i y = y_i 4: 2: 2-J: !go_i !(!go_i) d_o = x 1-J: 9: int x, y; 3: original FSMD optimized FSMD eliminate state 1 – transitions have constant values merge state 2 and state 2J – no loop operation in between them merge state 3 and state 4 – assignment operations are independent of one another merge state 5 and state 6 – transitions from state 6 can be done in state 5 eliminate state 5J and 6J – transitions from each state can be done from state 7 and state 8, respectively eliminate state 1-J – transition from state 1-J can be done directly from state 9

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 27 Optimizing the datapath Sharing of functional units –one-to-one mapping, as done previously, is not necessary –if same operation occurs in different states, they can share a single functional unit Multi-functional units –ALU’s support a variety of operations, it can be shared among operations occurring in different states

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 28 Optimizing the FSM State encoding –task of assigning a unique bit pattern to each state in an FSM –size of state register and combinational logic vary –can be treated as an ordering problem State minimization –task of merging equivalent states into a single state state equivalent if for all possible input combinations the two states generate the same outputs and transitions to the next same state

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 29 Summary Custom single-purpose processors –Straightforward design techniques –Can be built to execute algorithms –Typically start with FSMD –CAD tools can be of great assistance