Download presentation
Presentation is loading. Please wait.
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 Full Adder B A C IN C OUT SUM Full Adder B A C IN C OUT SUM Full Adder B A C IN C OUT SUM B 1 A 1 B 0 A 0 B 2 A 2 C IN = 1 Q 1 Q 0 Q 2 Addition Subtraction
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 C IN = 0 For subtraction: A is inputted directly All the bits of B are complemented C IN = 1
4
An Adder / Subtraction Circuit 011 101 110 000 BnBn B IN(n) ADD/SUB
5
Notation To clarify a notational issue regarding the labelling of digital signals. ACTION When this signal is high, do action. ACTION When this signal is low, do action. ACTION1 / ACTION2 When this signal is high, do action 1; when it’s low, do action 2. ADD / SUB When this signal is high, subtract; when it’s low, add.
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 Q n depends only on the input bits A n and B n.
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
Logical Operations For a single bit, imagine a logic gate that can be programmed to act either as an AND or an OR gate… ABAB X AND/OR Select (S) 1111 1011 1101 0001 1110 0010 0100 0000 XBAS
10
Minimisation S \ AB 00011110 00010 10111
11
2-Bit Simple ALU AND/OR A0B0A0B0 X0X0 A1B1A1B1 X1X1
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
74F382 Operations S2S2 S1S1 S0S0 Operation000Clear001B minus A010A minus B 011A plus B 100A XOR B101A AND B110A OR B111Set (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. ALU AB FS
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… ALU AB FS Memory
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.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.