Mike Smith, Quirks and SHARCs. When equals 2, but 2 * 2 is not always 4. Page 1 of 15 Developed 2004/01/26.

Size: px
Start display at page:

Download "Mike Smith, Quirks and SHARCs. When equals 2, but 2 * 2 is not always 4. Page 1 of 15 Developed 2004/01/26."

Transcription

1 Page 1 of 15 Developed 2004/01/26 Quirks and SHARCs When 1 plus 1 equals 2, But 2 times 2 does not always equal 4 Mike Smith, Electrical and Computer Engineering, University of Calgary, Calgary, Alberta, Canada T2N 1N4 smithmr@ucalgary.ca Phone: Fax: Developed for CCI, March 2000

2 Page 2 of 15 Developed 2004/01/26 Quirks and SHARCs When 1 plus 1 equals 2, But 2 times 2 does not always equal 4 Mike Smith, Electrical and Computer Engineering University of Calgary, Alberta, Canada When developing, or using, a new embedded system it is important for the developing team to realize that Murphy s Law is always lurking just around the corner. What is really happening when things appear to be going well in the early stages? Simple -- the development team does not understand the project well enough to recognize that things are already going astray! This article is a personal story about one such situation. Several years back I had to switch between an advanced RISC processor (AMD 29050) to the Analog Devices ADSP21061 SHARC processor for DSP applications. There was an initial dramatic learning curve associated with the new SHARC architecture, particularly its super-scalar instruction capability and independent data address generating ALU s. However many of the features that I particularly liked in the AMD29050 processor were again present in ADSP The first year of teaching my applications-oriented advanced microprocessor course on the went well. The C-like assembly code syntax meant less simple errors were generated than with the 29K RISC assembly syntax. The SHARC EZ-Lite Evaluation boards had on-board CODECs, which allowed the development of interesting audio projects. That first year, I made use of the 21K s floating point capability for development of DSP algorithms without having to worry about the overflow protection needed in integer applications. The confidence was there to get more adventuresome by the start of my second year of teaching with the SHARC board. Certain items from the initial offering were recognized as not particularly useful and were dropped, leaving time for other concepts. In particular the class started to explore using the processor s integer capabilities to demonstrate DSP programming techniques for processors not having floating point instructions. Once headed down this route, it did not take a particularly difficult algorithm involving integers to get a situation where we realized that things were not working the way we had expected! Figure 1 is a screen capture from the White Mountain VisualDSP SHARC simulator environment. The results are shown for several very basic assembly-code operations. The bit patterns in the data registers have been interpreted using both integer and floating point formats.

3 Page 3 of 15 Developed 2004/01/26 Figure 1. Basic floating-point addition and multiplication operations on the SHARC processor work as expected. However even the simplest integer addition and multiplication operations apparently give incorrect results. The floating-point results shown in the figure make sense = * 3.0 = 6.0 However the integer addition = 5 has, somehow, been scaled by 0x100 to become the operation 0x x300 = 0x500 Although unexpected, the addition operation at least makes some sense which is more than be said for the 21K integer multiplication operation, which appears to imply that 0x200 * 0x300 = 0 As always happens, once you realize that there is one item about a processor you don t completely understand, the floodgates just open. The AMD29K processor has a floating-point instruction for division calculations. It may be 11 times slower than other 29K instructions, but at least it exists, which is certainly not the case for the 21K floating point division instruction! However the 21K instruction set does include a reciprocal instruction, but that does not appear to work as expected either! A third issue involves doing some fancy footwork with the internal operations of the 21K processor to do something neat fast single cycle floating point division. With any integer processor, you can get fast division by powers of 2 by using right arithmetic shift operations as shown by the following 68K instruction. ASR #4, D0 gives D0 / 16 By understanding the bit representation of floating point numbers you can perform comparable tricks to get fast

4 Page 4 of 15 Developed 2004/01/26 division (scaling) occurring with floating point powers of 2. This knowledge could be particularly useful for algorithms involving the FFT (fast Fourier transform) algorithm. The output from an inverse N-point FFT will require scaling by a factor of N. This fast division operation requires checking and manipulating the binary component bits of the floatingpoint number. It is a little more complicated to achieve this on the 21K than it was on the AMD 29K and Motorola processors (see CCI-52, 1994). The deep 21K-instruction pipeline means there are several cyclestealing, delayed branch instructions associated with each program decision (conditional JUMP instruction). Some of the problems can be overcome using the 21K super-scalar and conditional compute instructions. To get the most out of any processor, you have to properly understand the consequences of all aspects of that processor s architecture. To this point, the reader has been introduced to some apparently contradictory characteristics of the 21K architecture. In the next few sections we shall show that there is actually a valid design decision underlying every one of these apparent ADSP SHARC processor quirks! The need to make 0x2 appear as 0x200 Because of the characteristics of the 68K-processor architecture, a data register showing the bit pattern 0x800070FF can be interpreted in a number of different ways. For BYTE (8- bit) operations the register contains the negative value 0xFF. The register can also be considered as containing the positive value 0x70FF (16-bit WORD) or the negative value 0x800070FF (32- bit LONG WORD). In Figure 1, the integer 0x2 appears as the hexadecimal number 0x200 as a direct consequence of the internal architecture of the SHARC s data registers and ALU. All data registers are 40-bits wide to allow storage of numbers in both the IEEE 754/854 standard 32-bit single-precision floating-point format and an extendedprecision version of the same format. Unlike the 68K processor, the significant bits on the 21K data values are at the high end of the register bit pattern. This means that the last two nibbles stored in a data register should be ignored during interpretation, or when the value is written out to 32-bit memory. The SHARC internal memory architecture can be software configured to handle both 32-bit and 40-bit data memory operations. Getting 2 times 3 to equal 6 Since there are 32 significant bits hidden at the top of every 40-bit SHARC register it is easy to understand why the operation 0x2 + 0x3 = 0x5 will appear as the operations on register values 0x x300 = 0x500 when the register contents are examined. However, it does not explain why the operation

