Introduction Digital systems (logic design, digital logic, switching circuits) are employed in: computers data communication control systems many other fields Things you'll be learning: how computers work at the gate level (the lowest level to discuss without an engineering background) how to build a simple CPU (central processing unit) Why learn this stuff? you want to call yourself a “computer scientist” you need to make a purchasing decision or offer “expert” advice
Computers What is a computer? input (mouse, keyboard) output (display, printer) memory (disk drives, DRAM, SRAM, CD) network Impossible to understand by looking at each transistor. We need ...
Levels of abstraction Software: Application Operating system Firmware Instruction set architecture: Data type and structures: encodings and machine representation Instruction set Instruction formats Addressing modes and accessing data and instructions Hardware: Instruction set processing I/O System Digital design Circuit design Layout
Example: from instructions to gates Programming level C: A = B + C Assembler: add $t0, $s1, $s2 Machine instruction: decimal: 17 18 8 32 binary: 000000 10001 10010 01000 00000 100000
Example: from instructions to gates Datapath and control PC Instruction memory Read address Instruction [31– 0] Instruction [20 16] Instruction [25 21] Add Instruction [5 0] MemtoReg ALUOp MemRead RegDst Branch MemWrite ALUSrc RegWrite Instruction [31 26] 4 16 32 Instruction [15 0] M u x 1 Control Add ALU result M u x 1 Read data 1 Write data 2 register Write data Read register 1 Read register 2 Registers Read Sign extend M u x 1 Zero PCSrc Data memory Write data Read data 1 M u x Instruction [15 11] ALU control Shift left 2 ALU ALU result Address
Example: from instructions to gates Register file and ALU Instruction ALU Zero ALU result Read register 1 Read Read data 1 register 2 Registers Write register Read Write data 2 data RegWrite ALU operation 3
Example: from instructions to gates Inside register file M u x Register Register 1 Register n – 1 Register n M u x Read data 1 Read data 2 Read register number 1 Read register number 2 Register Register 1 C Register n – 1 D C Register n D C D C D 1 n- to- 1 decoder n – 1 n Register number Write Register data
Example: from instructions to gates Arithmetic Logic Unit (ALU) b 2 Result Operation a 1 CarryIn CarryOut Result31 a31 b31 Result0 CarryIn a0 b0 Result1 a1 b1 Result2 a2 b2 Operation ALU0 CarryIn CarryOut ALU1 CarryIn CarryOut ALU2 CarryIn CarryOut CarryIn ALU31 ALU Zero Result Overflow a b ALU operation CarryOut
Example: from instructions to gates CarryOut = b.CarryIn + a.CarryIn + a.b + a.b.CarryIn or CarryOut = b.CarryIn + a.CarryIn + a.b b CarryOut a CarryOut CarryIn Full Adder CarryIn a Sum b
Example: from instructions to gates Logic gates a b c = a + b 1 1 1 1 1 1 1 a b c = a . b 1 1 1 1 1 a b c a b c a c 1 1 c = a' a 1. AND gate (c = a . b) 2. OR gate (c = a + b) 3. Inverter (c = a'