Computer Science 210 Computer Organization Control Circuits (Decoder and Multiplexer) Arithmetic and Logic Unit (ALU)
Control Circuits Control circuits are special circuits that are used to control other circuit components. Enable or disable components. Select one of many components. Determine which operation is performed. Two types we’ll study now: Decoders Multiplexers
Decoder N input lines 2N output lines Each setting of the input lines “selects” one of the output lines to be 1 with the other output lines being 0.
Decoder O0: _ _ I1 I0 O1: _ I1 I0 O2: _ I1 I0 O3: I1 I0 O0 I1 O1 O2 I0
Some uses of decoders The inputs could be bits of a memory address, and the decoder could select the memory cell to activate. The inputs could be bits in an instruction telling what type of operation is to be performed, and the decoder could activate the appropriate machine components.
Multiplexer (Mux) 2N input lines N control lines 1 output line The control lines “select” which of the input lines is “passed on” to the output.
Construction of 4-input Mux 1. Decoder with controls as inputs
2. Add an input to each AND gate
3. Send outputs to an OR gate. C1 C0 I0 I1 I2 I3 O
Some uses of multiplexers Select which of several computers connected to single printer can print. Decide which of several completed operations should be sent to the output.
Arithmetic and Logic Unit (ALU) Most of the calculations performed in the hardware are done in the ALU Can do arithmetic (addition or substraction) and logic simultaneously Select a result based on a machine code (a sequence of bits)
ALU Building Blocks NOT Gate AND Gate Multiplexer OR Gate
1-Bit Logical Unit Operation Result 0 1 0 - And Operation 1 - Or
1-Bit ALU with Addition O p e r a t i o n C a r r y I n a 1 R e s u l 1 R e s u l t 2 b C a r r y O u t
32 bit ALU
What about subtraction (a – b) ? Two's complement approach: just negate b and add one. How do we negate?
32 bit ALU binvert binvert O p e r a t i o n C a r r y I n a 1 R e s u l t b + 2 1 C a r r y O u t binvert = 1, carryin = 1, operation = 2, gives a + ~b + 1 = a - b
High Order 1-Bit ALU (with overflow hardware) n v e r t O p e r a t i o n C a r r y I n a 1 R e s u l t b 2 1 Overflow C a r r y O u t
For Monday Circuits for Memory