CBP 2002ITY 270 Computer Architecture1 Digital Logic This Time … Control Path, Arithmetic Ops 12 a U1 34 b Last Time …
CBP 2002ITY 270 Computer Architecture2 Data Memory Code Memory ALU X Y W XY W Digital Logic Where? Control Circuits – CPU control path - system board (later) ALU Structure – add, sub, and, or, not MUXES Address Decoder
CBP 2002ITY 270 Computer Architecture3 Boolean Notation, Truth Tables A and B AB A or B A + B NOT A A _ ABC Easy Way to write truth tables - count in binary ! A B O A B O A O ABO ABO AO 01 10
CBP 2002ITY 270 Computer Architecture4 Digi Logic Design 1 - use Gates A B C O ABCO O ABC _ _ _ A B C A B C A B C _ _ ABC + ABC + ABC + ABC _ _ _ Majority Function
CBP 2002ITY 270 Computer Architecture5 A B C ABC + ABC + ABC + ABC ABC _ _ _ __ _
CBP 2002ITY 270 Computer Architecture6 Address Decoder Exercise AB O1O1 O2O2 O3O3 O4O A B O1 O2 O3 O4 O1 = AB _ _ A B
CBP 2002ITY 270 Computer Architecture7 r0 Decoder Application r1 r2 r0 X Y W XY W Selecting Registers, e.g, add r2,r1,r0 MIPS has 5-bit fields for registers, so are 32 addrdrsrtunused 0 cs r0 Registers decoder
CBP 2002ITY 270 Computer Architecture8 MUX Exercise CABO A B Op C A B O C = 0 A B O C = 1 What is MUX doing here ?
CBP 2002ITY 270 Computer Architecture9 MUX is a Selector A B Op C A B C
CBP 2002ITY 270 Computer Architecture10 Multibit MUX A B O C A B C
CBP 2002ITY 270 Computer Architecture11 MUX Application ALU Y’ Y Selection of Datapath into one ALU input. Datapath Y from instruction add r2,r0,r1 Datapth Y’ from instruction addi r2,r0,4 Sam has been designed so all immediate constants come in via Y’ addrdrsrtunused Immediate bit of op-code
CBP 2002ITY 270 Computer Architecture12 Address/Data Bus MUXing CPUMEM addr data CPUMEM add/dat address data address data Multiplexed Address/Data Bus, e.g. PCI Bus Pentium System Bus
CBP 2002ITY 270 Computer Architecture13 Digi design 2 - use MUXes ABO 00I1 01I2 10I3 11I4 A B Op In 1 In 2 In 3 In 4 ABO A B Op “ Muxes can be used to implement arbitrary combinatorial circuits “
CBP 2002ITY 270 Computer Architecture14 MUX Design Exercise 3 input parity detector ABCO
CBP 2002ITY 270 Computer Architecture15 Designing Using ROM/RAM A B O A B O decoder A B O O Several MUX’es fed with the same AB produce a multibit output. So does a ROM or RAM.
CBP 2002ITY 270 Computer Architecture16 Programmable Logic Arrays Fuse ABC _ majority
CBP 2002ITY 270 Computer Architecture17 Addition of Binary Numbers Sum = 1 Carry = 0 A B Sum = 0 Carry = 1 A B Multibit add - cascade sum and carry ops.
CBP 2002ITY 270 Computer Architecture18 Full Adder ABCiSCo S Full Adder B A Carry In Carry OutSum
CBP 2002ITY 270 Computer Architecture19 Full Adder ABCiOCo O A B C SUMSUM A B C CARRYCARRY
CBP 2002ITY 270 Computer Architecture20 4-bit Adder Full Adder a3a2a1a0 b3b2b1b0 s3 0 Carry Out
CBP 2002ITY 270 Computer Architecture21 Let’s Build an ALU + B A Carry In Carry Out S1 S0
CBP 2002ITY 270 Computer Architecture22 Issues Concerning Numbers Multiplication and Division Subtraction Negative Numbers Fractional and Real Numbers Characters and Strings
CBP 2002ITY 270 Computer Architecture23 Sequential Circuits Traffic Lights Washing Machines Fetch-Execute Cycle
CBP 2002ITY 270 Computer Architecture24 Counters T0T1T2T3T Clock 4-bit Counter (4) Reset How to get this to sequence ?
CBP 2002ITY 270 Computer Architecture25 Traffic Light Sequencing Clock 4-bit Counter (4) Reset T0T1T2T3 Combinatorial Logic T2 T3 T0 T1
CBP 2002ITY 270 Computer Architecture26 Fetch Execute Sequencing T1T2T3T4T5 Fetch Decode, Reg Op ALU Op Mem Access Reg Write ALU ALU Counter Decoder Clock Data Memory Code Memory AL U X Y W XY W 0 1 7
CBP 2002ITY 270 Computer Architecture27 Representing Numbers Let’s take some 3-bit numbers. “2’s Complement” – complement it (0->1 and 1->0) then add 1
CBP 2002ITY 270 Computer Architecture28 2’s Complement Properties Most Significant Bit (MSB) gives sign. Addition ? = 3 + (-2) = 1 Subtraction by Addition MSB is Sign Bit !
CBP 2002ITY 270 Computer Architecture29 Full Adder a3a2a1a0 b3 b2b1 b0 s3 1 Subtraction by Addition
CBP 2002ITY 270 Computer Architecture30 HEX and Chars Hexadecimal Shorthand each nibble rep’d as a character … B 7 BinaryHex A B C D E 1 1 F Useful in Machine Level Programming and HTML scripting HEXAscii A 61a 6Dm 0DCR ASCII UNICODE
CBP 2002ITY 270 Computer Architecture31 Multiplication x x x
CBP 2002ITY 270 Computer Architecture32 Multiplication B 1101 C Initial values Add A to B SHR Add A to B SHR No Add SHR Add A to B A C Add/no-add A adder B Add A to B. Then Shift Right (SHR). Look at LSB bit. If this is 1 then Add A to B. A = B = AxB =