5 Page 5 of 15 Developed 2004/01/26 0x2 * 0x3 = 0x0 Figure 2 again shows the program from Figure 1. However in this case the display mode for the VisualDSP development environment is set to mixed rather than source. Mixed mode means that you get to see both what you wanted to do (source), and the bit patterns (assembly code) associated with how the processor is actually interpreting those requests! The reason for the strange behaviour is revealed. We did not perform the intended standard multiplication operation R0 * R1 but instead unintentionally activated an operation called R0 * R1 (SSF) A quick glance at the SHARC User Manual indicates that SSF stands for the signed-signed fractional form of the integer multiplication instruction. Figure 2. The result of basic SHARC operations can be found in the upper 32-bits of the 40-bit data register. Using the VisualDSP development environment mixed mode display format, it can be seen that the default SHARC integer multiplication instruction expects a signed-signed fractional (ssf) number representation rather than the standard two s complement integer format. The fact that an instruction comes in both signed and unsigned forms is a familiar concept on many processors. The 68K has 2 types of multiplication operations MULTS (signed) and MULTU (unsigned). Many processors have 3 forms of ADD operations. For examples the 29K processor has ADDU and ADDS instructions which cause exceptions to

6 Page 6 of 15 Developed 2004/01/26 be thrown when the unsigned and signed number representations overflow during the ADD operation. There is a third plain ADD instruction when you don t need to worry about overflows. However the concept of a fractional representation within an integer format is probably something that will require many an overworked developer to head back to old course notes. For the moment we can simply say what ever fractional means, it ain t what we want and turn it off by using an explicit signed-signed integer form of the 21K multiplication instruction R0 * R1 (SSI) As can be seen Figure 3, we now have the 21K behaving like a normal processor. The 32-bit operations = 5 and 2 * 3 = 6 both work, even if the direct interpretation of the 32-bit values are distorted a little by their storage in the 40-bit SHARC data registers. Figure 3. The SHARC processor starts acting like any other processor after activating the signed signed integer multiplication operation rather than the default signed signed fractional format Float operations via integer instructions Another useful piece of information has become clear from the mixed mode displays of Figures 2 and 3. Floating point operations of the form F4 = 2.0 are actually implemented through integer assignment operations of the form R4 = bit pattern for the constant.

7 Page 7 of 15 Developed 2004/01/26 The chip designers decided there was no need to use up precious op-code bits to describe a specific floating point assignment instruction when the assembler is perfectly capable of using an integer assignment in conjunction with generating the bit pattern needed to represent a floating point number. This decision can have a nasty consequence for the developer in a hurry, and not following a code review process. Suppose you write F4 = 2 with the 2 written as an integer rather than a float (2.0). A C language compiler would do the equivalent of automatically casting this expression as F4 = (float) 2 to give the programmer the intended result F4 = 2.0. However there is no equivalent checking of context in the White Mountain 21K assembler. The programmer gets R4 = bit pattern of integer 2 which would leave F4 with a small floating point value around 10-45, which was not what was intended. An example of this can be seen in the different interpretations of the contents of R0 register in Figures This problem is even more insidious when initializing floating point arrays for filter coefficients with syntax of the form.var array[3] = {1.0, 2.0, 3}; Two coefficients will be correctly initialized, but the third coefficient will be, unintentionally, far too small. It would nice to see the assembler operation changed so that at least warning messages were issued. Perhaps a language extension could be added to allow automatic type casting with.var float array[3] = {1.0, 2.0, 3}; putting the values 1.0, 2.0 and 3.0 into the array. Experiments with fractions We can t just ignore this fractional integer format. It must be particular useful within the concept of DSP applications, because otherwise why would it be made the default mode of 21K multiplication operations! The Analog Devices 2106X User Manual does indicate that the processor can support two 32-bit fixed point formats. However the terms used to explain these formats in the manual are rather terse. This indicates that the manual writers believe that fractional fixed point is something we should all already know about, rather than them needing to explain it in detail. Unless text-books are close-by, this blatant lack of understanding of the basic need to provide detailed examples of anything non-obvious to the average developer is best solved by a little further experimentation. In Figure 4, an attempt has been made to put fractional numbers into integer registers and perform basic addition and fractional multiplication operations. The results in the data

8 Page 8 of 15 Developed 2004/01/26 registers are interpreted using the signed-fractional format available in the VisualDSP development tool. Figure 4. Activating the signed fractional interpretation of the bit patterns stored in the integer data registers shows that signed signed fractional operations are internally consistent, even if they don t give the anticipated results. We can see that we are heading in the right direction. When compared to the initial signed fractional contents of the registers, the final contents of the registers correctly indicate that = and * = The only problem is that we had actually been hoping to convince the processor to perform the fractional operations = * 0.3 = 0.06 Fractional Integers From Figure 4 it can be seen that setting the integer registers to fractional values (R0 = 0.2 and R1 = 0.3) does not lead to the corresponding signed fractional integer values. Strange that there is not a built-in assembler directive to generate the bit patterns for fractional integer values. Miscalculating the necessary hexadecimal bit patterns for fractional values has been a constant source of errors in my group. However a sensible relationship between fractional integer values and their hexadecimal representations has appeared. Registers R5 to R7 contain the results of applying a series of arithmetic shifts (ASHIFT) on the largest negative 32-bit integer value (0x ) placed into register R4. Using a negative value with the 21K ASHIFT operator produces an arithmetic right shift, which is equivalent to signed integer divisions by 2 32-bit HEX FRACTIONAL VALUE VALUE 0x xC xE xF

9 Page 9 of 15 Developed 2004/01/26 A similar pattern of bits will be familiar to developers who have spent time hooking up a 12-bit A/D to the data bus of a processor. maximum magnitude that can be represented in a signed, two s complement, number representation. Figure 5 shows that this is a selfconsistent interpretation with 12-bit HEX VALUE FRACTION OF FULL SCALE A/D VOLTAGE -0.5 * -0.5 (ssf) = 0.25, -0.5 * 0.5 (ssf) = and -1.0 * 0.5 (ssf) = x xC xE xF x x etc. This equivalence suggests that one way of looking at fractional-signed integers on the 21K is to interpret the bit pattern as representing a fraction of the However Figure 5 also hints that a deeper understanding of the fractional integer representation is needed for proper algorithm development since -1.0 * -1.0 (ssf) = -1.0 Fixing this problem in an algorithm by using the 80-bit accumulator associated with the SHARC integer multiplier is the subject of some future article. Figure 5. Most signed-signed fractional multiplication operations lead to the anticipated result. However the signed-signed fractional multiplication of 1 and 1 would lead to the invalid result of 1, a problem that can often be solved in an algorithm by using the SHARC 80-bit accumulator associated with the integer multiplier.

