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 values using two symbols, 0 (Low) and 1 (High). 5 V TTL Logic Levels: Binary Decimal (unsigned) Decimal (signed) 0000 0 0 0001 1 1 0010 2 2 o Example: 1011 2 = (1 X 2 3 ) + (0 X 2 2 ) + (1 X 2 1 ) + (1 X 2 0 ) = 11 10 Signed and unsigned systems Two s Complement o Range: -(2 n-1 ) to +(2 n-1 1) o Example: Four bits 0011 3 3 0100 4 4 0101 5 5 0110 6 6 0111 7 7 1000 8-8 1001 9-7 1010 10-6 1011 11-5 1100 12-4 1101 13-3 1110 14-2 1111 15-1 2
Binary Number System Two s Complement (cont.) All negative numbers have a left-most bit (most significant bit) of one. Therefore, the most positive 4-bit number is 0111 (7) and the most negative is 1000 ( 8). The system is useful in simplifying the implementation of arithmetic on computer hardware. Hexadecimal Representation In mathematics and computer science, hexadecimal (also base-16 or hex) is a numeral system with a radix, or base, of 16. It uses sixteen distinct symbols, most often the symbols 0 9 to represent values zero to nine, and A, B, C, D, E, F (or a through f) to represent values ten to fifteen. Base 10: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Base 16 (Hex): 0 1 2 3 4 5 6 7 8 9 A B C D E F 3
Binary Number System Hexadecimal Representation (cont.) Example: Decimal (base 10): 3890 Binary (base 2): 1111 0011 0010 Hex (base 16): F32 Binary 0x1 + 1x2 + 0x4 + 0x8 + 1x16 + 1x32 + 0x64 + 0x128 + 1x256 + 1x512 + 1x1024 + 1x2048 = 3890 Hex 2x1 + 3x16 + 15x256 = 3890 4
Output is a function of, and only of, the present input. Inputs Outputs 5
Basic Gates AND NAND OR NOT NOR XOR XNOR 6
Gate: AND Boolean Algebra: A.B Symbol: Truth Table INPUT OUTPUT A B A AND B 0 0 0 0 1 0 1 0 0 1 1 1 7
Gate: OR Boolean Algebra: A+B Symbol: Truth Table INPUT OUTPUT A B A OR B 0 0 0 0 1 1 1 0 1 1 1 1 8
Gate: XOR (Exclusive OR) Boolean Algebra: Symbol: Truth Table INPUT OUTPUT A B A XOR B 0 0 0 0 1 1 1 0 1 1 1 0 9
Gate: NOT Truth Table Symbol: INPUT A OUTPUT NOT (A) 0 1 1 0 10
Timing diagrams 11
Timing diagrams Real gates have some delay: input to output delay Outputs don t change immediately after inputs change 12
Example: Half Adder Example: Half Adder 11 0111 (7) + 0110 (6) 1101 (13) Truth Table A B C S 0 0 0 0 0 1 0 1 1 0 0 1 1 1 1 0 13
Example: Full Adder Full Adder 1 1 0111 (7) + 0110 (6) 1101 (13) Truth Table Input Output A B C i C o S 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1 14
Example: 4-bit Adder Adding N-bit Numbers 4-bit Ripple Carry Adder 15
Example: Multiplexer (MUX) In a MUX, the control inputs select which one of the data inputs is transmitted to the output 16
Sequential Logic Sequential logic is a type of logic circuit whose output depends not only on the present input but also on the history of the input. This is in contrast to Combinational Logic, whose output is a function of, and only of, the present input. In other words, sequential logic has Storage (memory) while combinational logic does not. 17
Sequential Logic Flip-Flops A flip-flop has two stable states and thereby is capable of serving as one bit of memory. D Flip-Flop Truth Table D Clock Q Clock D Q Q prev Rising edge 0 0 X Rising edge 1 1 X Non-Rising X constant 18
Sequential Logic Flip-Flop (Cont.) Setup and Hold Time Metastability The metastability in flip-flops can be avoided by ensuring that the data and control inputs are held valid and constant for specified periods before and after the clock pulse, called the setup time (t su ) and the hold time (t h ) respectively. 19
Sequential Logic State Machines A state machine is used to control a digital system that carries out a step-by-step procedure or algorithm. 20
Sequential Logic Finite State Machines b State Machine x SM consists of Set of states Ex: {off, on1, on2, on3} Set of Inputs, Set of outputs Ex: Inputs {b}, Outputs {x} Initial State Ex: Off Set of transitions Describes next state Ex: Has 5 transitions Set of actions Sets outputs while in states Ex: x=0, x=1, x=1, x=1 21
Sequential Logic Finite State Machines A state machine with N state variables requires N D-FF's and has 2 N possible states, where each state can be identified by the N-bit binary number formed by the state variables 22
Sequential Logic Finite State Machines Moore State Machine Outputs depend only on the present state Mealy State Machine (DO NOT USE IT!) Outputs depend on both the present state and the present inputs 23