Arithmetic and Logic Unit First Part

Size: px
Start display at page:

Download "Arithmetic and Logic Unit First Part"

Transcription

1 Arithmetic and Logic Unit First Part Arquitectura de Computadoras Arturo Díaz D PérezP Centro de Investigación n y de Estudios Avanzados del IPN adiaz@cinvestav.mx Arquitectura de Computadoras ALU1-1

2 Typical Operations Data Movement Arithmetic Shift Logical Load (from memory) Store (to memory) memory-to-memory move register-to-register move input (from I/O device) output (to I/O device) push, pop (to/from stack) integer (binary + decimal) or FP Add, Subtract, Multiply, Divide shift left/right, rotate left/right not, and, or, set, clear Arquitectura de Computadoras ALU1-2

3 Operands for ALU instructions ALU instructions combine operands (e.g. ADD) Number of explicit operands Two - destination equals one source Three - orthogonal Arquitectura de Computadoras ALU1-3

4 MIPS Addressing Modes/Instruction Formats All instructions 32 bits wide Register (direct) op rs rt rd register Immediate op rs rt immed Base+index op rs rt immed Memory register + PC-relative op rs rt immed Memory Register Indirect? PC + Arquitectura de Computadoras ALU1-4

5 MIPS: Register State 32 integer registers $0 ishardwaredto0 $31 is the return address register software convention for other registers 32 single-precision FP registers or 16 doubleprecision FP registers PC and other special registers Arquitectura de Computadoras ALU1-5

6 MIPS I Operation Overview Arithmetic Logical: Add, AddU, Sub, SubU, And, Or, Xor, Nor, SLT, SLTU AddI, AddIU, SLTI, SLTIU, AndI, OrI, XorI, LUI SLL, SRL, SRA, SLLV, SRLV, SRAV Memory Access: LB, LBU, LH, LHU, LW, LWL,LWR SB, SH, SW, SWL, SWR Arquitectura de Computadoras ALU1-6

7 MIPS arithmetic instructions Instruction Example Meaning Comments add add $1,$2,$3 $1 = $2 + $3 3 operands; exception possible subtract sub $1,$2,$3 $1 = $2 $3 3 operands; exception possible add immediate addi $1,$2,100 $1 = $ constant; exception possible add unsigned addu $1,$2,$3 $1 = $2 + $3 3 operands; no exceptions subtract unsigned subu $1,$2,$3 $1 = $2 $3 3 operands; no exceptions add imm. unsign. addiu $1,$2,100 $1 = $ constant; no exceptions multiply mult $2,$3 Hi, Lo = $2 x $3 64-bit signed product multiply unsigned multu$2,$3 Hi, Lo = $2 x $3 64-bit unsigned product divide div $2,$3 Lo = $2 $3, Lo = quotient, Hi = remainder Hi = $2 mod $3 divide unsigned divu $2,$3 Lo = $2 $3, Unsigned quotient & remainder Hi = $2 mod $3 Move from Hi mfhi $1 $1 = Hi Used to get copy of Hi Move from Lo mflo $1 $1 = Lo Used to get copy of Lo Which add for address arithmetic? Which add for integers? Arquitectura de Computadoras ALU1-7

8 MIPS logical instructions Instruction Example Meaning Comment and and $1,$2,$3 $1 = $2 & $3 3 reg. operands; Logical AND or or $1,$2,$3 $1 = $2 $3 3 reg. operands; Logical OR xor xor $1,$2,$3 $1 = $2 $3 3 reg. operands; Logical XOR nor nor $1,$2,$3 $1 = ~($2 $3) 3 reg. operands; Logical NOR and immediate andi $1,$2,10 $1 = $2 & 10 Logical AND reg, constant or immediate ori $1,$2,10 $1 = $2 10 Logical OR reg, constant xor immediate xori $1, $2,10 $1 = ~$2 &~10 Logical XOR reg, constant shift left logical sll $1,$2,10 $1 = $2 << 10 Shift left by constant shift right logical srl $1,$2,10 $1 = $2 >> 10 Shift right by constant shift right arithm. sra $1,$2,10 $1 = $2 >> 10 Shift right (sign extend) shift left logical sllv $1,$2,$3 $1 = $2 << $3 Shift left by variable shift right logical srlv $1,$2, $3 $1 = $2 >> $3 Shift right by variable shift right arithm. srav $1,$2, $3 $1 = $2 >> $3 Shift right arith. by variable Arquitectura de Computadoras ALU1-8

9 Details of the MIPS instruction set Register zero always has the value zero (even if you try to write it) Branch/jump and link put the return addr. PC+4 or 8 into the link register (R31) (depends on logical vs physical architecture) All instructions change all 32 bits of the destination register (including lui, lb, lh) and all read all 32 bits of sources (add, sub, and, or, ) Immediate arithmetic and logical instructions are extended as follows: logical immediates ops are zero extended to 32 bits arithmetic immediates ops are sign extended to 32 bits (including addu) The data loaded by the instructions lb and lh are extended as follows: lbu, lhu are zero extended lb, lh are sign extended Overflow can occur in these arithmetic and logical instructions: add, sub, addi it cannot occur in addu, subu, addiu, and, or, xor, nor, shifts, mult, multu, div, divu Arquitectura de Computadoras ALU1-9

10 MIPS: Instruction Set Format load/store architecture with 3 explicit operands (ALU ops) fixed 32-bit instructions 3 instruction formats» R-Type» I-Type» J-Type 6 instruction set groups:» load/store - data movement operations» computational - arithmetic, logical, and shift operations» jump/branch - including call and returns» coprocessor - FP instructions» coprocessor0 - memory management and exception handling» special - accessing special registers, system calls, breakpoint instructions, etc. Arquitectura de Computadoras ALU1-10

11 R2000/3000 Instruction Formats R-type (register) e.g. add $8, $17, $18 # $8 = $17 + $ OpCode rs rt rd shamt funct Arquitectura de Computadoras ALU1-11

12 R2000/3000 Instruction Formats I-type (immediate) e.g. addi $8, $17, -44 # $8 = $17-44 lw $8, -44($17) # $8 = M[$17-44] beq $17, $8, label # if( $8 == $17) go to label: OpCode rs rt immediate op Arquitectura de Computadoras ALU1-12

13 R2000/3000 Instruction Formats J-type (jump) e.g. jump label # call label: ; $31 = $pc OpCode target Arquitectura de Computadoras ALU1-13

14 Arquitectura de Computadoras ALU1-14

15 5 Steps of DLX Datapath Instruction Fetch Instruction Decode/ Register Fetch Execute Addr. Calc. Memory Access Write Back M u x 4 Add NPC Zero? PC Inst. Memory IR Registers A B M u x M u x SMD Add ALU Output Data Memory LMD M u x 16 Sign Extend 32 Arquitectura de Computadoras ALU1-15

16 Useful Circuits for Interconnection Four common and useful MSI circuits are: Decoder Demultiplexer Encoder Multiplexer Block-level outlines of MSI circuits: code decoder entity entity encoder code input mux data data demux output select select Arquitectura de Computadoras ALU1-16

17 Decoders Codes are frequently used to represent entities These codes can be identified (or decoded) using a decoder. Given a code, identify the entity. Convert binary information from n input lines to (max. of) 2n output lines. Known as n-to-m-line decoder, or simply n:m or n m decoder (m 2n). May be used to generate 2n (or fewer) minterms of n input variables. Arquitectura de Computadoras ALU1-17

18 Decoders Example: if codes 00, 01, 10, 11 are used to identify four light bulbs, we may use a 2-bit decoder: 2-bit code X Y 2x4 Dec F 0 F 1 F 2 F 3 Bulb 0 Bulb 1 Bulb 2 Bulb 3 This is a 2 4 decoder which selects an output line based on the 2-bit code supplied. Truth table: X Y F 0 F 1 F 2 F Arquitectura de Computadoras ALU1-18

19 Encoder Encoding is the converse of decoding. Given a set of input lines, where one has been selected, provide a code corresponding to that line. Contains 2n (or fewer) input lines and n output lines. Implemented with OR gates. An example: Select via switches F 0 F 1 F 2 F 3 4-to-2 Encoder D 0 D 1 2-bits code Arquitectura de Computadoras ALU1-19

20 Encoder Truth table: F 0 F 1 F 2 F 3 D 1 D X X X X X X X X X X X X X X X X X X X X X X X X Arquitectura de Computadoras ALU1-20

