Presentation on theme: "EE1A2 Microprocessor Systems & Digital Logic Part I Digital Electronic System Design Dr. T. Collins."— Presentation transcript:
EE1A2 Microprocessor Systems & Digital Logic Part I Digital Electronic System Design Dr. T. Collins
Content Binary Arithmetic Addition and subtraction. Arithmetic circuits. Arithmetic Logic Units Micro-Controllers Micro-controller architecture. Essential building blocks of a computer. Programming…
Binary Arithmetic Number Systems Decimal Binary Hexadecimal Addition Long addition Full adder circuits Parallel adders Carry-look-ahead circuitry Subtraction Two’s complement Subtraction using a parallel adder
Arithmetic Logic Units Adder-Subtraction Circuit Combining addition and subtraction in a single controllable circuit Arithmetic Logic Units General-purpose arithmetic and logic ‘calculation’ units Registers How memory circuits can simplify the connections to an ALU
The Anatomy of a Micro-Controller Tri-State Ports and Busses How a ‘bus’ can interconnect many different registers without huge wiring difficulties. Connecting an ALU to a Bus The Building Blocks of a Computer ALU Registers I/O Ports Program Memory Programs
Number Systems – Decimal Base 10 Ten digits, 0-9 Columns represent (from right to left) units, tens, hundreds etc 10 0 or 1 hundred, 2 tens and 3 units
Bases When counting upwards in base-10, we increase the units digit until we get to 10 when we reset the units to zero and increase the tens digit. So, in base-n, we increase the units until we get to n when we reset the units to zero and increase the n-s digit. Consider hours-minutes-seconds as an example of a base-60 number system: Eg. 12:58: :03:20 = 13:02:03 NB. The base of a number is often indicated by a subscript. E.g. (123) 10 indicates the base-10 number 123.
Binary Numbers Terminology Each digit in a binary number is known as a “bit”. A group of eight bits makes a binary number known as a “byte”. A group of more than eight bits is known as a “word”. Typical word lengths – 12, 16, 32, 64.
Decimal to Binary Conversion 123 2=61remainder 1 61 2=30remainder 1 30 2= 15 remainder 0 15 2= 7remainder 1 7 2= 3remainder 1 3 2= 1remainder 1 1 2= 0remainder 1 Least significant bit (rightmost) Most significant bit (leftmost) Answer : (123) 10 = ( ) 2 Example – Converting (123) 10 into binary
Two’s Complement One byte (eight bits) can be used to represent the decimal number range 0 to 255 (unsigned) -128 to 127 (signed) Negative binary numbers are formed by subtracting from a number one greater than the maximum possible (i.e. 2 n or 256 for a byte) For example, (123) 10 = ( ) 2 (-123) 10 = ( ) 2 = (133) 10 = ( ) 10
Frequently Asked Question So how can you tell the difference between: (-123) 10 = ( ) 2 and (133) 10 = ( ) 2 You can’t unless you know whether you’re using signed or unsigned arithmetic:
Hexadecimal Base 16 Sixteen digits, 0-9 and A-F (ten to fifteen) Columns represent (from right to left) units, 16s, 256s, 4096s etc. 7B 7 16 0 = 123
Decimal to Hex Conversion 123 16=7remainder 11 (or B) 7 16=0remainder 7 Answer : (123) 10 = (7B) 16 Converting (123) 10 into hex
Binary to Hex / Hex to Binary Even very long numbers can be converted easily, treating each hex digit independently B B 9 6 F A E.g. Each group of four binary bits maps on to a single hex digit.
Binary Arithmetic - Addition Binary long addition works just like decimal long addition Carried digits Result
Full Adder Each column of the sum has three inputs Digits from the two numbers to add (A and B) Carry bit from previous column It also has two outputs Result bit Carry bit to next column These are the logical operations performed by a full adder circuit. Full Adder B A C IN C OUT SUM
Parallel Adder To add two n-bit numbers together, n full-adders should be cascaded. Each full-adder represents a column in the long addition.
Summary In digital electronics, numbers are represented using base-2 (binary). Base-16 (hex) is often used by human programmers as binary to hex conversion is very easy. Binary numbers may be unsigned or signed (two’s complement). Binary addition works in a similar way to decimal long addition. Almost all of this should be just revision… … if not, make full use of the tutorial.