Presentation is loading. Please wait.

Presentation is loading. Please wait.

CO5023 Introduction to Digital Circuits. What do we know so far? How to represent numbers (integers and floating point) in binary How to convert between.

Similar presentations


Presentation on theme: "CO5023 Introduction to Digital Circuits. What do we know so far? How to represent numbers (integers and floating point) in binary How to convert between."— Presentation transcript:

1 CO5023 Introduction to Digital Circuits

2 What do we know so far? How to represent numbers (integers and floating point) in binary How to convert between number bases How to represent signed and unsigned integers How to perform the basic mathematical operations on paper, in binary Addition Subtraction (by addition of two’s complement) Multiplication (left shift and add) Division (right shift and subtract) Modulus (remainder) function Representing non-whole (rational) numbers in binary Fixed and floating point representations Recurring binary digits (i.e. in the representation of 0.1) Notation using mantissa and exponent IEEE 754 floating point standard Sign bit, biased exponent and mantissa with no leading ‘1’ Some operations still work with integer hardware, i.e. sorting of positive numbers and comparison with zero Representation of infinite values and NANs

3 Other forms of data, a quick overview Once we have the ability to represent numbers, we can use them to represent more complex data. Sound Images Video A sound wave can be represented as a sequence of numbers, which approximate the waveform. Each number is called a ‘sample’ of the wave. Sound quality is dictated by the frequency (speed) of sampling and the precision of the numbers: 44.1 kHz, 16 bit (CD Audio) 48-192kHz, 24 bit (DVD Audio)

4 Images and Video Images are created by dividing the picture up into very small sections called ‘pixels’ and assigning a colour to each. Three numbers required for amount of red, green and blue in the colour of the pixel. Quality is dictated by the number of pixels in the image and the number of bits used per pixel. Once represented in this form images may be compressed using standards such as JPEG Video Basically just a sequence of images ‘Frame rate’ defines number of images per second High frame rate video looks weird!

5 RGB

6 Digital Circuits Having established that more or less everything we ever want to do with data can be achieved using numerical data formats and operations, we need to think about how to perform these operations in hardware Addition Subtraction (or adding two’s complements) Multiplication and division (using shifting and addition/subtraction) Logical operations e.g. AND, OR, NOT For this we need to build appropriate circuits with logic gates AND, OR and NOT We also have ‘compound’ gates NAND, NOR, XOR and XNOR As an exercise, write down truth tables for each of these

7 Addition with logic gates In order to work out how addition might work, let’s think about what actually happens when two bits of a sum are added together: Carry 1 A10011 B 1011 Sum 0 For the rightmost (least significant) bit, there are 2 inputs (from the first and second numbers in the sum, and two outputs (the sum and the carry) We can write the truth table as follows: Can you think of some gates we could use to get the sum and carry values? Can you produce this circuit in logic gate simulator? http://www.kolls.net/gatesim/ ABSumCarry 0000 0110 1010 1101

8 Answer

9 Addition with logic gates (contd.) When we come to subsequent bits, we have to have three inputs, A, B and C in C in is 1 if there was a carry from the bits on the right and 0 otherwise. The outputs are the same, but we can call the carry C out for clarity Carry 11 A10011 B 1011 Sum 10 Try to complete the truth table opposite yourself… C in ABSumC out 000 001 010 011 100 101 110 111

10 Half adder circuit http://www.circuitstoday.com/half-adder-and-full-adder

11 Full adder circuit http://www.circuitstoday.com/half-adder-and-full-adder

12 We combine full adders to make a multibit adder http://www.circuitstoday.com/half-adder-and-full-adder 1011 + 1101 1011 + 1101 1011 + 1101 1011 + 1101

13 Chaining adders together We could produce a circuit to add two 8- bit numbers together as shown Sometimes called a “Ripple Carry Adder” (RCA) Verify that the sum in the diagram opposite is correct Red means 1, white means 0 What are the values in decimal? What are the problems with this circuit? Gate delay Solved in practice by using a “Carry Lookahead Adder” (CLA) http://pages.cs.wisc.edu/~jsong/CS352/Re adings/CLAs.pdf http://pages.cs.wisc.edu/~jsong/CS352/Re adings/CLAs.pdf Examples of both are on Moodle

14 Problems Have a go at building two circuits 1.Build a circuit which produces the two’s complement of its input. Input and output should both be 8 bits. 2.Can you build a circuit which will shift the bits of a number to the left or right? Have a think about how you could use these to produce subtractors, multipliers and dividers.

15 Multiplexers Multiplexers connect several sources to a common output. One of the sources is ‘selected’ by signals on control lines to be connected to the output Can be used, for example, to select which ALU operation should be outputted Selector inputs are on the left. Changing the selectors determines which input is connected to the output. This is how the processor ‘chooses’ which operation is performed Experiment with the ‘4 bit mux.gcg’ file on Moodle to see how it works


Download ppt "CO5023 Introduction to Digital Circuits. What do we know so far? How to represent numbers (integers and floating point) in binary How to convert between."

Similar presentations


Ads by Google