1 / 19

Tutorial: Wednesday Week 3

Tutorial: Wednesday Week 3. Hand in on Monday, Do the questions for tutorials 1 & 2 at the back of the course notes (answers to tutorial 3 will be published on-line). Addition & Subtraction. Addition. B. A. B. A. B. A. 2. 2. 1. 1. 0. 0. C. = 1. IN. B. A. C. B. A. C. B.

darva
Download Presentation

Tutorial: Wednesday Week 3

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. Tutorial: Wednesday Week 3 • Hand in on Monday, • Do the questions for tutorials 1 & 2 at the back of the course notes • (answers to tutorial 3 will be published on-line)

  2. Addition & Subtraction Addition B A B A B A 2 2 1 1 0 0 C = 1 IN B A C B A C B A C IN IN IN Subtraction Full Adder Full Adder Full Adder C C C SUM SUM SUM OUT OUT OUT Q Q Q 2 1 0

  3. Add / Sub Circuits Comparison • Both the addition and subtraction circuits are based around the parallel adder (using either ripple carry or carry-look-ahead). • For addition: • A and B are inputted directly to the adder • CIN = 0 • For subtraction: • A is inputted directly • All the bits of B are complemented • CIN = 1

  4. ADD/SUB BIN(n) Bn 0 0 0 0 1 1 1 0 1 1 1 0 An Adder / Subtraction Circuit

  5. ACTION When this signal is high, do action. ACTION When this signal is low, do action. When this signal is high, do action 1; when it’s low, do action 2. ACTION1 / ACTION2 When this signal is high, subtract; when it’s low, add. ADD / SUB Notation • To clarify a notational issue regarding the labelling of digital signals.

  6. Arithmetic Logic Units • An Arithmetic Logic Unit (ALU) is a general purpose device capable of various arithmetic and logical operations. • The adder/subtractor circuit is an example of a simple ALU. • It is capable of two operations, decided by a single control input. • More elaborate ALUs are capable of numerous different operations, depending on the state of a control input word.

  7. Logical Operations • As the name suggests, ALUs perform both arithmetic and logical operations. • AND, OR, XOR etc. • These operations are performed in a ‘bit-wise’ fashion. • I.e. Output bit Qn depends only on the input bits An and Bn.

  8. Bitwise Logic Examples If A = 1010 and B = 1001: A AND B = 1000 A OR B = 1011 A XOR B = 0011 A NAND B = 0111 A NOR B = 0100

  9. S A B X 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 1 1 1 1 1 Logical Operations • For a single bit, imagine a logic gate that can be programmed to act either as an AND or an OR gate… X A B AND/OR Select (S)

  10. Minimisation

  11. 2-Bit Simple ALU AND/OR A0 B0 X0 A1 B1 X1

  12. Practical ALUs • A practical ALU can perform several different operations on two multiple bit input words, A and B. • The operation is selected by a control input word, S. • Like the ADD/SUB and AND/OR circuits, the contents of all ALUs are just a big block of combinational logic. • Take, for example, the 74F382 ALU integrated circuit…

  13. 74F382 • Two 4-bit input words, A and B, plus carry-in. • One 4-bit output, F, plus carry-out. • 3-bit control input word, S, eight possible permutations.

  14. S2 S1 S0 Operation 0 0 0 Clear 0 0 1 B minus A 0 1 0 A minus B 0 1 1 A plus B 1 0 0 A XOR B 1 0 1 A AND B 1 1 0 A OR B 1 1 1 Set 74F382 Operations (All output bits set to zero) (bit-wise logical operations) (All output bits set to one)

  15. Example Operations • (5)10 - (3)10 or (0101)2 - (0011)2 • (0101)2 XOR (0011)2

  16. It’s Only Logic…

  17. ALU limitations • Being just logic, ALUs require all the inputs to be present at once. • They have no memory. We’ll look at adding some next time. A B S F ALU

  18. Adding Memory • Neither people or computers like having to press lots of buttons at once. • We’d both prefer a system that could remember inputs… Memory Memory A B S F ALU

  19. Summary • It is reasonably straightforward to modify the adder circuit to perform either addition or subtraction (depending on a control input). • This forms a simple ALU. • Practical ALUs are capable of a wide variety of arithmetic and logical operations. • The operation is selected by a control input selection word, S. • Despite their complexity, they are only logic.

More Related