10 Page 10 of 15 Developed 2004/01/26 21K Floating Point Division There is an 11-cycle floatingpoint division instruction, FDIV, present on the AMD processor. However that instruction complicates 29K assembly coding as it is far slower than other 29K floating point operations, and much more difficult to pipeline efficiently. A design feature of the 21K processor is that the majority of its instructions complete in a single cycle, leaving no place for a slow floatingpoint division operation. The presence of the 21K reciprocal instruction RECIPS suggests a two-stage division operation. First the reciprocal of the denominator is calculated in one cycle, and then the numerator is multiplied by this reciprocal in a second cycle. However, as can be seen from Figure 6, this approach just does not seem to work right using the RECIPS instruction. The approach does however work if the reciprocal is directly evaluated by hand. This strange behaviour is a result of the fact that a ROM look-up table is needed for reciprocals to be calculated in a single cycle. High accuracy reciprocals would require an enormous amount of silicon to implement. Instead a limited accuracy approximation (seed) of the reciprocal is calculated for more information see the SHARC user manual, page B-39. Comparing the hexadecimal representations of the reciprocal seed (F2) and the true reciprocal (F4) reveals the limited accuracy of the result from the RECIPS operation. Figure 7 shows how a floatingpoint division can be obtained in 8 cycles using the super-scalar capability of the SHARC processor and an iterative convergence algorithm (See reference by Cavangh). A +-1 LSB accurate single precision quotient can be obtained after only 6 cycles. The strange choice of data registers in the algorithm is a direct consequence of the SHARC architecture, which only allows super-scalar operations between certain banks of data registers. Figure 6. The SHARC RECIPS instruction provides a limited accuracy reciprocal seed value in a single cycle from a ROM look-up table.

11 Page 11 of 15 Developed 2004/01/26 Figure 7. A convergence algorithm is used to calculate a floating-point division in 8 cycles using the super-scalar SHARC instructions. Custom Division Integer and Floating Point As discussed in the previous section a fast, accurate, division instruction would require considerable silicon. Since most algorithms involve only a few divisions a reasonable compromise is to have a not-so fast instruction (AMD 29K), or an iterative procedure available (ADSP 21K). One exception to this rule is that divisions by powers of 2, e.g. 4, 8, 16 etc., happen frequently. Such operations are needed to scale integer inputs to ensure that the algorithm does not overflow its number representation (see CCI-???, December 2000). Floating point scaling by powers of 2.0 is necessary for outputs from algorithms such as the inverse Fourier transform. On the integer side, single-cycle 21K arithmetic left and right shifts can handle scaling by powers of 2 as was demonstrated in Figure 4. // Fast integer division R0 = R1 / 16 R0 = ASHIFT R1 BY 4 However floating-point numbers are represented in a far more complicated manner using three different bit-fields within a 32-bit register. This means that the shift approach for integers must be changed to an equivalent, but very different, operation to achieve floatingpoint scaling. This operation requires detailed understanding of the IEEE floating point number representation.

12 Page 12 of 15 Developed 2004/01/26 Figure 8 shows the 32-bit representation of the three fields of a floating point (FP) number. s -- the sign field bexp -- the biased exponent field frac -- the fractional field There is a 33 rd normalization bit that is James Bonded hidden but not stored. Every valid FP number can be represented using this format (-1) s (bexp 127) x 1.frac x 2 Figure 9 illustrates the transformation of the decimal number 34.0 till its storage as a FP value in hexadecimal format. Table 1 shows the IEEE standard representation of pairs of floating point numbers that differ by a factor of When broken into the three floating point fields, it is easy to see that pairs of floating point numbers that are scaled by a factor of 16.0 differ by a fixed value of 4 in their biased exponent. With this information a fast floating-point scaling operation can be handled through a single cycle, subtraction integer operation that directly adjusts the bexp bits of a floating-point number. // Setup of BEXP adjustment factor R0 = 4; R0 = ASHIFT R0 BY 23 F4 = ; // Integer operation to perform // a single cycle FP division by 16.0 R4 = R4 R0; Floating point scaling via integer operations can, in principle, be implemented on any processor, BUT does it really work? Figure 10 shows a series of floating point numbers divided by 16.0 in a single cycle rather than the standard eight cycles for a standard SHARC division. As can be seen in the figure the operation works perfectly well for scaling the numbers 4.0, -2.0 and 1.0 but suffers a significant problem when scaling s bexp biased exponent frac fractional field Figure 8. The representation of a IEEE standard floating point number takes 33 bits. One bit for the sign, 8-bits for the biased exponent and 23-bits for the fractional field. The 33 rd normalization bit is James Bonded -- hidden rather than stored.

13 Page 13 of 15 Developed 2004/01/26 Conversion to binary value 34.0 = % Conversion to 1.frac binary format % = % * 2 5 Conversion to biased exponent format % * 2 5 ( ) = % * 2 Identification of the 3 IEEE FP fields s = %0 = 0x0 bexp = 132 = 0x84 = % frac = % = 0x Representation of 34.0 in 32-bits = % = % = 0x Figure 9. The decimal number 34.0 goes through a series of stages to identify the three floating point bit fields before being stored as the 32-bit value 0x Number Internal Hex FP fields FP Representation s bexp frac 1.0 0x3F x7F 0x x x83 0x xBF x7F 0x xCF x83 0x x427FD99A 0 0x84 0x7F D9 9A x447FD99A 0 0x88 0x7F D9 9A Table 1. Floating point numbers that differ by a scaling factor of 16.0 have 32-bit representations with biased exponent fields, bexp, that differ by 4. All the other fields remain the same.

14 Page 14 of 15 Developed 2004/01/26 Figure 10. Fast floating point division by a factor of 2 can be implemented via a single cycle integer subtraction rather than an 8-cycle iterative division. However additional checks must be added for accuracy. Figure 11. Tests coded into the first scaling algorithm expose the SHARC s instruction pipeline and takes 6 cycles if the value is large and 8 cycles if the value is small. The second algorithm makes use the SHARC s conditional compute and superscalar statements to avoid pipeline stalls (3 cycles).

