PHY 201 (Blum)1 Shift registers and Floating Point Numbers Chapter 11 in Tokheim.

Slides:



Advertisements
Similar presentations
Fixed Point Numbers The binary integer arithmetic you are used to is known by the more general term of Fixed Point arithmetic. Fixed Point means that we.
Advertisements

Topics covered: Floating point arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
2-1 Chapter 2 - Data Representation Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring Computer Architecture.
Chapter 2: Data Representation
Principles of Computer Architecture Miles Murdocca and Vincent Heuring Chapter 2: Data Representation.
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Assembly Language and Computer Architecture Using C++ and Java
Assembly Language and Computer Architecture Using C++ and Java
4 Operations On Data Foundations of Computer Science ã Cengage Learning.
Binary Number Systems.
Binary Representation and Computer Arithmetic
Dr. Bernard Chen Ph.D. University of Central Arkansas
Chapter3 Fixed Point Representation Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.
The Binary Number System
Data Representation Number Systems.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
ES 244: Digital Logic Design Chapter 1 Chapter 1: Introduction Uchechukwu Ofoegbu Temple University.
CSIT 301 (Blum)1 Recap so far (Not gotten to last time) So there were issues about the number of operands. –Recall that we have a fetch-execute cycle –
Computer Organization and Architecture Computer Arithmetic Chapter 9.
Computer Arithmetic Nizamettin AYDIN
Computer Arithmetic. Instruction Formats Layout of bits in an instruction Includes opcode Includes (implicit or explicit) operand(s) Usually more than.
Computer Arithmetic.
IT253: Computer Organization
Number Systems So far we have studied the following integer number systems in computer Unsigned numbers Sign/magnitude numbers Two’s complement numbers.
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles of Computer.
ECE232: Hardware Organization and Design
Floating Point (a brief look) We need a way to represent –numbers with fractions, e.g., –very small numbers, e.g., –very large numbers,
CH09 Computer Arithmetic  CPU combines of ALU and Control Unit, this chapter discusses ALU The Arithmetic and Logic Unit (ALU) Number Systems Integer.
Oct. 18, 2007SYSC 2001* - Fall SYSC2001-Ch9.ppt1 See Stallings Chapter 9 Computer Arithmetic.
Representation of Data Ma King Man. Reference Text Book: Volume 2 Notes: Chapter 19.
Fixed and Floating Point Numbers Lesson 3 Ioan Despi.
CSC 221 Computer Organization and Assembly Language
Number Systems & Operations
CSC 370 (Blum)1 Binary Numbers Material on Data Representation can be found in Chapter 2 of Computer Architecture (Nicholas Carter)
Digital Logic Lecture 3 Binary Arithmetic By Zyad Dwekat The Hashemite University Computer Engineering Department.
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
PHY 201 (Blum)1 Shift registers and Floating Point Numbers Chapter 11 in Tokheim.
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
Chapter 9 Computer Arithmetic
William Stallings Computer Organization and Architecture 8th Edition
Floating Point Representations
Fundamentals of Computer Science
Dr.Faisal Alzyoud 2/20/2018 Binary Arithmetic.
A brief comparison of integer and double representation
Dr. Clincy Professor of CS
A Level Computing Component 2
William Stallings Computer Organization and Architecture 7th Edition
Data Structures Mohammed Thajeel To the second year students
Binary Numbers Material on Data Representation can be found in Chapter 2 of Computer Architecture (Nicholas Carter) CSC 370 (Blum)
Shift registers and Floating Point Numbers
Binary Numbers Material on Data Representation can be found in Chapter 2 of Computer Architecture (Nicholas Carter) CSIT 301 (Blum)
Data Representation Data Types Complements Fixed Point Representation
ECEG-3202 Computer Architecture and Organization
Chapter 3 DataStorage Foundations of Computer Science ã Cengage Learning.
Floating Point Numbers
Binary Numbers Material on Data Representation can be found in Chapter 2 of Computer Architecture (Nicholas Carter) CSIT 301 (Blum)
Shift registers and Floating Point Numbers
Chapter3 Fixed Point Representation
Shift registers and Floating Point Numbers
Presentation transcript:

PHY 201 (Blum)1 Shift registers and Floating Point Numbers Chapter 11 in Tokheim

PHY 201 (Blum)2 What are they?  Recall that a register is a small piece of memory that holds values.  In addition to holding values, a shift register performs a simple operation on the values; it moves them to the left or to the right.

PHY 201 (Blum)3 Example Serial input Serial output Shift register

PHY 201 (Blum)4 Parallel loading register

PHY 201 (Blum)5 Register  On the previous slide, the input of a flip-flop is selected from two possible choices The output of the same flip-flop. The data switch above.  Recall that selecting from one of two inputs is done by a 2-to-1 MUX. The load line serves as the address/select input.