21 Encoder With the help of K-map (and don t care conditions), can obtain: D0 = F1 + F3 D1 = F2 + F3 which correspond to circuit: F 0 F 1 D 0 F 2 F 3 D 1 Simple 4-to-2 encoder Arquitectura de Computadoras ALU1-21

22 Demultiplexer Given an input line and a set of selection lines, the demultiplexer will direct data from input to a selected output line. An example of a 1-to-4 demultiplexer: Outputs Data D demux Y 0 = D.S 1 '.S 0 ' Y 1 = D.S 1 '.S 0 Y 2 = D.S 1.S 0 ' Y 3 = D.S 1.S 0 S 1 S o Y 0 Y 1 Y 2 Y D D D D S 1 S 0 select Arquitectura de Computadoras ALU1-22

23 Demultiplexer The demultiplexer is actually identical to a decoder with enable, as illustrated below: S 1 S 0 2x4 Decoder E Y 0 = D.S 1 '.S 0 ' Y 1 = D.S 1 '.S 0 Y 2 = D.S 1.S 0 ' Y 3 = D.S 1.S 0 D Exercise: Provide the truth table for above demultiplexer. Arquitectura de Computadoras ALU1-23

24 Multiplexer A multiplexer is a device which has (i) a number of input lines (ii) a number of selection lines (iii) one output line It steers one of 2n inputs to a single output line, using n selection lines. Also known as a data selector. inputs : 2 n :1 Multiplexer output... select Arquitectura de Computadoras ALU1-24

25 Multiplexer Truth table for a 4-to-1 multiplexer: I 0 I 1 I 2 I 3 S 1 S 0 Y d 0 d 1 d 2 d d 0 d 0 d 1 d 2 d d 1 d 0 d 1 d 2 d d 2 d 0 d 1 d 2 d d 3 S 1 S 0 Y 0 0 I I I I 3 Inputs I 0 I 1 I 2 I :1 MUX Y S 1 S 0 Output Inputs I 0 I 1 I 2 I 3 mux Y select S 1 S 0 select Arquitectura de Computadoras ALU1-25

26 Arquitectura de Computadoras ALU1-26

27 Binary Representation b 31 b 30 b 29 b 28 b 3 b 2 b 1 b 0 b b b b b2 2 + b1 2 + b = = = = Arquitectura de Computadoras ALU1-27

28 Signed Numbers Sign+Magnitude For n-bit numbers, the most significant bit is reserved for sign = = Sign Magnitude Arquitectura de Computadoras ALU1-28

29 Signed Numbers For n-bit numbers, the negation of B in two s complement is 2 n - B (this is one of the alternative ways of negating a two s-complement number). -B = (2 n -B) = Arquitectura de Computadoras ALU1-29

30 Signed Numbers For n-bit numbers, the negation of B in two s complement is 2 n - B (this is one of the alternative ways of negating a two s-complement number). -B = (2 n -B) = = Arquitectura de Computadoras ALU1-30

31 Signed Number Systems Here are all the 4-bit numbers in the different systems. Positive numbers are the same in all three representations. Signed magnitude and one s complement have two ways of representing 0. This makes things more complicated. Two s complement has asymmetric ranges; there is one more negative number than positive number. Here, you can represent -8 but not +8. However, two s complement is preferred because it has only one 0, and its addition algorithm is the simplest. Decimal S.M. 1 s comp. 2 s comp Arquitectura de Computadoras ALU1-31

32 Sign extension In everyday life, decimal numbers are assumed to have an infinite number of 0s in front of them. This helps in lining up numbers. To subtract 231 and 3, for instance, you can imagine: You need to be careful in extending signed binary numbers, because the leftmost bit is the sign and not part of the magnitude. If you just add 0s in front, you might accidentally change a negative number into a positive one! For example, going from 4-bit to 8-bit numbers: 0101 (+5) should become (+5). But 1100 (-4) should become (-4). The proper way to extend a signed binary number is to replicate the sign bit, so the sign is preserved. Arquitectura de Computadoras ALU1-32

33 Two s s complement addition Negating a two s complement number takes a bit of work, but addition is much easier than with the other two systems To find A + B, you just have to: Do unsigned addition on A and B, including their sign bits. Ignore any carry out. For example, to find , or (+7) + (-4): First add as unsigned numbers: Discard the carry out (1). The answer is 0011 (+3) Arquitectura de Computadoras ALU1-33

34 Another two s s complement example Let s try adding two negative numbers , or (-3) + (-2) in decimal. Adding the numbers gives 11011: Dropping the carry out (1) leaves us with the answer, 1011 (-5). Arquitectura de Computadoras ALU1-34

35 Why does this work? For n-bit numbers, the negation of B in two s complement is 2 n - B (this is one of the alternative ways of negating a two s-complement number). A - B = A + (-B) = A + (2 n -B) = (A - B) + 2 n If A B, then (A - B) is a positive number, and 2 n represents a carry out of 1. Discarding this carry out is equivalent to subtracting 2 n, which leaves us with the desired result (A - B). If A < B, then (A - B) is a negative number and we have 2 n - (A - B). This corresponds to the desired result, -(A - B), in two s complement form. Arquitectura de Computadoras ALU1-35

36 Signed overflow With two s complement and a 4-bit adder, for example, the largest representable decimal number is +7, and the smallest is -8. What if you try to compute 4 + 5, or (-4) + (-5)? (+4) (+5) (-7) 1100 (-4) (-5) (+7) We cannot just include the carry out to produce a five-digit result, as for unsigned addition. If we did, (-4) + (-5) would result in +23! Also, unlike the case with unsigned numbers, the carry out cannot be used to detect overflow. In the example on the left, the carry out is 0 but there is overflow. Conversely, there are situations where the carry out is 1 but there is no overflow. Arquitectura de Computadoras ALU1-36

37 Detecting signed overflow The easiest way to detect signed overflow is to look at all the sign bits (+4) (+5) (-7) 1100 (-4) (-5) (+7) Overflow occurs only in the two situations above: If you add two positive numbers and get a negative result. If you add two negative numbers and get a positive result. Overflow cannot occur if you add a positive number to a negative number. Do you see why? Arquitectura de Computadoras ALU1-37

38 Refined Requirements (1) Functional Specification inputs: 2 x 32-bit operands A, B, 4-bit mode outputs: 32-bit result S, 1-bit carry, 1 bit overflow operations: add, addu, sub, subu, and, or, xor, nor, slt, sltu (2) Block Diagram (powerview symbol, VHDL entity) c ovf A ALU S 32 B m 4 Arquitectura de Computadoras ALU1-38

39 Gate-level Design: Half Adder Design procedure: 1) State Problem Example: Build a Half Adder to add two bits 2) Determine and label the inputs & outputs of circuit. Example: Two inputs and two outputs labeled, as follows: X Y 3) Draw truth table. Half Adder (X + Y) S C X Y C S Arquitectura de Computadoras ALU1-39

40 Gate-level Design: Half Adder 4) Obtain simplified Boolean function. Example: C = X.Y S = X'.Y + X.Y' = X Y X Y C S ) Draw logic diagram. X Y S Half Adder C Arquitectura de Computadoras ALU1-40

41 Gate-level Design: Full Adder Half-adder adds up only two bits. To add two binary numbers, we need to add 3 bits (including the carry). Example: carry X Y S Need Full Adder (so called as it can be made from two halfadders). X Y Z Full Adder S C (X + Y + Z) Arquitectura de Computadoras ALU1-41

42 Gate-level Design: Full Adder Truth table: X Y Z C S Note: Z - carry in (to the current position) C - carry out (to the next position) C YZ X 0 1 Using K-map, simplified SOP form: C = X.Y + X.Z + Y.Z S = X'.Y'.Z + X'.Y.Z'+X.Y'.Z'+X.Y.Z 1 YZ X S Arquitectura de Computadoras ALU1-42

43 Gate-level Design: Full Adder Alternative formulae using algebraic manipulation: C = X.Y + X.Z + Y.Z = X.Y + (X + Y).Z = X.Y + ((X Y) + X.Y).Z = X.Y + (X Y).Z + X.Y.Z = X.Y + (X Y).Z S = X'.Y'.Z + X'.Y.Z' + X.Y'.Z' + X.Y.Z = X.(Y'.Z + Y.Z') + X.(Y'.Z' + Y.Z) = X'.(Y Z) + X.(Y Z)' = X (Y Z) or (X Y) Z Arquitectura de Computadoras ALU1-43