15 Page 15 of 15 Developed 2004/01/26 The problem with the number 0.0 is that its biased exponent is too small to allow a valid FP number to be generated after 4 is subtracted to perform the fast scaling operation. This problem did not occur with the integer scaling operation using arithmetic shifts. If the scaling factor was too large then all the significant bits were shifted out of the value to automatically leave 0. Something equivalent needs to happen for the fast floating point operations. The scaling approach works all the time if you can guarantee that every number you use has a magnitude greater than 2 (p 127) (where p is the power of 2 by which you are scaling). Figure 11 shows two versions of a modified scaling operation incorporating the tests. The first algorithm is slow (6 cycles) as the SHARC s instruction pipeline is exposed by the conditional jumps. The second algorithm makes use the SHARC s conditional compute and super-scalar statements to avoid pipeline stalls (3 cycles). We have now implemented an accurate floating-point scaling operation which, at 3 cycles, works faster than the standard 8-cycle SHARC division. Was it worth the effort? Nah! If you really want to scale floating point registers F0, F2, F4 and F6 by 16.0 then the simplest algorithm involving single cycle operations is // Determine the reciprocal of 16.0 F8 = ; F1 = F0 * F8; F3 = F2 * F8; F5 = F4 * F8; F7 = F6 * F8; But you ve got to admit it is a neat party trick to know how to change bexp! Conclusion In this article a number of the characteristics of the Analog Devices SHARC processor were discussed. These included internal representation of integers, an unexpected default setting for integer multiplication operations and a brief introduction to fractional integers. On the floating-point side, a technique was discussed for performing a floating-point division in the absence of a fast FDIV instruction. Details of a faster, custom, floating-point scaling operation was demonstrated using conditional compute and superscalar instructions. Notes. The James Bond pun should be read while thinking in an English accent! Quirks and Quarks is a long running CBC Science program, now on the Web. Acknowledgments Thanks go out to Con Korikis (Analog Devices University Support) and Tony Moosey (SHARC DSP Tools Support). References ADSP-2106x SHARC User s Manual, 2 nd Edition, Analog Devices, J. Cavanagh, Digital Computer Arithmetic, McGraw-Hill, page 284, About the Author Mike is a professor at the University of Calgary, Canada where he teaches, and does research in, introductory and advanced microprocessor topics. He can be reached at smithmr@ucalgary.ca.

CHAPTER 1 Numerical Representation

CHAPTER 1 Numerical Representation CHAPTER 1 Numerical Representation To process a signal digitally, it must be represented in a digital format. This point may seem obvious, but it turns out that there are a number of different ways to

More information

DSP Platforms Lab (AD-SHARC) Session 05

DSP Platforms Lab (AD-SHARC) Session 05 University of Miami - Frost School of Music DSP Platforms Lab (AD-SHARC) Session 05 Description This session will be dedicated to give an introduction to the hardware architecture and assembly programming

More information

Number Systems. Both numbers are positive

Number Systems. Both numbers are positive Number Systems Range of Numbers and Overflow When arithmetic operation such as Addition, Subtraction, Multiplication and Division are performed on numbers the results generated may exceed the range of

More information

The SHARC in the C. Mike Smith

The SHARC in the C. Mike Smith M. Smith -- The SHARC in the C Page 1 of 9 The SHARC in the C Mike Smith Department of Electrical and Computer Engineering, University of Calgary, Alberta, Canada T2N 1N4 Contact Person: M. Smith Phone:

More information

Learning the Binary System

Learning the Binary System Learning the Binary System www.brainlubeonline.com/counting_on_binary/ Formated to L A TEX: /25/22 Abstract This is a document on the base-2 abstract numerical system, or Binary system. This is a VERY

More information

Computer Architecture Chapter 3. Fall 2005 Department of Computer Science Kent State University

Computer Architecture Chapter 3. Fall 2005 Department of Computer Science Kent State University Computer Architecture Chapter 3 Fall 2005 Department of Computer Science Kent State University Objectives Signed and Unsigned Numbers Addition and Subtraction Multiplication and Division Floating Point

More information

CS 101: Computer Programming and Utilization

CS 101: Computer Programming and Utilization CS 101: Computer Programming and Utilization Jul-Nov 2017 Umesh Bellur (cs101@cse.iitb.ac.in) Lecture 3: Number Representa.ons Representing Numbers Digital Circuits can store and manipulate 0 s and 1 s.

More information

C NUMERIC FORMATS. Overview. IEEE Single-Precision Floating-point Data Format. Figure C-0. Table C-0. Listing C-0.

C NUMERIC FORMATS. Overview. IEEE Single-Precision Floating-point Data Format. Figure C-0. Table C-0. Listing C-0. C NUMERIC FORMATS Figure C-. Table C-. Listing C-. Overview The DSP supports the 32-bit single-precision floating-point data format defined in the IEEE Standard 754/854. In addition, the DSP supports an

More information

Module 2: Computer Arithmetic

Module 2: Computer Arithmetic Module 2: Computer Arithmetic 1 B O O K : C O M P U T E R O R G A N I Z A T I O N A N D D E S I G N, 3 E D, D A V I D L. P A T T E R S O N A N D J O H N L. H A N N E S S Y, M O R G A N K A U F M A N N

More information

Number Systems Using and Converting Between Decimal, Binary, Octal and Hexadecimal Number Systems

Number Systems Using and Converting Between Decimal, Binary, Octal and Hexadecimal Number Systems Number Systems Using and Converting Between Decimal, Binary, Octal and Hexadecimal Number Systems In everyday life, we humans most often count using decimal or base-10 numbers. In computer science, it

More information

Signed umbers. Sign/Magnitude otation

Signed umbers. Sign/Magnitude otation Signed umbers So far we have discussed unsigned number representations. In particular, we have looked at the binary number system and shorthand methods in representing binary codes. With m binary digits,

More information

COMP Overview of Tutorial #2

COMP Overview of Tutorial #2 COMP 1402 Winter 2008 Tutorial #2 Overview of Tutorial #2 Number representation basics Binary conversions Octal conversions Hexadecimal conversions Signed numbers (signed magnitude, one s and two s complement,

More information

Number Systems and Binary Arithmetic. Quantitative Analysis II Professor Bob Orr

Number Systems and Binary Arithmetic. Quantitative Analysis II Professor Bob Orr Number Systems and Binary Arithmetic Quantitative Analysis II Professor Bob Orr Introduction to Numbering Systems We are all familiar with the decimal number system (Base 10). Some other number systems

More information

Variables and Data Representation

Variables and Data Representation You will recall that a computer program is a set of instructions that tell a computer how to transform a given set of input into a specific output. Any program, procedural, event driven or object oriented

More information

CSC201, SECTION 002, Fall 2000: Homework Assignment #2

CSC201, SECTION 002, Fall 2000: Homework Assignment #2 1 of 7 11/8/2003 7:34 PM CSC201, SECTION 002, Fall 2000: Homework Assignment #2 DUE DATE Monday, October 2, at the start of class. INSTRUCTIONS FOR PREPARATION Neat, in order, answers easy to find. Staple

More information

Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2

Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2 Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2 Instructor: Rob Bergen Applied Computer Science University of Winnipeg Announcements Website is up

More information

Divide: Paper & Pencil

