Tec



LAB #0: Review of Digital Logic Concepts- Objectives: The purpose of this lab is to review basic digital logic concepts you have learned in previous digital systems courses. When you complete this lab, you should be able to recall:Number systems and conversionsBinary arithmetic and binary negative number representationsBinary coded decimal (BCD)ASCII Standard1.2 – Related material to read:Roth, Charles. Fundamentals of Logic Design.1.3 – Number systems and conversionsBase 10 (Decimal): The most familiar number system humans use is base 10. Each digit, ranging from 0-9, in a decimal number is multiplied by the corresponding power of 10 depending on the position in the number (this is known as positional notation).150.510 = 1 x 102 + 5 x 101 + 0 x 100 + 5 x 10-1Base 2 (Binary): Digital systems on the other hand make use of a base 2 (or binary) number system. The same idea applies as with decimal numbers, in that each binary digit is multiplied by the corresponding power of 2 depending on the position in the number.1011.112 = 1 x 23 + 0 x 22 + 1 x 21 + 1 x 20 + 1 x 2-1 + 1 x 2-2Base conversion (integer): To convert an integer value between two different bases, simply use successive division. For example, to convert 5310 to binary, simply repeat integer division by the conversion base until the quotient is zero.532=26, R=1=a0262=13, R=0=a1132=6, R=1=a262=3, R=0=a332=1, R=1=a412=0, R=1=a55310=1101012Base conversion (fraction): Fraction conversion can be done with successive multiplication. This process is continued until a sufficient number of digits have been obtained. Note that this process may not always terminate, in which case you will have a repeating fraction. For example, to convert 0.62510 to binary:0.625 x 2 = 1.250 = 0.250 + 1 (a-1 = 1)0.250 x 2 = 0.500 = .500 + 0 (a-2 = 0)0.500 x 2 = 1.000 = .000 + 1 (a-3 = 1)It is important to note that these processes can be used to convert from any generic base R1 to a different generic base R2; however, it is often easier and commonplace to convert generic base R1 to base 10 (decimal) before converting to base R2.Base 16 (Hexadecimal): For bases greater than 10, more symbols are required to represent the digits. Base 16 (hexadecimal) makes use of digits 0-9 and letters A-F to represent values 10-15 respectively. For example,A2F16 = 10 x 162 + 2 x 161 + 15 x 160 = 2607Hexadecimal notation is a common base used to represent numbers in digital systems because conversion from binary to hexadecimal (and conversely) can be simply done by inspection since each hexadecimal digit corresponds to exactly four binary digits (bits). To convert a binary number to hexadecimal, simply divide the bits into groups of four, where each group will correspond to a hexadecimal digit. For example,100111110.0100112 = 00012 00112 11102 . 01002 11002 -> 13E.4C161.4 – Binary ArithmeticArithmetic operations in digital systems are usually done in binary because digital logic circuit design for binary is much simpler and faster than for decimal.Binary subtraction tableBinary addition table0-0=00+0=00-1=1*0+1=11-0=11+0=11-1=01+1=0**Carry/Borrow to/from next columnFor example, to add 1010 and 1510 in binary:1010 + 1510 = 10102 + 11112 = 110012To subtract 1010 from 1510 in binary:1510 – 1010 = 11112 – 10102 = 010121.5 – Representation of negative numbers (2’s complement)The 2’s complement of a binary number is defined as the value obtained by subtracting the number from a large power of two (specifically, from 2N for an N-bit 2’s complement). The 2’s complement of the number then behaves like the negative of the original number in most arithmetic, and it can coexist with positive number in a natural way. A 2’s complement negative number binary representation can be found for an n-bit number by applying the following simple equation:N*=2n - NFor example, to represent -3 as a 4-bit 2’s complement number, one can apply the above equation or simply take the positive binary representation, complement the bits, and add 1.-3 = 24 – 1 = 16 – 3 = 13 = 110123 = 00112 – 3 = 11002 + 12 = 110121.5 – Arithmetic overflowSince n-bit binary numbers are of fixed length, there are only a fixed set of numbers that can be represented; therefore, it is possible to perform arithmetic on two n-bit binary numbers and get a condition known as overflow. An overflow occurs when an arithmetic operation of two words of length n-bits sum to a result that requires more than n-bits to correctly represent. This is true for both unsigned and signed binary numbers.For example, adding the following two 4-bit unsigned numbers will result in an overflow:8 + 8 = 16 10002 + 10002 = 1 00002 = 0 ≠ 16For example, adding the following two 4-bit signed numbers will result in an overflow: -8 + -8 = -16 10002 + 10002 = 1 00002 = 0 ≠ -16There are few simple statements to remember for 2’s complement numbers in order to know if an overflow has occurred for a signed number:If adding two negative signed numbers results in a positive number, an overflow has occurred.If adding two positive signed numbers results in a negative number, an overflow has occurred.For two n-bit signed numbers, it is impossible to get and overflow when adding a positive number and a negative number, or subtracting a positive number from another positive number.If subtracting two numbers, take 2’s complement of the subtrahend (number being subtracted) and perform addition using rules 1) – 3) above.1.6 – Binary codesBinary Coded Decimal (BCD): Although most computers work explicitly with binary numbers and perform binary arithmetic operations, it is common to have input-output peripherials use decimal numbers. This is often accomplished by representing decimal numbers in terms of binary codes. For example, 524.8710 is represented as a binary coded decimal (BCD) by:524.8710 01012 00102 01002 . 10002 011121.7 – American Standard Code for Information Interchange (ASCII)It is common in most computing systems to require processing of data that contains information other than numbers (e.g. letters, punctuation, symbols, etc…). One common alpha-numeric code is known as ASCII. ASCII contains 7-bit binary codes, representing up to 27 = 128 different code combinations for numbers, letters, and other symbols. For example, the digits 0 to 9 are represented by the values $30 to $39 respectively. An ASCII table containing the code combinations can be found on the course website (in “Lab Assignments” Appendix C).1.8 – Lab reportPlease print the last four pages of this lab, answer the questions, and turn in to your TA for credit. It is suggested you use a calculator to verify your answer; however, you must show your work to get full credit, otherwise you will receive a mark of zero for question.Name:Lab time:LAB 1 Questions.Number systems and conversionsPerform the following number conversions. Show your work.123410 to binary.56742 to binary.1011.1012 to decimal.A4C3E89016 to decimal.A4C3E89016 to binary.101.2510 to binary.72310 to octal (base 8).1324 to quinary (base 5).Write out the following numbers in positional notation.168.1510ABCD.EF16101102A computer has a word length of 16-bits (including sign bit). What range of values can be represented in the following cases (show your answers in binary and decimal):16-bit unsigned numbers16-bit 2’s complement signed numbers16-bit 1’s complement signed numbersWrite a formula for the range of values that can be represented by any n-bit binary representation for the following cases:n-bit unsigned numbersn-bit 2’s complement signed numbersBinary arithmetic and arithmetic overflowPerform the following arithmetic operations and state whether and overflow has occurred. Also show the result in decimal notation. All signed numbers are 2’s complement representations. Show your work.10112 + 01102 (4-bit unsigned)10112 – 01102 (4-bit unsigned)10112 + 01102 (4-bit signed)10112 – 01102 (4-bit signed)AF16 + 3C16 (8-bit unsigned)AF16 - 3C16 (8-bit unsigned)Binary codesPerform the following binary code conversions. For ASCII conversion, convert the content enclosed within the quotations marks (e.g. if asked to convert “ABC” Binary Coded (Hexadecimal), then the result would be 4116 4216 4316).8214510 Binary coded decimal (BCD).A43CD16 Binary coded decimal (BCD).“ECE251” ASCII (Hexadecimal and Decimal notations).Write your first name in ASCII codes (Hexadecimal and Decimal notations).Write a formula to convert and ASCII digit (0-9 to its equivalent decimal representation.Other than the ASCII standard, list another alpha-numeric standard commonly used.Can the following symbols be represented in ASCII??Yes / No* Yes / NoR Yes / No± Yes / No= Yes / No ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download