44 Gate-level Design: Full Adder Circuit for above formulae: C = X.Y + (X Y).Z S = (X Y) Z X Y (X Y) S (XY) C Z Full Adder made from two Half-Adders (+ OR gate). Arquitectura de Computadoras ALU1-44

45 Gate-level (SSI) Design: Full Adder Circuit for above formulae: C = X.Y + (X Y).Z S = (X Y) Z Block diagrams. X Y X Y Half Adder Sum Carry (X Y) (X.Y) X Y Sum Half Adder Carry S C Z Full Adder made from two Half-Adders (+ OR gate). Arquitectura de Computadoras ALU1-45

46 4-bit Parallel Adder Consider a circuit to add two 4-bit numbers together and a carry-in, to produce a 5-bit result: X 4 X 3 X 2 X 1 Y 4 Y 3 Y 2 Y 1 4-bit C 5 Parallel Adder C 1 S 4 S 3 S 2 S 1 Black-box view of 4-bit parallel adder 5-bit result is sufficient because the largest result is: (1111) 2 +(1111) 2 +(1) 2 = (11111) 2 Arquitectura de Computadoras ALU1-46

47 4-bit Parallel Adder Truth table for 9 inputs very big, i.e. 2 9 =512 entries: X 4 X 3 X 2 X 1 Y 4 Y 3 Y 2 Y 1 C 1 C 5 S 4 S 3 S 2 S Simplification very complicated. Arquitectura de Computadoras ALU1-47

48 4-bit Parallel Adder Alternative design possible. Addition formulae for each pair of bits (with carry in), C i+1 S i = X i + Y i + C i has the same function as a full adder. C i+1 = X i.y i + (X i Y i ).C i S i = X i Y i C i Arquitectura de Computadoras ALU1-48

49 4-bit Parallel Adder Cascading 4 full adders via their carries, we get: Y 4 X 4 Y 3 X 3 Y 2 X 2 Y 1 X 1 C 4 C 3 C 2 C 5 FA FA FA FA C 1 Input S 4 S 3 S 2 S 1 Output Arquitectura de Computadoras ALU1-49

50 Parallel Adders Note that carry propagated by cascading the carry from one full adder to the next. Called Parallel Adder because inputs are presented simultaneously (in parallel). Also, called Ripple-Carry Adder. Arquitectura de Computadoras ALU1-50

51 16-bit Parallel Adder Larger parallel adders can be built from smaller ones. Example: a 16-bit parallel adder can be constructed from four 4-bit parallel adders: X 16..X 13 Y 16..Y 13 X 12..X 9 Y 12..Y 9 X 8..X 5 Y 8..Y 5 X 4..X 1 Y 4..Y C 17 4-bit // adder C 13 4-bit // adder C 9 4-bit // adder C 5 4-bit // adder C S 16..S 13 S 12..S 9 S 8..S 5 S 4..S 1 A 16-bit parallel adder Arquitectura de Computadoras ALU1-51

52 But What about Performance? Critical Path of n-bit Rippled-carry adder is n*cp CarryIn0 A0 B0 A1 B1 A2 B2 A3 B3 1-bit ALU CarryIn1 CarryOut0 1-bit ALU CarryIn2 CarryOut1 1-bit ALU CarryIn3 CarryOut2 1-bit ALU CarryOut3 Result0 Result1 Result2 Result3 Design Trick: Throw hardware at it Arquitectura de Computadoras ALU1-52

53 Calculation of Circuit Delays In general, given a logic gate with delay, t. t 1 t 2 t n : : Logic Gate max (t 1, t 2,..., t n ) + t If inputs are stable at times t 1,t 2,..,t n, respectively; then the earliest time in which the output will be stable is: max(t 1, t 2,.., t n ) + t To calculate the delays of all outputs of a combinational circuit, repeat above rule for all gates. Arquitectura de Computadoras ALU1-53

54 Calculation of Circuit Delays As a simple example, consider the full adder circuit where all inputs are available at time 0. (Assume each gate has delay t.) X Y 0 0 max(0,0)+t = t max(t,0)+t = 2t S t 2t max(t,2t)+t = 3t C Z 0 where outputs S and C, experience delays of 2t and 3t, respectively. Arquitectura de Computadoras ALU1-54

55 Calculation of Circuit Delays More complex example: 4-bits parallel adder. Y 4 X 4 Y 3 X 3 Y 2 X 2 Y 1 X 1 C 4 C 3 C C 5 FA FA FA FA 0 C 1 S 4 S 3 S 2 S 1 Arquitectura de Computadoras ALU1-55

56 Calculation of Circuit Delays Analyse the delay for the repeated block: X i Y i C i 0 0 mt Full Adder S i C i+1 where X i, Y i are stable at 0t, while C i is assumed to be stable at mt. Performing the delay calculation gives: X i Y i 0 0 max(0,0)+t = t max(t,mt)+t S i t max(t,mt)+t max(t,mt)+2t C i mt C i+1 Arquitectura de Computadoras ALU1-56

57 Calculation of Circuit Delays Calculating: When i=1, m=0: S 1 = 2t and C 2 = 3t. When i=2, m=3: S 2 = 4t and C 3 = 5t. When i=3, m=5: S 3 = 6t and C 4 = 7t. When i=4, m=7: S 4 = 8t and C 5 = 9t. In general, an n-bit ripple-carry parallel adder will experience: S n = ((n-1)*2+2)t C n+1 = ((n-1)*2+3)t as their delay times. Propagation delay of ripple-carry parallel adders is proportional to the number of bits it handles. Maximum Delay: ((n-1)*2+3)t Arquitectura de Computadoras ALU1-57

58 Faster Circuits Three ways of improving the speed of these circuits: (i) Use better technology (e.g. ECL faster than TTL gates), BUT (a) faster technology is more expensive, needs more power, lower-level of integrations. (b) physical limits (e.g. speed of light, size of atom). (ii) Use gate-level designs to two-level circuits! (use sumof-products/product-of-sums) BUT (a) complicated designs for large circuits. (b) product/sum terms need MANY inputs! (iii) Use clever look-ahead techniques BUT there are additional costs (hopefully reasonable). Arquitectura de Computadoras ALU1-58

59 Look-Ahead Carry Adder Consider the full adder: X i Y i C i P i G i S i C i+1 where intermediate signals are labelled as P i, G i, and defined as: P i = X i Y i G i = X i.y i The outputs, C i+1,s i, in terms of P i,g i,c i, are: S i = P i C i (1) C i+1 = G i + P i.c i (2) If you look at equation (2), G i = X i.y i is a carry generate signal P i = X i Y i is a carry propagate signal Arquitectura de Computadoras ALU1-59

60 Look-Ahead Carry Adder For 4-bit ripple-carry adder, the equations to obtain four carry signals are: C i+1 = G i + P i.c i C i+2 = G i+1 + P i+1.c i+1 C i+3 = G i+2 + P i+2.c i+2 C i+4 = G i+3 + P i+3.c i+3 These formula are deeply nested, as shown here for C i+2 : C i P i C i+1 G i P i+1 G i+1 C i+2 4-level circuit for C i+2 = G i+1 + P i+1.c i+1 Arquitectura de Computadoras ALU1-60

61 Look-Ahead Carry Adder Nested formula/gates cause ripple-carry propagation delay. Can reduce delay by expanding and flattening the formula for carries. For example, C i+2 C i+2 = G i+1 + P i+1.c i+1 = G i+1 + P i+1.(g i + P i.c i ) = G i+1 + P i+1.g i + P i+1.p i.c i New faster circuit for C i+2 C i P i P i+1 G i P i+1 C i+2 G i+1 Arquitectura de Computadoras ALU1-61

62 Look-Ahead Carry Adder Other carry signals can also be similarly flattened. C i+3 = G i+2 + P i+2 C i+2 = G i+2 + P i+2 (G i+1 + P i+1 G i + P i+1 P i C i ) = G i+2 + P i+2 G i+1 + P i+2 P i+1 G i + P i+2 P i+1 P i C i C i+4 = G i+3 + P i+3 C i+3 = G i+3 + P i+3 (G i+2 + P i+2 G i+1 + P i+2 P i+1 G i + P i+2 P i+1 P i C i ) = G i+3 + P i+3 G i+2 + P i+3 P i+2 G i+1 + P i+3 P i+2 P i+1 G i + P i+3 P i+2 P i+1 P i C i Notice that formulae gets longer with higher carries. Also, all carries are two-level sum-of-products expressions, in terms of the generate signals, Gs, the propagate signals, Ps, and the first carry-in, C i. Arquitectura de Computadoras ALU1-62