Divide: Paper & Pencil Divide: Paper & Pencil 1001 Quotient Divisor 1000 1001010 Dividend -1000 10 101 1010 1000 10 Remainder See how big a number can be subtracted, creating quotient bit on each step Binary => 1 * divisor or

More information

ASSEMBLY LANGUAGE MACHINE ORGANIZATION

ASSEMBLY LANGUAGE MACHINE ORGANIZATION ASSEMBLY LANGUAGE MACHINE ORGANIZATION CHAPTER 3 1 Sub-topics The topic will cover: Microprocessor architecture CPU processing methods Pipelining Superscalar RISC Multiprocessing Instruction Cycle Instruction

More information

1010 2?= ?= CS 64 Lecture 2 Data Representation. Decimal Numbers: Base 10. Reading: FLD Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

1010 2?= ?= CS 64 Lecture 2 Data Representation. Decimal Numbers: Base 10. Reading: FLD Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 CS 64 Lecture 2 Data Representation Reading: FLD 1.2-1.4 Decimal Numbers: Base 10 Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Example: 3271 = (3x10 3 ) + (2x10 2 ) + (7x10 1 ) + (1x10 0 ) 1010 10?= 1010 2?= 1

More information

Chapter 2: Number Systems

Chapter 2: Number Systems Chapter 2: Number Systems Logic circuits are used to generate and transmit 1s and 0s to compute and convey information. This two-valued number system is called binary. As presented earlier, there are many

More information

Chapter 3: Arithmetic for Computers

Chapter 3: Arithmetic for Computers Chapter 3: Arithmetic for Computers Objectives Signed and Unsigned Numbers Addition and Subtraction Multiplication and Division Floating Point Computer Architecture CS 35101-002 2 The Binary Numbering

More information

Signed Multiplication Multiply the positives Negate result if signs of operand are different

Signed Multiplication Multiply the positives Negate result if signs of operand are different Another Improvement Save on space: Put multiplier in product saves on speed: only single shift needed Figure: Improved hardware for multiplication Signed Multiplication Multiply the positives Negate result

More information

Data Representation Type of Data Representation Integers Bits Unsigned 2 s Comp Excess 7 Excess 8

Data Representation Type of Data Representation Integers Bits Unsigned 2 s Comp Excess 7 Excess 8 Data Representation At its most basic level, all digital information must reduce to 0s and 1s, which can be discussed as binary, octal, or hex data. There s no practical limit on how it can be interpreted

More information

Kinds Of Data CHAPTER 3 DATA REPRESENTATION. Numbers Are Different! Positional Number Systems. Text. Numbers. Other

Kinds Of Data CHAPTER 3 DATA REPRESENTATION. Numbers Are Different! Positional Number Systems. Text. Numbers. Other Kinds Of Data CHAPTER 3 DATA REPRESENTATION Numbers Integers Unsigned Signed Reals Fixed-Point Floating-Point Binary-Coded Decimal Text ASCII Characters Strings Other Graphics Images Video Audio Numbers

More information

Floating-Point Data Representation and Manipulation 198:231 Introduction to Computer Organization Lecture 3

Floating-Point Data Representation and Manipulation 198:231 Introduction to Computer Organization Lecture 3 Floating-Point Data Representation and Manipulation 198:231 Introduction to Computer Organization Instructor: Nicole Hynes nicole.hynes@rutgers.edu 1 Fixed Point Numbers Fixed point number: integer part

More information

Lecture 8: Addition, Multiplication & Division

