1 / 45

Execution Team

Execution Team. Phase 1 Presentation 2/14/2011. Wisdom of the Day. 学 而不思则罔,思而不学则 殆 Learning without thought is useless; thought without learning is perilous . Today we will encourage thoughts while you learn about the execution stage.

lixue
Download Presentation

Execution Team

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Execution Team Phase 1 Presentation 2/14/2011

  2. Wisdom of the Day • 学而不思则罔,思而不学则殆 • Learning without thought is useless; thought without learning is perilous. • Today we will encourage thoughts while you learn about the execution stage. Confucius (551Bc-479BC) was a Chinese thinker and social philosopher whose teachings and philosophy have deeply influenced Chinese, Korean, Japanese, and Vietnamese thought and life.

  3. Execution Engine Overview • Responsible for producing the result of almost every instruction • Three design points: • The ALU • PC Manipulation • Memory Accesses

  4. Block Diagram

  5. Execute Stage Block Diagram

  6. THE ALUPowerhouse of the CPU

  7. ALU Overview • The ALU is the main math unit of the CPU • It takes two inputs and then returns the results of various operations on them

  8. ALU Datapath

  9. ALU Operations • Add (ADDU) • Subtract (SUBU) • Or (OR) • And (AND) • Nor (NOR) • Set Less Than (SLT) • Set Less Than Unsigned (SLTU) • Shift Logical Left (SLL) • Shift Right Logical (SRL) • Load Upper Immediate (LUI)

  10. Addition • Uses a ripple carry adder to produce the sum • Other options include a carry look ahead adder • We believe the ripple carry adder is sufficiently fast for our implementation. C Code int ADDU(int a, int b){ return a+b; }

  11. Subtraction • Modified existing adder to handle both Add and Subtract • Subtraction is the addition of one number and the 2s compliment of a second number • 2s compliment: invert bits then add 1 • A-B = A + (B! + 1) C Code int SUBU(int a, int b){ return a-b; }

  12. Subtraction • For our adder to handle both Add and Subtract, we place a mux in front of the adder • Choice 1: signal unmodified • Choice 2: inverted part of B • Then to add one we set the carry in bit of the adder to high C Code SUBU(int a, int b){ return a-b; }

  13. Set Less Than • On a set less than instruction, the ALU determines if the first input is less than the second. • To implement, we subtract the two operands and then determine if the output is negative. • The sign becomes the result. • 1 means it is less than. • 0 indcates that it is not. C Code boolean SLT(int a, int b){ return a<b; }

  14. Set Less Than Unsigned • First, let's try using the exact same logic as SLT: • 12<3? • 12-3<0? • 1100-0011 = 1100+1101 = 1001 = -7 • We have determined this won't work. • Ideas? C Code boolean SLTU(uint a, uint b){ return a<b; }

  15. Set Less Than Unsigned • Let’s add an extra zero to make them positive • 12<3? • 12-3<0? • 01100-00011 = 01100+11101 = 01001 = 9 • This does work. • Sign bit is only the XOR of 0, 1 and the last carry out bit. • If you're savvy, you'll notice this is simply the NOT of the carry-out bit. C Code boolean SLTU(uint a, uint b){ return a<b; }

  16. Shifting • The output bits choose their bit based on the input shamt • Implemented using MUXes. • We made it faster by converting shamt to one-hot encoding. • No cascading of MUXes • Uses a bunch of and gates in parallel • Any ”leftover” bits are 0's. C Code uint SLL(uint a, intshamt){ return a<<shamt; }

  17. Logic Operations • AND • OR • NOR • In order to complete these operations we use bitwise, AND, OR, and NOR. • Uses 32 gates for each operation. C Code int AND(int a, int b){ return a&b; }

  18. Load Upper Immediate • Returns the value of the immediate shifted left 16 times. • Reusing SLL complicates the logic of the ALU circuit. • Uses a dedicated 16-shift left module. C Code int LUI(int a){ return a<<16; }

  19. ALU Control • How is the ALU controlled? • How can we accomplish this? • Alternative options?

  20. ALU Control • Nearly every operation is computer in parallel • When ADDU is performed, SUBU, SLT and SLTU are not, and vice-versa • There is a MUX inside the ALU • The MUX chooses the output based on the requested operation

  21. ALU Control • How was this accomplished? • One hot encoding • SIG0 is for indicating the adder must do subtraction.

  22. ALU Control • Alternative Options • Binary Encoding • One Cold Encoding • We use one hot to make the MUX less complex • Just as we did for the SLL and SRL

  23. Immediates • Adding special instructions for immediates would be painstaking and wasteful • Determine second input from outside the ALU

  24. Immediate Datapath

  25. PC ManipulationMoving About the Code

  26. PC Manipulation Overview • Dynamic alteration of the PC allows for programs to be non-linear • Greatly increases the capability of computers

  27. Branching • Branch instructions modify the program counter to skip over sections of code or to go back to repeat previous code. • Our branches allow for conditional movement to an offset.

  28. Conditional Branch • BEQ: Branches when the values in the two registers are equal • BNE: Branches when the values in the two registers aren’t equal • Two things must be calculated: • New address • Comparison C Code if(a == b) goto c; /* BEQ */ if(a != b) goto c; /* BNE */

  29. Conditional Branch • Solution: dedicated adder to calculate new address • The ALU can then do the comparison • Extra output to determine if subtraction results in a 0 C Code if(a == b) goto c; /* BEQ */ if(a != b) goto c; /* BNE */

  30. Branching Datapath

  31. Jumping • Jumps unconditionally change the PC • Their addresses are absolute rather than offsets of the current PC C Code goto c;

  32. Jumps • Two unlinked jumps • Jump(J): jumps directly to the instruction in the immediate field • Jump Register (JR): jumps to the instruction whose location is the value of the given register C Code goto 0xDEADBEEF; /* J */ goto c; /* JR */

  33. Jumping Datapath

  34. Linked Jumps • Two linked jumps • Jump and Link(JAL): jumps to the instruction in the immediate field and saves the return address in $ra • Jump and Link Register (JALR): jumps to the instruction in the immediate field and saves the return address in the specified register C Code $ra = PC+8; goto 0xDEADBEEF;

  35. Linked Jumps • Linked jumps record the address of PC+8 • This is the instruction after the delay slot instruction • More MUXes on the ALU inputs to choose when return the link address C Code $ra = PC+8; goto 0xDEADBEEF;

  36. Linked Jumping Datapath

  37. PC Change Determination • PC will change on a successful branch or a jump command • Use and a combination of AND gates and an OR gate • Use JUMP? bit to choose the new address C Code if(BEQ && !Not Zero || BNE && Not Zero || Jump){ gotoNewAddress; }

  38. MEMORY INTERFACINGLoading and Storing

  39. Memory Interfacing Overview • There are a limited number of registers in the CPU • To maintain and obtain more data, we need to be able to access a larger pool of data

  40. Load Word • Loads some word into a register from memory • The address is determined by adding an offset to the first operand • Easily implemented in the ALU C Code b = mem[a+0x000016]

  41. Store Word • Stores a register to memory • We use the same method as load word to calculate the address C Code mem[a+0x000016] = b

  42. Memory Datapath

  43. Conclusion • Three design points: • ALU • PC Manipulation • Memory Accesses • Take advantage of repeated logic • If all else fails, more hardware

  44. Questions

  45. Works Cited • Confucius • http://www.all-famous-quotes.com/images/uploads/confucius1.jpg • Exeggutor • http://www.pokecommunity.com/signaturepics/sigpic136542_1.gif • Block Diagram • http://upload.wikimedia.org/wikipedia/commons/thumb/e/ea/MIPS_Architecture_%28Pipelined%29.svg/800px-MIPS_Architecture_%28Pipelined%29.svg.png • Doctor of Math • http://brownsharpie.courtneygibbons.org/?p=452 • Flowchart • http://xkcd.com/210/ • Bank Branch • http://media.glassdoor.com/m/7f/db/98/f9/a-typical-suntrust-bank-branch-this-one-located-at-4235-university-drive.jpg • Navy Seal • http://upload.wikimedia.org/wikipedia/commons/c/cf/NavySeal.png • One Tree Hill • http://gmovietrends.com/wp-content/uploads/2010/11/One-Tree-Hill.jpg • Van Halen • http://flavio.castelli.name/wp-content/uploads/2010/08/van-halen-jump.jpeg • Paratroopers • http://upload.wikimedia.org/wikipedia/commons/1/13/720th_Special_Tactics_Group_airmen_jump_20071003.jpg • Jumper • http://www.themovieblog.com/wp-content/uploads/2007/12/jumper-poster-2.jpg • Jumping Spider • http://fc03.deviantart.net/fs23/f/2007/356/1/a/green_jumping_spider_closeup_by_troypiggo.jpg • RAM Upgrade • http://farm1.static.flickr.com/145/329883185_6b80bde503.jpg • Battering Ram • http://4.bp.blogspot.com/_86fa3woQOHU/SwPiRaktsdI/AAAAAAAAA4c/pn35L4Ei7B8/s1600/BatteringRam.jpg • Tron Ram • http://obsoletegamer.com/wp-content/uploads/2010/03/RamMyBuddy300.jpg • Animal Ram • http://www.bigfoto.com/themes/nature/animals/ram-animal-i4t.jpg • Fry • http://scalp.plaxmol.com/wp-content/uploads/2009/02/fry-panique-questions.jpg

More Related