63 Look-Ahead Carry Adder We employ the lookahead formula in this lookahead-carry adder circuit: Arquitectura de Computadoras ALU1-63

64 Look-Ahead Carry Adder The IC chip allows faster lookahead adder to be built. Maximum propagation delay is 4t (t to get generate & propagate signals, 2t to get the carries and t for the sum signals) where t is the average gate delay. Arquitectura de Computadoras ALU1-64

65 Making a subtraction circuit We could build a subtraction circuit directly, similar to the way we made unsigned adders However, by using two s complement we can convert any subtraction problem into an addition problem. Algebraically, A - B = A + (-B) So to subtract B from A, we can instead add the negation of B to A This way we can re-use the unsigned adder hardware Arquitectura de Computadoras ALU1-65

66 Why does this work? For n-bit numbers, the negation of B in two s complement is 2 n - B (this is one of the alternative ways of negating a two s-complement number). A - B = A + (-B) = A + (2 n -B) = (A - B) + 2 n If A B, then (A - B) is a positive number, and 2 n represents a carry out of 1. Discarding this carry out is equivalent to subtracting 2 n, which leaves us with the desired result (A - B). If A < B, then (A - B) is a negative number and we have 2 n - (A - B). This corresponds to the desired result, -(A - B), in two s complement form. Arquitectura de Computadoras ALU1-66

67 A two s s complement subtraction circuit To find A - B with an adder, we ll need to: Complement each bit of B. Set the adder s carry in to 1. The net result is A + B + 1, where B + 1 is the two s complement negation of B. A3, B3 and S3 here are actually sign bits. Arquitectura de Computadoras ALU1-67

68 Small differences The only differences between the adder and subtractor circuits are: The subtractor has to negate B3 B2 B1 B0. The subtractor sets the initial carry in to 1, instead of 0. It s not too hard to make one circuit that does both addition and subtraction Arquitectura de Computadoras ALU1-68

69 An adder-subtractor circuit XOR gates let us selectively complement the B input. X 0 = X X 1 = X When Sub = 0, the XOR gates output B3 B2 B1 B0 and the carry in is 0. The adder output will be A + B + 0, or just A + B. When Sub = 1, the XOR gates output B3 B2 B1 B0 and the carry in is 1. Thus, the adder output will be a two s complement subtraction, A - B. Arquitectura de Computadoras ALU1-69

70 Subtraction summary A good representation for negative numbers makes subtraction hardware much easier to design. Two s complement is used most often (although signed magnitude shows up sometimes, such as in floating-point systems) Using two s complement, we can build a subtractor with minor changes to the adder from last week. We can also make a single circuit which can both add and subtract. Overflow is still a problem, but signed overflow is very different from the unsigned overflow Sign extension is needed to properly lengthen negative numbers. We will use most of the ideas we ve seen so far to build an ALU an important part of a processor. Arquitectura de Computadoras ALU1-70

71 Homework 4 Computer Organization and Design: The Hardware and Software Interface. Third Edition. David A. Patterson and John L. Hennesy. Morgan and Kauffmann Publishers. USA Solve the following exercises: Chapter 1. Exercises: 1.47, 1.48, 1.50, 1.51, 1.52, 1.53, 1.54 Chapter 2. Exercises: 2.6, 2.29, 2.30, 2.31, 2.32, 2.33, 2.37, 2.49, 2.51 Send a pdf file Due date: October 6th, Arquitectura de Computadoras ALU1-71

Computer Architecture. ESE 345 Computer Architecture. Design Process. CA: Design process

Computer Architecture. ESE 345 Computer Architecture. Design Process. CA: Design process Computer Architecture ESE 345 Computer Architecture Design Process 1 The Design Process "To Design Is To Represent" Design activity yields description/representation of an object -- Traditional craftsman

More information

Computer Architecture. ECE 361 Lecture 5: The Design Process & ALU Design. 361 design.1

Computer Architecture. ECE 361 Lecture 5: The Design Process & ALU Design. 361 design.1 Computer Architecture ECE 361 Lecture 5: The Design Process & Design 361 design.1 Quick Review of Last Lecture 361 design.2 MIPS ISA Design Objectives and Implications Support general OS and C- style language

More information

Lecture 5: Arithmetic

Lecture 5: Arithmetic Lecture 5: Arithmetic COS / ELE 375 Computer Architecture and Organization Princeton University Fall 2015 Prof. David August 1 5 Binary Representation of Integers Two physical states: call these 1 and

More information

ECE 545 Digital System Design with VHDL Lecture 1. Digital Logic Refresher Part A Combinational Logic Building Blocks

ECE 545 Digital System Design with VHDL Lecture 1. Digital Logic Refresher Part A Combinational Logic Building Blocks ECE 545 Digital System Design with VHDL Lecture Digital Logic Refresher Part A Combinational Logic Building Blocks Lecture Roadmap Combinational Logic Basic Logic Review Basic Gates De Morgan s Law Combinational

More information

CHAPTER1: Digital Logic Circuits Combination Circuits

CHAPTER1: Digital Logic Circuits Combination Circuits CS224: Computer Organization S.KHABET CHAPTER1: Digital Logic Circuits Combination Circuits 1 PRIMITIVE LOGIC GATES Each of our basic operations can be implemented in hardware using a primitive logic gate.

More information

Systems I: Computer Organization and Architecture

Systems I: Computer Organization and Architecture Systems I: Computer Organization and Architecture Lecture 6 - Combinational Logic Introduction A combinational circuit consists of input variables, logic gates, and output variables. The logic gates accept

More information

Project Two RISC Processor Implementation ECE 485

Project Two RISC Processor Implementation ECE 485 Project Two RISC Processor Implementation ECE 485 Chenqi Bao Peter Chinetti November 6, 2013 Instructor: Professor Borkar 1 Statement of Problem This project requires the design and test of a RISC processor

More information

EC 413 Computer Organization

EC 413 Computer Organization EC 413 Computer Organization rithmetic Logic Unit (LU) and Register File Prof. Michel. Kinsy Computing: Computer Organization The DN of Modern Computing Computer CPU Memory System LU Register File Disks

More information

Combinational Logic. Mantıksal Tasarım BBM231. section instructor: Ufuk Çelikcan

Combinational Logic. Mantıksal Tasarım BBM231. section instructor: Ufuk Çelikcan Combinational Logic Mantıksal Tasarım BBM23 section instructor: Ufuk Çelikcan Classification. Combinational no memory outputs depends on only the present inputs expressed by Boolean functions 2. Sequential

More information

Section 3: Combinational Logic Design. Department of Electrical Engineering, University of Waterloo. Combinational Logic

Section 3: Combinational Logic Design. Department of Electrical Engineering, University of Waterloo. Combinational Logic Section 3: Combinational Logic Design Major Topics Design Procedure Multilevel circuits Design with XOR gates Adders and Subtractors Binary parallel adder Decoders Encoders Multiplexers Programmed Logic

More information

Chapter 4. Combinational: Circuits with logic gates whose outputs depend on the present combination of the inputs. elements. Dr.

Chapter 4. Combinational: Circuits with logic gates whose outputs depend on the present combination of the inputs. elements. Dr. Chapter 4 Dr. Panos Nasiopoulos Combinational: Circuits with logic gates whose outputs depend on the present combination of the inputs. Sequential: In addition, they include storage elements Combinational

More information

Computer Engineering Department. CC 311- Computer Architecture. Chapter 4. The Processor: Datapath and Control. Single Cycle

Computer Engineering Department. CC 311- Computer Architecture. Chapter 4. The Processor: Datapath and Control. Single Cycle Computer Engineering Department CC 311- Computer Architecture Chapter 4 The Processor: Datapath and Control Single Cycle Introduction The 5 classic components of a computer Processor Input Control Memory

More information

We are here. Assembly Language. Processors Arithmetic Logic Units. Finite State Machines. Circuits Gates. Transistors

We are here. Assembly Language. Processors Arithmetic Logic Units. Finite State Machines. Circuits Gates. Transistors CSC258 Week 3 1 Logistics If you cannot login to MarkUs, email me your UTORID and name. Check lab marks on MarkUs, if it s recorded wrong, contact Larry within a week after the lab. Quiz 1 average: 86%