Lecture 8: Addition, Multiplication & Division Lecture 8: Addition, Multiplication & Division Today s topics: Signed/Unsigned Addition Multiplication Division 1 Signed / Unsigned The hardware recognizes two formats: unsigned (corresponding to the C

More information

ECE260: Fundamentals of Computer Engineering

ECE260: Fundamentals of Computer Engineering Arithmetic for Computers James Moscola Dept. of Engineering & Computer Science York College of Pennsylvania Based on Computer Organization and Design, 5th Edition by Patterson & Hennessy Arithmetic for

More information

COMP2611: Computer Organization. Data Representation

COMP2611: Computer Organization. Data Representation COMP2611: Computer Organization Comp2611 Fall 2015 2 1. Binary numbers and 2 s Complement Numbers 3 Bits: are the basis for binary number representation in digital computers What you will learn here: How

More information

Chapter 2. Data Representation in Computer Systems

Chapter 2. Data Representation in Computer Systems Chapter 2 Data Representation in Computer Systems Chapter 2 Objectives Understand the fundamentals of numerical data representation and manipulation in digital computers. Master the skill of converting

More information

CMPSCI 145 MIDTERM #1 Solution Key. SPRING 2017 March 3, 2017 Professor William T. Verts

CMPSCI 145 MIDTERM #1 Solution Key. SPRING 2017 March 3, 2017 Professor William T. Verts CMPSCI 145 MIDTERM #1 Solution Key NAME SPRING 2017 March 3, 2017 PROBLEM SCORE POINTS 1 10 2 10 3 15 4 15 5 20 6 12 7 8 8 10 TOTAL 100 10 Points Examine the following diagram of two systems, one involving

More information

Slide Set 1. for ENEL 339 Fall 2014 Lecture Section 02. Steve Norman, PhD, PEng

Slide Set 1. for ENEL 339 Fall 2014 Lecture Section 02. Steve Norman, PhD, PEng Slide Set 1 for ENEL 339 Fall 2014 Lecture Section 02 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary Fall Term, 2014 ENEL 353 F14 Section

More information

ECE331: Hardware Organization and Design

ECE331: Hardware Organization and Design ECE331: Hardware Organization and Design Lecture 15: Midterm 1 Review Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Basics Midterm to cover Book Sections (inclusive) 1.1 1.5

More information

MACHINE LEVEL REPRESENTATION OF DATA

MACHINE LEVEL REPRESENTATION OF DATA MACHINE LEVEL REPRESENTATION OF DATA CHAPTER 2 1 Objectives Understand how integers and fractional numbers are represented in binary Explore the relationship between decimal number system and number systems

More information

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Comp 4 Computer Organization Fall 26 Solutions for Problem Set #7 Problem. Bits of Floating-Point Represent the following in single-precision IEEE floating

More information

FEATURE ARTICLE. Michael Smith

FEATURE ARTICLE. Michael Smith In a recent project, Mike set out to develop DSP algorithms suitable for producing an improved sound stage for headphones. Using the Analog Devices 21061 SHARC, he modified the phase and amplitude of the

More information

Chapter 3. Arithmetic Text: P&H rev

Chapter 3. Arithmetic Text: P&H rev Chapter 3 Arithmetic Text: P&H rev3.29.16 Arithmetic for Computers Operations on integers Addition and subtraction Multiplication and division Dealing with overflow Floating-point real numbers Representation

More information

Computer Organisation CS303

Computer Organisation CS303 Computer Organisation CS303 Module Period Assignments 1 Day 1 to Day 6 1. Write a program to evaluate the arithmetic statement: X=(A-B + C * (D * E-F))/G + H*K a. Using a general register computer with

More information

Project 3: RPN Calculator

Project 3: RPN Calculator ECE267 @ UIC, Spring 2012, Wenjing Rao Project 3: RPN Calculator What to do: Ask the user to input a string of expression in RPN form (+ - * / ), use a stack to evaluate the result and display the result

More information

unused unused unused unused unused unused

unused unused unused unused unused unused BCD numbers. In some applications, such as in the financial industry, the errors that can creep in due to converting numbers back and forth between decimal and binary is unacceptable. For these applications

More information

DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS

DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS C H A P T E R 6 DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS OUTLINE 6- Binary Addition 6-2 Representing Signed Numbers 6-3 Addition in the 2 s- Complement System 6-4 Subtraction in the 2 s- Complement

More information

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng. CS 265 Computer Architecture Wei Lu, Ph.D., P.Eng. 1 Part 1: Data Representation Our goal: revisit and re-establish fundamental of mathematics for the computer architecture course Overview: what are bits

More information

Number Systems. Decimal numbers. Binary numbers. Chapter 1 <1> 8's column. 1000's column. 2's column. 4's column

Number Systems. Decimal numbers. Binary numbers. Chapter 1 <1> 8's column. 1000's column. 2's column. 4's column 1's column 10's column 100's column 1000's column 1's column 2's column 4's column 8's column Number Systems Decimal numbers 5374 10 = Binary numbers 1101 2 = Chapter 1 1's column 10's column 100's

More information

NAME: 1a. (10 pts.) Describe the characteristics of numbers for which this floating-point data type is well-suited. Give an example.

NAME: 1a. (10 pts.) Describe the characteristics of numbers for which this floating-point data type is well-suited. Give an example. MSU CSC 285 Spring, 2007 Exam 2 (5 pgs.) NAME: 1. Suppose that a eight-bit floating-point data type is defined with the eight bits divided into fields as follows, where the bits are numbered with zero

More information

Integers. N = sum (b i * 2 i ) where b i = 0 or 1. This is called unsigned binary representation. i = 31. i = 0

Integers. N = sum (b i * 2 i ) where b i = 0 or 1. This is called unsigned binary representation. i = 31. i = 0 Integers So far, we've seen how to convert numbers between bases. How do we represent particular kinds of data in a certain (32-bit) architecture? We will consider integers floating point characters What

More information

Excerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997

Excerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997 Excerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997 APPENDIX A.1 Number systems and codes Since ten-fingered humans are addicted to the decimal system, and since computers

More information

Course Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation

Course Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation Course Schedule CS 221 Computer Architecture Week 3: Information Representation (2) Fall 2001 W1 Sep 11- Sep 14 Introduction W2 Sep 18- Sep 21 Information Representation (1) (Chapter 3) W3 Sep 25- Sep

More information

Digital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer.

Digital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer. Digital Logic 1 Data Representations 1.1 The Binary System The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer. The system we

More information

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers Chapter 03: Computer Arithmetic Lesson 09: Arithmetic using floating point numbers Objective To understand arithmetic operations in case of floating point numbers 2 Multiplication of Floating Point Numbers

More information

Introduction to numerical algorithms

Introduction to numerical algorithms Introduction to numerical algorithms Given an algebraic equation or formula, we may want to approximate the value, and while in calculus, we deal with equations or formulas that are well defined at each

More information

Vector and Parallel Processors. Amdahl's Law

Vector and Parallel Processors. Amdahl's Law Vector and Parallel Processors. Vector processors are processors which have special hardware for performing operations on vectors: generally, this takes the form of a deep pipeline specialized for this

More information

National 5 Computing Science Software Design & Development

National 5 Computing Science Software Design & Development National 5 Computing Science Software Design & Development 1 Stages of Development 2 Analysis 3 Design 4 Implementation 5 Testing 6 Documentation 7 Evaluation 8 Maintenance 9 Data Types & Structures 10

More information

IBM 370 Basic Data Types

IBM 370 Basic Data Types IBM 370 Basic Data Types This lecture discusses the basic data types used on the IBM 370, 1. Two s complement binary numbers 2. EBCDIC (Extended Binary Coded Decimal Interchange Code) 3. Zoned Decimal

More information

DECIMALS are special fractions whose denominators are powers of 10.

DECIMALS are special fractions whose denominators are powers of 10. Ch 3 DECIMALS ~ Notes DECIMALS are special fractions whose denominators are powers of 10. Since decimals are special fractions, then all the rules we have already learned for fractions should work for

More information

CS 101, Mock Computer Architecture

CS 101, Mock Computer Architecture CS 101, Mock Computer Architecture Computer organization and architecture refers to the actual hardware used to construct the computer, and the way that the hardware operates both physically and logically

More information

Number Systems CHAPTER Positional Number Systems

Number Systems CHAPTER Positional Number Systems CHAPTER 2 Number Systems Inside computers, information is encoded as patterns of bits because it is easy to construct electronic circuits that exhibit the two alternative states, 0 and 1. The meaning of

More information

Slide Set 1. for ENEL 353 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary

Slide Set 1. for ENEL 353 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary Slide Set 1 for ENEL 353 Fall 2017 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary Fall Term, 2017 SN s ENEL 353 Fall 2017 Slide Set 1 slide

More information

SIGNED AND UNSIGNED SYSTEMS

SIGNED AND UNSIGNED SYSTEMS EE 357 Unit 1 Fixed Point Systems and Arithmetic Learning Objectives Understand the size and systems used by the underlying HW when a variable is declared in a SW program Understand and be able to find

More information

Chapter 4: Data Representations

Chapter 4: Data Representations Chapter 4: Data Representations Integer Representations o unsigned o sign-magnitude o one's complement o two's complement o bias o comparison o sign extension o overflow Character Representations Floating

More information

CHW 261: Logic Design

CHW 261: Logic Design CHW 261: Logic Design Instructors: Prof. Hala Zayed Dr. Ahmed Shalaby http://www.bu.edu.eg/staff/halazayed14 http://bu.edu.eg/staff/ahmedshalaby14# Slide 1 Slide 2 Slide 3 Digital Fundamentals CHAPTER

More information

Divisibility Rules and Their Explanations

Divisibility Rules and Their Explanations Divisibility Rules and Their Explanations Increase Your Number Sense These divisibility rules apply to determining the divisibility of a positive integer (1, 2, 3, ) by another positive integer or 0 (although

More information

LAB A Translating Data to Binary

LAB A Translating Data to Binary LAB A Translating Data to Binary Create a directory for this lab and perform in it the following groups of tasks: LabA1.java 1. Write the Java app LabA1 that takes an int via a command-line argument args[0]

More information

Chapter 3 Arithmetic for Computers (Part 2)

Chapter 3 Arithmetic for Computers (Part 2) Department of Electr rical Eng ineering, Chapter 3 Arithmetic for Computers (Part 2) 王振傑 (Chen-Chieh Wang) ccwang@mail.ee.ncku.edu.tw ncku edu Depar rtment of Electr rical Eng ineering, Feng-Chia Unive

More information

Agenda EE 224: INTRODUCTION TO DIGITAL CIRCUITS & COMPUTER DESIGN. Lecture 1: Introduction. Go over the syllabus 3/31/2010

Agenda EE 224: INTRODUCTION TO DIGITAL CIRCUITS & COMPUTER DESIGN. Lecture 1: Introduction. Go over the syllabus 3/31/2010 // EE : INTRODUCTION TO DIGITAL CIRCUITS & COMPUTER DESIGN Lecture : Introduction /9/ Avinash Kodi, kodi@ohio.edu Agenda Go over the syllabus Introduction ti to Digital it Systems // Why Digital Systems?

More information

Advanced Computer Architecture-CS501

Advanced Computer Architecture-CS501 Advanced Computer Architecture Lecture No. 34 Reading Material Vincent P. Heuring & Harry F. Jordan Chapter 6 Computer Systems Design and Architecture 6.1, 6.2 Summary Introduction to ALSU Radix Conversion

More information

Computer (Literacy) Skills. Number representations and memory. Lubomír Bulej KDSS MFF UK

Computer (Literacy) Skills. Number representations and memory. Lubomír Bulej KDSS MFF UK Computer (Literacy Skills Number representations and memory Lubomír Bulej KDSS MFF UK Number representations? What for? Recall: computer works with binary numbers Groups of zeroes and ones 8 bits (byte,

More information

Math in MIPS. Subtracting a binary number from another binary number also bears an uncanny resemblance to the way it s done in decimal.

Math in MIPS. Subtracting a binary number from another binary number also bears an uncanny resemblance to the way it s done in decimal. Page < 1 > Math in MIPS Adding and Subtracting Numbers Adding two binary numbers together is very similar to the method used with decimal numbers, except simpler. When you add two binary numbers together,

More information

Thomas Polzer Institut für Technische Informatik

Thomas Polzer Institut für Technische Informatik Thomas Polzer tpolzer@ecs.tuwien.ac.at Institut für Technische Informatik Operations on integers Addition and subtraction Multiplication and division Dealing with overflow Floating-point real numbers VO

More information

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Bits and Bytes and Numbers

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Bits and Bytes and Numbers Computer Science 324 Computer Architecture Mount Holyoke College Fall 2007 Topic Notes: Bits and Bytes and Numbers Number Systems Much of this is review, given the 221 prerequisite Question: how high can

More information

Internal Data Representation

Internal Data Representation Appendices This part consists of seven appendices, which provide a wealth of reference material. Appendix A primarily discusses the number systems and their internal representation. Appendix B gives information

More information

DLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 1 DLD P VIDYA SAGAR

DLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 1 DLD P VIDYA SAGAR UNIT I Digital Systems: Binary Numbers, Octal, Hexa Decimal and other base numbers, Number base conversions, complements, signed binary numbers, Floating point number representation, binary codes, error

More information

BINARY SYSTEM. Binary system is used in digital systems because it is:

BINARY SYSTEM. Binary system is used in digital systems because it is: CHAPTER 2 CHAPTER CONTENTS 2.1 Binary System 2.2 Binary Arithmetic Operation 2.3 Signed & Unsigned Numbers 2.4 Arithmetic Operations of Signed Numbers 2.5 Hexadecimal Number System 2.6 Octal Number System

More information

Real Numbers finite subset real numbers floating point numbers Scientific Notation fixed point numbers

Real Numbers finite subset real numbers floating point numbers Scientific Notation fixed point numbers Real Numbers We have been studying integer arithmetic up to this point. We have discovered that a standard computer can represent a finite subset of the infinite set of integers. The range is determined

More information

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC CHAPTER V-1 CHAPTER V CHAPTER V NUMBER SYSTEMS AND ARITHMETIC CHAPTER V-2 NUMBER SYSTEMS RADIX-R REPRESENTATION Decimal number expansion 73625 10 = ( 7 10 4 ) + ( 3 10 3 ) + ( 6 10 2 ) + ( 2 10 1 ) +(

More information

Number System. Introduction. Decimal Numbers

Number System. Introduction. Decimal Numbers Number System Introduction Number systems provide the basis for all operations in information processing systems. In a number system the information is divided into a group of symbols; for example, 26

More information

Chapter 5 : Computer Arithmetic

Chapter 5 : Computer Arithmetic Chapter 5 Computer Arithmetic Integer Representation: (Fixedpoint representation): An eight bit word can be represented the numbers from zero to 255 including = 1 = 1 11111111 = 255 In general if an nbit

More information

CS 261 Fall Floating-Point Numbers. Mike Lam, Professor.

CS 261 Fall Floating-Point Numbers. Mike Lam, Professor. CS 261 Fall 2018 Mike Lam, Professor https://xkcd.com/217/ Floating-Point Numbers Floating-point Topics Binary fractions Floating-point representation Conversions and rounding error Binary fractions Now

More information

Number representations

Number representations Number representations Number bases Three number bases are of interest: Binary, Octal and Hexadecimal. We look briefly at conversions among them and between each of them and decimal. Binary Base-two, or

More information

CS6303 COMPUTER ARCHITECTURE LESSION NOTES UNIT II ARITHMETIC OPERATIONS ALU In computing an arithmetic logic unit (ALU) is a digital circuit that performs arithmetic and logical operations. The ALU is

More information

Inf2C - Computer Systems Lecture 2 Data Representation

Inf2C - Computer Systems Lecture 2 Data Representation Inf2C - Computer Systems Lecture 2 Data Representation Boris Grot School of Informatics University of Edinburgh Last lecture Moore s law Types of computer systems Computer components Computer system stack

More information

By, Ajinkya Karande Adarsh Yoga

By, Ajinkya Karande Adarsh Yoga By, Ajinkya Karande Adarsh Yoga Introduction Early computer designers believed saving computer time and memory were more important than programmer time. Bug in the divide algorithm used in Intel chips.

More information

(Refer Slide Time: 1:40)

(Refer Slide Time: 1:40) Computer Architecture Prof. Anshul Kumar Department of Computer Science and Engineering, Indian Institute of Technology, Delhi Lecture - 3 Instruction Set Architecture - 1 Today I will start discussion

More information

Bits, Words, and Integers

Bits, Words, and Integers Computer Science 52 Bits, Words, and Integers Spring Semester, 2017 In this document, we look at how bits are organized into meaningful data. In particular, we will see the details of how integers are

More information

3.1 DATA REPRESENTATION (PART C)

3.1 DATA REPRESENTATION (PART C) 3.1 DATA REPRESENTATION (PART C) 3.1.3 REAL NUMBERS AND NORMALISED FLOATING-POINT REPRESENTATION In decimal notation, the number 23.456 can be written as 0.23456 x 10 2. This means that in decimal notation,

More information

Data Representation 1

Data Representation 1 1 Data Representation Outline Binary Numbers Adding Binary Numbers Negative Integers Other Operations with Binary Numbers Floating Point Numbers Character Representation Image Representation Sound Representation

More information

Integer Representation Floating point Representation Other data types

Integer Representation Floating point Representation Other data types Chapter 2 Bits, Data Types & Operations Integer Representation Floating point Representation Other data types Why do Computers use Base 2? Base 10 Number Representation Natural representation for human

More information

Topic Notes: Bits and Bytes and Numbers

Topic Notes: Bits and Bytes and Numbers Computer Science 220 Assembly Language & Comp Architecture Siena College Fall 2011 Topic Notes: Bits and Bytes and Numbers Binary Basics At least some of this will be review for most of you, but we start

More information

Final Labs and Tutors

Final Labs and Tutors ICT106 Fundamentals of Computer Systems - Topic 2 REPRESENTATION AND STORAGE OF INFORMATION Reading: Linux Assembly Programming Language, Ch 2.4-2.9 and 3.6-3.8 Final Labs and Tutors Venue and time South

More information

IT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1

IT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1 IT 1204 Section 2.0 Data Representation and Arithmetic 2009, University of Colombo School of Computing 1 What is Analog and Digital The interpretation of an analog signal would correspond to a signal whose

More information

Organisasi Sistem Komputer

Organisasi Sistem Komputer LOGO Organisasi Sistem Komputer OSK 8 Aritmatika Komputer 1 1 PT. Elektronika FT UNY Does the calculations Arithmetic & Logic Unit Everything else in the computer is there to service this unit Handles

More information

Binary Representations and Arithmetic

Binary Representations and Arithmetic Binary Representations and Arithmetic 9--26 Common number systems. Base : decimal Base 2: binary Base 6: hexadecimal (memory addresses) Base 8: octal (obsolete computer systems) Base 64 (email attachments,

More information

C++ Data Types. 1 Simple C++ Data Types 2. 3 Numeric Types Integers (whole numbers) Decimal Numbers... 5

C++ Data Types. 1 Simple C++ Data Types 2. 3 Numeric Types Integers (whole numbers) Decimal Numbers... 5 C++ Data Types Contents 1 Simple C++ Data Types 2 2 Quick Note About Representations 3 3 Numeric Types 4 3.1 Integers (whole numbers)............................................ 4 3.2 Decimal Numbers.................................................

More information

1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM

1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM 1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM 1.1 Introduction Given that digital logic and memory devices are based on two electrical states (on and off), it is natural to use a number

More information

Physics 306 Computing Lab 5: A Little Bit of This, A Little Bit of That

Physics 306 Computing Lab 5: A Little Bit of This, A Little Bit of That Physics 306 Computing Lab 5: A Little Bit of This, A Little Bit of That 1. Introduction You have seen situations in which the way numbers are stored in a computer affects a program. For example, in the

More information

Numeric Encodings Prof. James L. Frankel Harvard University

Numeric Encodings Prof. James L. Frankel Harvard University Numeric Encodings Prof. James L. Frankel Harvard University Version of 10:19 PM 12-Sep-2017 Copyright 2017, 2016 James L. Frankel. All rights reserved. Representation of Positive & Negative Integral and

More information

1.1 Information representation

1.1 Information representation Fundamentals of Data Representation: Before we jump into the world of number systems, we'll need a point of reference; I recommend that you copy the following table that you can refer to throughout this

More information

Chapter 1 Review of Number Systems

Chapter 1 Review of Number Systems 1.1 Introduction Chapter 1 Review of Number Systems Before the inception of digital computers, the only number system that was in common use is the decimal number system which has a total of 10 digits

More information

Floating-point Arithmetic. where you sum up the integer to the left of the decimal point and the fraction to the right.

Floating-point Arithmetic. where you sum up the integer to the left of the decimal point and the fraction to the right. Floating-point Arithmetic Reading: pp. 312-328 Floating-Point Representation Non-scientific floating point numbers: A non-integer can be represented as: 2 4 2 3 2 2 2 1 2 0.2-1 2-2 2-3 2-4 where you sum

More information

Floating-Point Arithmetic

Floating-Point Arithmetic Floating-Point Arithmetic if ((A + A) - A == A) { SelfDestruct() } Reading: Study Chapter 3. L12 Multiplication 1 Approximating Real Numbers on Computers Thus far, we ve entirely ignored one of the most

More information

CS2214 COMPUTER ARCHITECTURE & ORGANIZATION SPRING 2014

CS2214 COMPUTER ARCHITECTURE & ORGANIZATION SPRING 2014 B CS2214 COMPUTER ARCHITECTURE & ORGANIZATION SPRING 2014 DUE : March 3, 2014 READ : - Related sections of Chapter 2 - Related sections of Chapter 3 - Related sections of Appendix A - Related sections

More information

Numbers and Computers. Debdeep Mukhopadhyay Assistant Professor Dept of Computer Sc and Engg IIT Madras

Numbers and Computers. Debdeep Mukhopadhyay Assistant Professor Dept of Computer Sc and Engg IIT Madras Numbers and Computers Debdeep Mukhopadhyay Assistant Professor Dept of Computer Sc and Engg IIT Madras 1 Think of a number between 1 and 15 8 9 10 11 12 13 14 15 4 5 6 7 12 13 14 15 2 3 6 7 10 11 14 15

More information