PHY 201 (Blum)6 When Load is high, we are selecting the data switches to be the data input. So when we go through a positive edge of the clock, we are writing the value from the data switches to the register.

PHY 201 (Blum)7 When Load is low, we are selecting the flip-flop’s output to be the data input. So when we go through a positive clock edge, we are writing the value from the flip-flop to the flip-flop – thus keeping the value the same as before (holding).

PHY 201 (Blum)8 Register  Shift Register  We can adapt the previous circuit to make a shift register. Instead of having one of the two possible inputs for a flip-flop come from the output of the same flip- flop, we can change this to having that input come from an adjacent flip-flop. Then if when the load input is low and we go through a positive clock edge, the effect is not to hold the values of the register but to shift them. This is part of the lab.

PHY 201 (Blum)9 On the ends  If one shifts from the right to the left, then the input to the rightmost flip-flop does not come from an adjacent flip-flop during the shift operation. There are several options Data switch input Always 1 Always 0 Use leftmost output to form a ring

PHY 201 (Blum)10 How are shift registers used?  Modems  Cyclic Redundancy Check (CRC)  Multiplication  Adding floats

PHY 201 (Blum)11 Modems  A modem (Modulator-Demodulator) takes a signal from a computer and places it on a transmission line.  A transmitting modem modulates, that is, converts a digital signal from a computer to a pseudo-analog signal more appropriate for a transmission line.  The receiving modem demodulates, that is, converts the pseudo-analog signal back into digital form.

PHY 201 (Blum)12 Modems (Cont.)  But the aspect of modems relevant here is that The transmitting modem converts parallel data to serial. The receiving modem converts serial data into parallel form.

PHY 201 (Blum)13 Inside  Outside  Inside the computer, data that moves around as words on parallel cables having a connection for each bit in the word. (Although with SATA, some internal data movement has become serial.)  The transmission lines are longer and require data to be sent serially (one bit at a time).

PHY 201 (Blum)14 Parallel to Serial To leave the computer, data moves into register in parallel, several bits at once. Data then moves out of the register serially, one bit at a time.

PHY 201 (Blum)15 Serial to Parallel To enter the computer, data enters the register in serial, one bit at a time. Data then moves out of the register in parallel. DEMO!

PHY 201 (Blum)16 Help for S/L should be low to get the data into the 74165, then S/L should be high for the shifting action to occur. The loading or shifting occurs on the edge of the clock.

PHY 201 (Blum)17 Help for If CLR is high, and both A and B are high, a shifting occurs with an high coming in as the new bit. If either A or B is low shifting occurs with a low coming in as the new bit. That’s why the “transmission line” is fed to both A and B inputs.

PHY 201 (Blum)18 “Modem” simulation

PHY 201 (Blum)19 Cyclic Redundancy Check  In order to check for errors that may occur during transmission, the sender calculates a number, a cyclic redundancy check. The receiver does the same calculation. If they agree, then presumably no error occurred in transmission.

PHY 201 (Blum)20 CRC Modification  Actually the receiver does a calculation that includes the sender’s CRC as part of the data and should get an answer of zero. It’s easier electronically to see if series of bits corresponds to zero.  Any mathematical operation performed on the transmitted data could serve as a check. Another common calculation is summing, then it is called a checksum.

PHY 201 (Blum)21 CRC: funny division  The calculation should not be time consuming.  Think of CRC as a funny kind of division, the remainder from the division is the check.  It’s not ordinary division, but a strange kind of division that is easy to realize electronically.

PHY 201 (Blum)22 CRC = Shift register + XORs Basically one has a shift register with a few excluded OR gates inserted in strategic positions.

PHY 201 (Blum)23 00  0 0   0 0  00  0 1   1 0  The first four shift in without anything interesting happening.

PHY 201 (Blum)24 01  0 0   0 1   1 1   1 0  0 01  0 1 

PHY 201 (Blum)25 Multiplication: Shift and add 1001   shift

PHY 201 (Blum)26 Fractions  Similar to what we’re used to with decimal numbers =3 · · · · · · =1 · · · · · · · · 2 -6 (  )

PHY 201 (Blum)27 Converting decimal to binary II  Integer part  98 / 2 = 49 remainder 0  49 / 2 = 24 remainder 1  24 / 2 = 12 remainder 0  12 / 2 = 6 remainder 0  6 / 2 = 3 remainder 0  3 / 2 = 1 remainder 1  1 / 2 = 0 remainder

PHY 201 (Blum)28 Converting decimal to binary III  Fractional part  0.61  2 = 1.22  0.22  2 = 0.44  0.44  2 = 0.88  0.88  2 = 1.76  0.76  2 = 1.52  0.52  2 =

PHY 201 (Blum)29 Converting decimal to binary IV  Put together the integral and fractional parts  