More information

ARITHMETIC COMBINATIONAL MODULES AND NETWORKS

ARITHMETIC COMBINATIONAL MODULES AND NETWORKS ARITHMETIC COMBINATIONAL MODULES AND NETWORKS 1 SPECIFICATION OF ADDER MODULES FOR POSITIVE INTEGERS HALF-ADDER AND FULL-ADDER MODULES CARRY-RIPPLE AND CARRY-LOOKAHEAD ADDER MODULES NETWORKS OF ADDER MODULES

More information

Numbers and Arithmetic

Numbers and Arithmetic Numbers and Arithmetic See: P&H Chapter 2.4 2.6, 3.2, C.5 C.6 Hakim Weatherspoon CS 3410, Spring 2013 Computer Science Cornell University Big Picture: Building a Processor memory inst register file alu

More information

Logic. Combinational. inputs. outputs. the result. system can

Logic. Combinational. inputs. outputs. the result. system can Digital Electronics Combinational Logic Functions Digital logic circuits can be classified as either combinational or sequential circuits. A combinational circuit is one where the output at any time depends

More information

Processor Design & ALU Design

Processor Design & ALU Design 3/8/2 Processor Design A. Sahu CSE, IIT Guwahati Please be updated with http://jatinga.iitg.ernet.in/~asahu/c22/ Outline Components of CPU Register, Multiplexor, Decoder, / Adder, substractor, Varity of

More information

Digital System Design Combinational Logic. Assoc. Prof. Pradondet Nilagupta

Digital System Design Combinational Logic. Assoc. Prof. Pradondet Nilagupta Digital System Design Combinational Logic Assoc. Prof. Pradondet Nilagupta pom@ku.ac.th Acknowledgement This lecture note is modified from Engin112: Digital Design by Prof. Maciej Ciesielski, Prof. Tilman

More information

CSE140: Components and Design Techniques for Digital Systems. Decoders, adders, comparators, multipliers and other ALU elements. Tajana Simunic Rosing

CSE140: Components and Design Techniques for Digital Systems. Decoders, adders, comparators, multipliers and other ALU elements. Tajana Simunic Rosing CSE4: Components and Design Techniques for Digital Systems Decoders, adders, comparators, multipliers and other ALU elements Tajana Simunic Rosing Mux, Demux Encoder, Decoder 2 Transmission Gate: Mux/Tristate

More information

Binary addition example worked out

Binary addition example worked out Binary addition example worked out Some terms are given here Exercise: what are these numbers equivalent to in decimal? The initial carry in is implicitly 0 1 1 1 0 (Carries) 1 0 1 1 (Augend) + 1 1 1 0

More information

Design of Sequential Circuits

Design of Sequential Circuits Design of Sequential Circuits Seven Steps: Construct a state diagram (showing contents of flip flop and inputs with next state) Assign letter variables to each flip flop and each input and output variable

More information

CMP 334: Seventh Class

CMP 334: Seventh Class CMP 334: Seventh Class Performance HW 5 solution Averages and weighted averages (review) Amdahl's law Ripple-carry adder circuits Binary addition Half-adder circuits Full-adder circuits Subtraction, negative

More information

Class Website:

Class Website: ECE 20B, Winter 2003 Introduction to Electrical Engineering, II LECTURE NOTES #5 Instructor: Andrew B. Kahng (lecture) Email: abk@ece.ucsd.edu Telephone: 858-822-4884 office, 858-353-0550 cell Office:

More information

Combina-onal Logic Chapter 4. Topics. Combina-on Circuit 10/13/10. EECE 256 Dr. Sidney Fels Steven Oldridge

Combina-onal Logic Chapter 4. Topics. Combina-on Circuit 10/13/10. EECE 256 Dr. Sidney Fels Steven Oldridge Combina-onal Logic Chapter 4 EECE 256 Dr. Sidney Fels Steven Oldridge Topics Combina-onal circuits Combina-onal analysis Design procedure simple combined to make complex adders, subtractors, converters

More information

Numbers and Arithmetic

Numbers and Arithmetic Numbers and Arithmetic See: P&H Chapter 2.4 2.6, 3.2, C.5 C.6 Hakim Weatherspoon CS 3410, Spring 2013 Computer Science Cornell University Big Picture: Building a Processor memory inst register file alu

More information

Binary addition by hand. Adding two bits

Binary addition by hand. Adding two bits Chapter 3 Arithmetic is the most basic thing you can do with a computer We focus on addition, subtraction, multiplication and arithmetic-logic units, or ALUs, which are the heart of CPUs. ALU design Bit

More information

Review for Test 1 : Ch1 5

