Presentation is loading. Please wait.

Presentation is loading. Please wait.

Shift registers and Floating Point Numbers

Similar presentations


Presentation on theme: "Shift registers and Floating Point Numbers"— Presentation transcript:

1 Shift registers and Floating Point Numbers
pp , in Carpinelli

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 to to the right

3 Example 1

4 Parallel loading register

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 selected from one of two inputs is done by a 2-to-1 MUX

6 Register  Shift Register
We can adapt the previous circuit to make a shift register Instead of having one possible input for a flip-flop come from the output of the same flip-flop, we can change this to having one possible input for a flip-flop come from an adjacent flip-flop Then if we are not loading from the data switches and we go through a positive edge of the clock, the values in the flip-flops will shift

7 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

8 How are shift registers used?
Modems Cyclic Redundancy Check (CRC) Multiplication Adding floats

9 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

10 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 Inside the computer, data that moves around as words (on parallel cables having a connection for each bit in the word) The transmission lines are longer and require data to be sent serially (one bit at a time)

11 Cyclic Redundancy Check
In order to check for error 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. 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.

12 CRC Any mathematical operation performed on the transmitted data could serve as a check Another common calculation is summing, then it is called a checksum 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

13 CRC = Shift register + XORs
Basically one has a shift register with a few excluded OR gates inserted in strategic positions.

14 Multiplication: Shift and add
1 + shift shift

15 Fractions Similar to what we’re used to with decimal numbers 3.14159 =
3 · · · · · · 10-5 = 1 · · · · · · · · 2-6 (  )

16 Converting decimal to binary II
98.6 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 1

17 Converting decimal to binary III
98.6 Fractional part 0.6  2 = 1.2 0.2  2 = 0.4 0.4  2 = 0.8 0.8  2 = 1.6 REPEATS

18 Converting decimal to binary IV
Put together the integral and fractional parts 98.6 

19 Scientific notation Used to represent very large and very small numbers Ex. Avogadro’s number   1023 particles Ex. Fundamental charge e   C  C

20 Floats SHIFT expression so it is just under 1 and keep track of the number of shifts  27 Express the number of shifts in binary

21 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

22 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

23 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

24 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.)

25 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


Download ppt "Shift registers and Floating Point Numbers"

Similar presentations


Ads by Google