PHY 201 (Blum)30 Another Example (Whole number part)  Integer part  123 / 2 = 61 remainder 1  61 / 2 = 30 remainder 1  30 / 2 = 15 remainder 0  15 / 2 = 7 remainder 1  7 / 2 = 3 remainder 1  3 / 2 = 1 remainder 1  1 / 2 = 0 remainder

PHY 201 (Blum)31 Checking: Go to Programs/Accessories/Calculator

PHY 201 (Blum)32 Put the calculator in Scientific view

PHY 201 (Blum)33 Enter number, put into binary mode

PHY 201 (Blum)34 Another Example (fractional part)  Fractional part   2 =   2 =   2 =   2 =   2 =   2 =   2 =  … …

PHY 201 (Blum)35 Checking fractional part: Enter digits found in binary mode Note that the leading zero does not display.

PHY 201 (Blum)36 Convert to decimal mode, then

Edit copy – View Scientific – Edit Paste PHY 201 (Blum)37

PHY 201 (Blum)38 Divide by 2 raised to the number of digits (in this case 7, including leading zero)

PHY 201 (Blum)39 In most cases it will not be exact

PHY 201 (Blum)40 Other way around  Multiply fraction by 2 raised to the desired number of digits in the fractional part. For example.456  2 7 =  Throw away the fractional part and represent the whole number 58   But note that we specified 7 digits and the result above uses only 6. Therefore we need to put in the leading

PHY 201 (Blum)41 Fixed point  If one has a set number of bits reserved for representing the whole number part and another set number of bits reserved for representing the fractional part of a number, then one is said to be using fixed point representation. The point dividing whole number from fraction has an unchanging place in the number.

PHY 201 (Blum)42 Limits of the fixed point approach  Suppose you use 4 bits for the whole number part and 4 bits for the fractional part (ignoring sign for now).  The largest number would be =  The smallest, non-zero number would be =.0625

PHY 201 (Blum)43 Floating point representation  Floating point representation allows one to represent a wider range of numbers using the same number of bits.  It is like scientific notation.

PHY 201 (Blum)44 Scientific notation  Used to represent very large and very small numbers Ex. Avogadro’s number    particles   Ex. Fundamental charge e    C   C

PHY 201 (Blum)45 Scientific notation: all of these are the same number  =  10 0   10 =  10 1   100 =  10 2   10 3   10 4  Rule: Shift the point to the left and increment the power of ten.

PHY 201 (Blum)46 Small numbers               Rule: shift point to the right and decrement the power.

PHY 201 (Blum)47 Floating Point Rules  Starting with the fixed point binary representation, shift the point and increase the power (of 2 now that we’re in binary).  Shift so that the number has no whole number part and also so that the first fractional bit (the half’s place) has a 1.

PHY 201 (Blum)48 Floats  SHIFT expression so it is just under 1 and keep track of the number of shifts    2 7  Express the number of shifts in binary  

PHY 201 (Blum)49 Mantissa and Exponent and Sign    (Significand) Mantissa    Exponent  The number may be negative, so there a bit (the sign bit) reserved to indicate whether the number is positive or negative

PHY 201 (Blum)50 Biasing  Actually the exponent is not represented as shown on the previous slide.  There were 8 bits used to represent the exponent on the previous slide, that means there are 256 numbers that could be represented.  Since the exponent could be negative (to represent numbers less than 1), we choose half of the range to be positive and half to be negative, i.e to 127.

PHY 201 (Blum)51 Biasing (Cont.)  In biasing, one does not use 2’s complement or a sign bit.  Instead one adds a bias (equal to the magnitude of the most negative number) to the exponents and represents the result of that addition.

PHY 201 (Blum)52 Biasing (Cont.)  With 8 bits, the bias is 128.  We had to shift 7 times to the left, corresponding to an exponent of +7  We add that to the bias 128+7=135  That is the number we put in the exponent portion:  (In the IEEE 754 format for floats, you bias by one less (127) and reserve the exponents and for special purposes.)

PHY 201 (Blum)53 Big floats  Assume we use 8 bits, 4 for the mantissa and 4 for the exponent (neglecting sign). What is the largest float?  Mantissa: 1111 Exponent 1111   2 7  =120  (Compare this to the largest fixed-point number using the same amount of space )

PHY 201 (Blum)54 Small floats  Assume we use 8 bits, 4 for the mantissa and 4 for the exponent (neglecting sign). What is the smallest float?  Mantissa: 1000 Exponent 0000  0.5  2 -8  =  (Compare this to the smallest fixed-point number using the same amount of space.0625)

PHY 201 (Blum)55 One more fine point  As discussed so far, the mantissa (significand) always starts with a 1.  When storage was expensive, designers opted not to represent this bit, since it is always 1.  It had to be inserted for various operations on the number (adding, multiplying, etc.), but it did not have to be stored.