Review for Test 1 : Ch1 5 Review for Test 1 : Ch1 5 October 5, 2006 Typeset by FoilTEX Positional Numbers 527.46 10 = (5 10 2 )+(2 10 1 )+(7 10 0 )+(4 10 1 )+(6 10 2 ) 527.46 8 = (5 8 2 ) + (2 8 1 ) + (7 8 0 ) + (4 8 1 ) + (6 8

More information

Hakim Weatherspoon CS 3410 Computer Science Cornell University

Hakim Weatherspoon CS 3410 Computer Science Cornell University Hakim Weatherspoon CS 3410 Computer Science Cornell University The slides are the product of many rounds of teaching CS 3410 by Professors Weatherspoon, Bala, Bracy, and Sirer. memory inst 32 register

More information

211: Computer Architecture Summer 2016

211: Computer Architecture Summer 2016 211: Computer Architecture Summer 2016 Liu Liu Topic: Storage Project3 Digital Logic - Storage: Recap - Review: cache hit rate - Project3 - Digital Logic: - truth table => SOP - simplification: Boolean

More information

Building a Computer. Quiz #2 on 10/31, open book and notes. (This is the last lecture covered) I wonder where this goes? L16- Building a Computer 1

Building a Computer. Quiz #2 on 10/31, open book and notes. (This is the last lecture covered) I wonder where this goes? L16- Building a Computer 1 Building a Computer I wonder where this goes? B LU MIPS Kit Quiz # on /3, open book and notes (This is the last lecture covered) Comp 4 Fall 7 /4/7 L6- Building a Computer THIS IS IT! Motivating Force

More information

COMBINATIONAL LOGIC FUNCTIONS

COMBINATIONAL LOGIC FUNCTIONS COMBINATIONAL LOGIC FUNCTIONS Digital logic circuits can be classified as either combinational or sequential circuits. A combinational circuit is one where the output at any time depends only on the present

More information

3. Combinational Circuit Design

3. Combinational Circuit Design CSEE 3827: Fundamentals of Computer Systems, Spring 2 3. Combinational Circuit Design Prof. Martha Kim (martha@cs.columbia.edu) Web: http://www.cs.columbia.edu/~martha/courses/3827/sp/ Outline (H&H 2.8,

More information

Combinational Logic. By : Ali Mustafa

Combinational Logic. By : Ali Mustafa Combinational Logic By : Ali Mustafa Contents Adder Subtractor Multiplier Comparator Decoder Encoder Multiplexer How to Analyze any combinational circuit like this? Analysis Procedure To obtain the output

More information

Combinational Logic. Lan-Da Van ( 范倫達 ), Ph. D. Department of Computer Science National Chiao Tung University Taiwan, R.O.C.

Combinational Logic. Lan-Da Van ( 范倫達 ), Ph. D. Department of Computer Science National Chiao Tung University Taiwan, R.O.C. Combinational Logic ( 范倫達 ), Ph. D. Department of Computer Science National Chiao Tung University Taiwan, R.O.C. Fall, 2010 ldvan@cs.nctu.edu.tw http://www.cs.nctu.edu.tw/~ldvan/ Combinational Circuits

More information

Digital Techniques. Figure 1: Block diagram of digital computer. Processor or Arithmetic logic unit ALU. Control Unit. Storage or memory unit

Digital Techniques. Figure 1: Block diagram of digital computer. Processor or Arithmetic logic unit ALU. Control Unit. Storage or memory unit Digital Techniques 1. Binary System The digital computer is the best example of a digital system. A main characteristic of digital system is its ability to manipulate discrete elements of information.

More information

IT T35 Digital system desigm y - ii /s - iii

IT T35 Digital system desigm y - ii /s - iii UNIT - II Combinational Logic Adders subtractors code converters binary parallel adder decimal adder magnitude comparator encoders decoders multiplexers demultiplexers-binarymultiplier Parity generator

More information

CMSC 313 Lecture 18 Midterm Exam returned Assign Homework 3 Circuits for Addition Digital Logic Components Programmable Logic Arrays

CMSC 313 Lecture 18 Midterm Exam returned Assign Homework 3 Circuits for Addition Digital Logic Components Programmable Logic Arrays CMSC 33 Lecture 8 Midterm Exam returned ssign Homework 3 Circuits for ddition Digital Logic Components Programmable Logic rrays UMC, CMSC33, Richard Chang Half dder Inputs: and Outputs:

More information

Binary addition (1-bit) P Q Y = P + Q Comments Carry = Carry = Carry = Carry = 1 P Q

Binary addition (1-bit) P Q Y = P + Q Comments Carry = Carry = Carry = Carry = 1 P Q Digital Arithmetic In Chapter 2, we have discussed number systems such as binary, hexadecimal, decimal, and octal. We have also discussed sign representation techniques, for example, sign-bit representation

More information

CprE 281: Digital Logic

CprE 281: Digital Logic CprE 28: Digital Logic Instructor: Alexander Stoytchev http://www.ece.iastate.edu/~alexs/classes/ Simple Processor CprE 28: Digital Logic Iowa State University, Ames, IA Copyright Alexander Stoytchev Digital

More information

UNSIGNED BINARY NUMBERS DIGITAL ELECTRONICS SYSTEM DESIGN WHAT ABOUT NEGATIVE NUMBERS? BINARY ADDITION 11/9/2018

UNSIGNED BINARY NUMBERS DIGITAL ELECTRONICS SYSTEM DESIGN WHAT ABOUT NEGATIVE NUMBERS? BINARY ADDITION 11/9/2018 DIGITAL ELECTRONICS SYSTEM DESIGN LL 2018 PROFS. IRIS BAHAR & ROD BERESFORD NOVEMBER 9, 2018 LECTURE 19: BINARY ADDITION, UNSIGNED BINARY NUMBERS For the binary number b n-1 b n-2 b 1 b 0. b -1 b -2 b

More information

CS61C : Machine Structures

CS61C : Machine Structures CS 61C L15 Blocks (1) inst.eecs.berkeley.edu/~cs61c/su05 CS61C : Machine Structures Lecture #15: Combinational Logic Blocks Outline CL Blocks Latches & Flip Flops A Closer Look 2005-07-14 Andy Carle CS

More information

COSC 243. Introduction to Logic And Combinatorial Logic. Lecture 4 - Introduction to Logic and Combinatorial Logic. COSC 243 (Computer Architecture)

COSC 243. Introduction to Logic And Combinatorial Logic. Lecture 4 - Introduction to Logic and Combinatorial Logic. COSC 243 (Computer Architecture) COSC 243 Introduction to Logic And Combinatorial Logic 1 Overview This Lecture Introduction to Digital Logic Gates Boolean algebra Combinatorial Logic Source: Chapter 11 (10 th edition) Source: J.R. Gregg,

More information

CPU DESIGN The Single-Cycle Implementation

CPU DESIGN The Single-Cycle Implementation CSE 202 Computer Organization CPU DESIGN The Single-Cycle Implementation Shakil M. Khan (adapted from Prof. H. Roumani) Dept of CS & Eng, York University Sequential vs. Combinational Circuits Digital circuits

More information

Combinational Logic. Lan-Da Van ( 范倫達 ), Ph. D. Department of Computer Science National Chiao Tung University Taiwan, R.O.C.

Combinational Logic. Lan-Da Van ( 范倫達 ), Ph. D. Department of Computer Science National Chiao Tung University Taiwan, R.O.C. Combinational Logic ( 范倫達 ), Ph. D. Department of Computer Science National Chiao Tung University Taiwan, R.O.C. Fall, 2017 ldvan@cs.nctu.edu.tw http://www.cs.nctu.edu.tw/~ldvan/ Combinational Circuits

More information

Boolean Algebra and Digital Logic 2009, University of Colombo School of Computing

Boolean Algebra and Digital Logic 2009, University of Colombo School of Computing IT 204 Section 3.0 Boolean Algebra and Digital Logic Boolean Algebra 2 Logic Equations to Truth Tables X = A. B + A. B + AB A B X 0 0 0 0 3 Sum of Products The OR operation performed on the products of

More information

CS61C : Machine Structures

CS61C : Machine Structures inst.eecs.berkeley.edu/~cs61c/su05 CS61C : Machine Structures Lecture #15: Combinational Logic Blocks 2005-07-14 CS 61C L15 Blocks (1) Andy Carle Outline CL Blocks Latches & Flip Flops A Closer Look CS

More information

BOOLEAN ALGEBRA. Introduction. 1854: Logical algebra was published by George Boole known today as Boolean Algebra

BOOLEAN ALGEBRA. Introduction. 1854: Logical algebra was published by George Boole known today as Boolean Algebra BOOLEAN ALGEBRA Introduction 1854: Logical algebra was published by George Boole known today as Boolean Algebra It s a convenient way and systematic way of expressing and analyzing the operation of logic

More information

DIGITAL TECHNICS. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute

DIGITAL TECHNICS. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute DIGITAL TECHNICS Dr. Bálint Pődör Óbuda University, Microelectronics and Technology Institute 4. LECTURE: COMBINATIONAL LOGIC DESIGN: ARITHMETICS (THROUGH EXAMPLES) 2016/2017 COMBINATIONAL LOGIC DESIGN:

More information

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Digital Logic

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Digital Logic Computer Science 324 Computer Architecture Mount Holyoke College Fall 2007 Topic Notes: Digital Logic Our goal for the next few weeks is to paint a a reasonably complete picture of how we can go from transistor

More information

CS 140 Lecture 14 Standard Combinational Modules

CS 140 Lecture 14 Standard Combinational Modules CS 14 Lecture 14 Standard Combinational Modules Professor CK Cheng CSE Dept. UC San Diego Some slides from Harris and Harris 1 Part III. Standard Modules A. Interconnect B. Operators. Adders Multiplier

More information

Computer Science. 19. Combinational Circuits. Computer Science COMPUTER SCIENCE. Section 6.1.

Computer Science. 19. Combinational Circuits. Computer Science COMPUTER SCIENCE. Section 6.1. COMPUTER SCIENCE S E D G E W I C K / W A Y N E PA R T I I : A L G O R I T H M S, M A C H I N E S, a n d T H E O R Y Computer Science Computer Science An Interdisciplinary Approach Section 6.1 ROBERT SEDGEWICK

More information

Combinational Logic Design Arithmetic Functions and Circuits

Combinational Logic Design Arithmetic Functions and Circuits Combinational Logic Design Arithmetic Functions and Circuits Overview Binary Addition Half Adder Full Adder Ripple Carry Adder Carry Look-ahead Adder Binary Subtraction Binary Subtractor Binary Adder-Subtractor

More information

Adders, subtractors comparators, multipliers and other ALU elements

Adders, subtractors comparators, multipliers and other ALU elements CSE4: Components and Design Techniques for Digital Systems Adders, subtractors comparators, multipliers and other ALU elements Instructor: Mohsen Imani UC San Diego Slides from: Prof.Tajana Simunic Rosing

More information

Logic and Computer Design Fundamentals. Chapter 5 Arithmetic Functions and Circuits

Logic and Computer Design Fundamentals. Chapter 5 Arithmetic Functions and Circuits Logic and Computer Design Fundamentals Chapter 5 Arithmetic Functions and Circuits Arithmetic functions Operate on binary vectors Use the same subfunction in each bit position Can design functional block

More information

Chap 2. Combinational Logic Circuits

Chap 2. Combinational Logic Circuits Overview 2 Chap 2. Combinational Logic Circuits Spring 24 Part Gate Circuits and Boolean Equations Binary Logic and Gates Boolean Algebra Standard Forms Part 2 Circuit Optimization Two-Level Optimization

More information

Lecture 2 Review on Digital Logic (Part 1)

Lecture 2 Review on Digital Logic (Part 1) Lecture 2 Review on Digital Logic (Part 1) Xuan Silvia Zhang Washington University in St. Louis http://classes.engineering.wustl.edu/ese461/ Grading Engagement 5% Review Quiz 10% Homework 10% Labs 40%

More information

Midterm Exam Two is scheduled on April 8 in class. On March 27 I will help you prepare Midterm Exam Two.

Midterm Exam Two is scheduled on April 8 in class. On March 27 I will help you prepare Midterm Exam Two. Announcements Midterm Exam Two is scheduled on April 8 in class. On March 27 I will help you prepare Midterm Exam Two. Chapter 5 1 Chapter 3: Part 3 Arithmetic Functions Iterative combinational circuits

More information

CSc 256 Midterm 2 Fall 2010

CSc 256 Midterm 2 Fall 2010 CSc 256 Midterm 2 Fall 2010 NAME: 1a)YouaregivenaMIPSbranchinstruction: x:beq$12,$0,y Theaddressofthelabel"y"is0x40013c.Thememorylocationat"x"contains: addresscontents 0x4002080001000110000000????????????????...whichrepresentsthebeqinstruction;the????...????arethe

More information

Fundamentals of Digital Design

Fundamentals of Digital Design Fundamentals of Digital Design Digital Radiation Measurement and Spectroscopy NE/RHP 537 1 Binary Number System The binary numeral system, or base-2 number system, is a numeral system that represents numeric

More information

ECE/CS 250 Computer Architecture

ECE/CS 250 Computer Architecture ECE/CS 250 Computer Architecture Basics of Logic Design: Boolean Algebra, Logic Gates (Combinational Logic) Tyler Bletsch Duke University Slides are derived from work by Daniel J. Sorin (Duke), Alvy Lebeck

More information

ECE 250 / CPS 250 Computer Architecture. Basics of Logic Design Boolean Algebra, Logic Gates

ECE 250 / CPS 250 Computer Architecture. Basics of Logic Design Boolean Algebra, Logic Gates ECE 250 / CPS 250 Computer Architecture Basics of Logic Design Boolean Algebra, Logic Gates Benjamin Lee Slides based on those from Andrew Hilton (Duke), Alvy Lebeck (Duke) Benjamin Lee (Duke), and Amir

More information

Chapter 5. Digital Design and Computer Architecture, 2 nd Edition. David Money Harris and Sarah L. Harris. Chapter 5 <1>

Chapter 5. Digital Design and Computer Architecture, 2 nd Edition. David Money Harris and Sarah L. Harris. Chapter 5 <1> Chapter 5 Digital Design and Computer Architecture, 2 nd Edition David Money Harris and Sarah L. Harris Chapter 5 Chapter 5 :: Topics Introduction Arithmetic Circuits umber Systems Sequential Building

More information

Overview. Arithmetic circuits. Binary half adder. Binary full adder. Last lecture PLDs ROMs Tristates Design examples

Overview. Arithmetic circuits. Binary half adder. Binary full adder. Last lecture PLDs ROMs Tristates Design examples Overview rithmetic circuits Last lecture PLDs ROMs Tristates Design examples Today dders Ripple-carry Carry-lookahead Carry-select The conclusion of combinational logic!!! General-purpose building blocks

More information

Adders, subtractors comparators, multipliers and other ALU elements

Adders, subtractors comparators, multipliers and other ALU elements CSE4: Components and Design Techniques for Digital Systems Adders, subtractors comparators, multipliers and other ALU elements Adders 2 Circuit Delay Transistors have instrinsic resistance and capacitance

More information

Logic and Boolean algebra

Logic and Boolean algebra Computer Mathematics Week 7 Logic and Boolean algebra College of Information Science and Engineering Ritsumeikan University last week coding theory channel coding information theory concept Hamming distance

More information

ECE/CS 552: Introduction To Computer Architecture 1. Instructor:Mikko H Lipasti. Fall 2010 University i of Wisconsin-Madison

ECE/CS 552: Introduction To Computer Architecture 1. Instructor:Mikko H Lipasti. Fall 2010 University i of Wisconsin-Madison ECE/CS 552: Arithmetic I Instructor:Mikko H Lipasti Fall 2010 Univsity i of Wisconsin-Madison i Lecture notes partially based on set created by Mark Hill. Basic Arithmetic and the ALU Numb representations:

More information

CSEE 3827: Fundamentals of Computer Systems. Combinational Circuits

CSEE 3827: Fundamentals of Computer Systems. Combinational Circuits CSEE 3827: Fundamentals of Computer Systems Combinational Circuits Outline (M&K 3., 3.3, 3.6-3.9, 4.-4.2, 4.5, 9.4) Combinational Circuit Design Standard combinational circuits enabler decoder encoder

More information

Function of Combinational Logic ENT263

Function of Combinational Logic ENT263 Function of Combinational Logic ENT263 Chapter Objectives Distinguish between half-adder and full-adder Use BCD-to-7-segment decoders in display systems Apply multiplexer in data selection Use decoders

More information

vidyarthiplus.com vidyarthiplus.com vidyarthiplus.com ANNA UNIVERSITY- COMBATORE B.E./ B.TECH. DEGREE EXAMINATION - JUNE 2009. ELECTRICAL & ELECTONICS ENGG. - FOURTH SEMESTER DIGITAL LOGIC CIRCUITS PART-A

More information

CMPEN 411 VLSI Digital Circuits Spring Lecture 19: Adder Design

CMPEN 411 VLSI Digital Circuits Spring Lecture 19: Adder Design CMPEN 411 VLSI Digital Circuits Spring 2011 Lecture 19: Adder Design [Adapted from Rabaey s Digital Integrated Circuits, Second Edition, 2003 J. Rabaey, A. Chandrakasan, B. Nikolic] Sp11 CMPEN 411 L19

More information

Hardware Design I Chap. 4 Representative combinational logic

Hardware Design I Chap. 4 Representative combinational logic Hardware Design I Chap. 4 Representative combinational logic E-mail: shimada@is.naist.jp Already optimized circuits There are many optimized circuits which are well used You can reduce your design workload

More information

EC-121 Digital Logic Design

EC-121 Digital Logic Design EC-121 Digital Logic Design Lecture 2 [Updated on 02-04-18] Boolean Algebra and Logic Gates Dr Hashim Ali Spring 2018 Department of Computer Science and Engineering HITEC University Taxila!1 Overview What

More information

Module 2. Basic Digital Building Blocks. Binary Arithmetic & Arithmetic Circuits Comparators, Decoders, Encoders, Multiplexors Flip-Flops

Module 2. Basic Digital Building Blocks. Binary Arithmetic & Arithmetic Circuits Comparators, Decoders, Encoders, Multiplexors Flip-Flops Module 2 asic Digital uilding locks Lecturer: Dr. Yongsheng Gao Office: Tech 3.25 Email: Web: Structure: Textbook: yongsheng.gao@griffith.edu.au maxwell.me.gu.edu.au 6 lecturers 1 tutorial 1 laboratory

More information

Sample Test Paper - I

Sample Test Paper - I Scheme G Sample Test Paper - I Course Name : Computer Engineering Group Marks : 25 Hours: 1 Hrs. Q.1) Attempt any THREE: 09 Marks a) Define i) Propagation delay ii) Fan-in iii) Fan-out b) Convert the following:

More information

Adders - Subtractors

Adders - Subtractors Adders - Subtractors Lesson Objectives: The objectives of this lesson are to learn about: 1. Half adder circuit. 2. Full adder circuit. 3. Binary parallel adder circuit. 4. Half subtractor circuit. 5.

More information

CSE140: Components and Design Techniques for Digital Systems. Logic minimization algorithm summary. Instructor: Mohsen Imani UC San Diego

CSE140: Components and Design Techniques for Digital Systems. Logic minimization algorithm summary. Instructor: Mohsen Imani UC San Diego CSE4: Components and Design Techniques for Digital Systems Logic minimization algorithm summary Instructor: Mohsen Imani UC San Diego Slides from: Prof.Tajana Simunic Rosing & Dr.Pietro Mercati Definition

More information

ELEN Electronique numérique

ELEN Electronique numérique ELEN0040 - Electronique numérique Patricia ROUSSEAUX Année académique 2014-2015 CHAPITRE 3 Combinational Logic Circuits ELEN0040 3-4 1 Combinational Functional Blocks 1.1 Rudimentary Functions 1.2 Functions

More information

UNIT II COMBINATIONAL CIRCUITS:

UNIT II COMBINATIONAL CIRCUITS: UNIT II COMBINATIONAL CIRCUITS: INTRODUCTION: The digital system consists of two types of circuits, namely (i) (ii) Combinational circuits Sequential circuits Combinational circuit consists of logic gates

More information

SAU1A FUNDAMENTALS OF DIGITAL COMPUTERS

SAU1A FUNDAMENTALS OF DIGITAL COMPUTERS SAU1A FUNDAMENTALS OF DIGITAL COMPUTERS Unit : I - V Unit : I Overview Fundamentals of Computers Characteristics of Computers Computer Language Operating Systems Generation of Computers 2 Definition of

More information

CSE Computer Architecture I

CSE Computer Architecture I Execution Sequence Summary CSE 30321 Computer Architecture I Lecture 17 - Multi Cycle Control Michael Niemier Department of Computer Science and Engineering Step name Instruction fetch Instruction decode/register

More information

Floating Point Representation and Digital Logic. Lecture 11 CS301

Floating Point Representation and Digital Logic. Lecture 11 CS301 Floating Point Representation and Digital Logic Lecture 11 CS301 Administrative Daily Review of today s lecture w Due tomorrow (10/4) at 8am Lab #3 due Friday (9/7) 1:29pm HW #5 assigned w Due Monday 10/8

More information

COMBINATIONAL LOGIC CIRCUITS. Dr. Mudathir A. Fagiri

COMBINATIONAL LOGIC CIRCUITS. Dr. Mudathir A. Fagiri COMBINATIONAL LOGIC CIRCUITS Dr. Mudathir A. Fagiri Standard Combinational Modules Decoder: Decode address Encoder: Encode address Multiplexer (Mux): Select data by address Demultiplexier (DeMux): Direct

More information

Carry Look Ahead Adders

Carry Look Ahead Adders Carry Look Ahead Adders Lesson Objectives: The objectives of this lesson are to learn about: 1. Carry Look Ahead Adder circuit. 2. Binary Parallel Adder/Subtractor circuit. 3. BCD adder circuit. 4. Binary

More information

Digital Logic. CS211 Computer Architecture. l Topics. l Transistors (Design & Types) l Logic Gates. l Combinational Circuits.

Digital Logic. CS211 Computer Architecture. l Topics. l Transistors (Design & Types) l Logic Gates. l Combinational Circuits. CS211 Computer Architecture Digital Logic l Topics l Transistors (Design & Types) l Logic Gates l Combinational Circuits l K-Maps Figures & Tables borrowed from:! http://www.allaboutcircuits.com/vol_4/index.html!

More information

INF2270 Spring Philipp Häfliger. Lecture 8: Superscalar CPUs, Course Summary/Repetition (1/2)

INF2270 Spring Philipp Häfliger. Lecture 8: Superscalar CPUs, Course Summary/Repetition (1/2) INF2270 Spring 2010 Philipp Häfliger Summary/Repetition (1/2) content From Scalar to Superscalar Lecture Summary and Brief Repetition Binary numbers Boolean Algebra Combinational Logic Circuits Encoder/Decoder

More information

CMSC 313 Lecture 18 Midterm Exam returned Assign Homework 3 Circuits for Addition Digital Logic Components Programmable Logic Arrays

CMSC 313 Lecture 18 Midterm Exam returned Assign Homework 3 Circuits for Addition Digital Logic Components Programmable Logic Arrays MS 33 Lecture 8 Midterm Exam returned Assign Homework 3 ircuits for Addition Digital Logic omponents Programmable Logic Arrays UMB, MS33, Richard hang MS 33, omputer Organization & Assembly

More information

Numbers & Arithmetic. Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University. See: P&H Chapter , 3.2, C.5 C.

Numbers & Arithmetic. Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University. See: P&H Chapter , 3.2, C.5 C. Numbers & Arithmetic Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University See: P&H Chapter 2.4-2.6, 3.2, C.5 C.6 Example: Big Picture Computer System Organization and Programming

More information

Digital Logic Design ENEE x. Lecture 14

Digital Logic Design ENEE x. Lecture 14 Digital Logic Design ENEE 244-010x Lecture 14 Announcements Homework 6 due today Agenda Last time: Binary Adders and Subtracters (5.1, 5.1.1) Carry Lookahead Adders (5.1.2, 5.1.3) This time: Decimal Adders

More information

Digital Logic: Boolean Algebra and Gates. Textbook Chapter 3

Digital Logic: Boolean Algebra and Gates. Textbook Chapter 3 Digital Logic: Boolean Algebra and Gates Textbook Chapter 3 Basic Logic Gates XOR CMPE12 Summer 2009 02-2 Truth Table The most basic representation of a logic function Lists the output for all possible

More information

Design of Combinational Logic

Design of Combinational Logic Pune Vidyarthi Griha s COLLEGE OF ENGINEERING, NASHIK 3. Design of Combinational Logic By Prof. Anand N. Gharu (Assistant Professor) PVGCOE Computer Dept.. 30 th June 2017 CONTENTS :- 1. Code Converter

More information

PG - TRB UNIT-X- DIGITAL ELECTRONICS. POLYTECHNIC-TRB MATERIALS

PG - TRB UNIT-X- DIGITAL ELECTRONICS.   POLYTECHNIC-TRB MATERIALS SRIMAAN COACHING CENTRE-PG-TRB-PHYSICS- DIGITAL ELECTRONICS-STUDY MATERIAL-CONTACT: 8072230063 SRIMAAN PG - TRB PHYSICS UNIT-X- DIGITAL ELECTRONICS POLYTECHNIC-TRB MATERIALS MATHS/COMPUTER SCIENCE/IT/ECE/EEE

More information

A Second Datapath Example YH16

A Second Datapath Example YH16 A Second Datapath Example YH16 Lecture 09 Prof. Yih Huang S365 1 A 16-Bit Architecture: YH16 A word is 16 bit wide 32 general purpose registers, 16 bits each Like MIPS, 0 is hardwired zero. 16 bit P 16

More information

ECE 545 Digital System Design with VHDL Lecture 1A. Digital Logic Refresher Part A Combinational Logic Building Blocks

ECE 545 Digital System Design with VHDL Lecture 1A. Digital Logic Refresher Part A Combinational Logic Building Blocks ECE 545 Digital System Design with VHDL Lecture A Digital Logic Refresher Part A Combinational Logic Building Blocks Lecture Roadmap Combinational Logic Basic Logic Review Basic Gates De Morgan s Laws

More information

CS/COE0447: Computer Organization and Assembly Language

CS/COE0447: Computer Organization and Assembly Language CS/COE0447: Computer Organization and Assembly Language Logic Design Introduction (Brief?) Appendix B: The Basics of Logic Design Dept. of Computer Science Logic design? Digital hardware is implemented

More information

UNIT 4 MINTERM AND MAXTERM EXPANSIONS

UNIT 4 MINTERM AND MAXTERM EXPANSIONS UNIT 4 MINTERM AND MAXTERM EXPANSIONS Spring 2 Minterm and Maxterm Expansions 2 Contents Conversion of English sentences to Boolean equations Combinational logic design using a truth table Minterm and

More information

Digital Systems Roberto Muscedere Images 2013 Pearson Education Inc. 1

Digital Systems Roberto Muscedere Images 2013 Pearson Education Inc. 1 Digital Systems Digital systems have such a prominent role in everyday life The digital age The technology around us is ubiquitous, that is we don t even notice it anymore Digital systems are used in:

More information

Introduction to Digital Logic Missouri S&T University CPE 2210 Subtractors

Introduction to Digital Logic Missouri S&T University CPE 2210 Subtractors Introduction to Digital Logic Missouri S&T University CPE 2210 Egemen K. Çetinkaya Egemen K. Çetinkaya Department of Electrical & Computer Engineering Missouri University of Science and Technology cetinkayae@mst.edu

More information

CSC9R6 Computer Design. Practical Digital Logic

CSC9R6 Computer Design. Practical Digital Logic CSC9R6 Computer Design Practical Digital Logic 1 References (for this part of CSC9R6) Hamacher et al: Computer Organization App A. In library Floyd: Digital Fundamentals Ch 1, 3-6, 8-10 web page: www.prenhall.com/floyd/

More information

Number representation

Number representation Number representation A number can be represented in binary in many ways. The most common number types to be represented are: Integers, positive integers one-complement, two-complement, sign-magnitude

More information

ELCT201: DIGITAL LOGIC DESIGN

ELCT201: DIGITAL LOGIC DESIGN ELCT2: DIGITAL LOGIC DESIGN Dr. Eng. Haitham Omran, haitham.omran@guc.edu.eg Dr. Eng. Wassim Alexan, wassim.joseph@guc.edu.eg Lecture 4 Following the slides of Dr. Ahmed H. Madian محرم 439 ه Winter 28

More information