floating point adding

Page 1 of 1

10 Replies - 3560 Views - Last Post: 07 March 2010 - 11:07 AM

#1 polska03

• D.I.C Regular

Reputation: 5
• Posts: 302
• Joined: 28-November 09

floating point adding

Posted 05 March 2010 - 05:31 PM

Op-code Operand Description
1 RXY LOAD the register R with the bit pattern found in a memory cell whose address is XY.
Example: 14A3 would cause the contents of the memory cell located at address A3 to be place in register 4.

2 RXY LOAD the register R with the bit pattern XY.
Example: 20A3 would cause the value A3 to be placed in register 0

3 RXY STORE the bit pattern found in register R in the memory cell whose address is XY.
Example: 35B1 would cause the contents of register 5 to be placed in the memory cell whose address is B1.

4 ORS MOVE the bit pattern found in register R to S.
Example: 40A4 would cause the contents of register A to be copied into register 4.

5 RST ADD the bit patterns found in registers S and T as though they were two's complement representations and leave the result in register R.
Example: 5726 would cause the binary values in registers 2 and 6 to be added an the sum placed in register 7.

6 RST ADD the bit patterns in register S and T as they represented values in floating-point notation and leave the floating-point result in register R.
Example: 634E would cause the values in registers 4 and E to be added as floating-point values and the result to be placed in register 3.

7. RST OR the bit patterns in registers S and T and place the result in register R.
Example: 7CB4 would cause the result of ORing the contents of registers B and 4 to be placed in register C.

8 RST AND the bit patterns in register S and T place the result in register R.
Example: 8045 would cause the result of ANDing the contents of registers 4 and 5 to be placed in register 0.

9 RST EXCLUSIVE OR the bit patterns in register S and T and place the result in register R.
Example: 95F3 would cause the result EXCLUSIVE ORing the contents of registers F and 3 to be placed in register 5.

A ROX ROTATE the bit pattern in register R on bit to the right X times. Each time place the bit that started at low-order end at the high-order end.
Example: A403 would cause the contents of register 4 to be rotated 3 bits to the right in a circular fashion.

B RXY JUMP to the instruction located in the memory cell at address XY if the bit pattern in register R is equal to the bit pattern in register number 0. Otherwise, continue with the normal sequence of execution. (The jump is implemented by coping XY into the program counter during the execute phase.)
Example: B43C would first compare the contents of register 4 with the contents of register 0. If the two were equel, the pattern 3C would be placed in the program counter so that the next instruction executed would be the one located at that memory address.Otherwise, nothing would be done and program execution would continue in its normal sequence.

C 000 HALT execution
Example:C000 would cause program execution to stop.

This si the machine lamguage. the question asks if register 4 is 3C and register 5 is C8. It asks what will be in register 0 after 6045 executes. I am confused because it is not adding C8+3C=104. Can someone tel lme what this will sum up to in floating point notation.

Is This A Good Question/Topic? 0

Replies To: floating point adding

#2 r.stiltskin

• D.I.C Lover

Reputation: 2030
• Posts: 5,427
• Joined: 27-December 05

Re: floating point adding

Posted 05 March 2010 - 07:45 PM

Almost everything that you posted is irrelevant!
The only useful piece of information is the paragraph that describes the meaning of op code 6, so why did you post all those other codes?

And yet, you have not posted enough information to answer your question. How are your floating point numbers represented? A number in this system "apparently" consists of 8 binary digits (I'm just guessing that based on the examples, but maybe I shouldn't assume that it's true). But which digits are the significand and which digits are the exponent? This information is crucial.

Read the section on "Floating Point Arithmetic Operations" here.

This post has been edited by r.stiltskin: 05 March 2010 - 07:49 PM

Was This Post Helpful? 0

#3 polska03

• D.I.C Regular

Reputation: 5
• Posts: 302
• Joined: 28-November 09

Re: floating point adding

Posted 05 March 2010 - 07:53 PM

register 4 contains 3c and regitser 5 contains c8 which I stated
Was This Post Helpful? 0

#4 r.stiltskin

• D.I.C Lover

Reputation: 2030
• Posts: 5,427
• Joined: 27-December 05

Re: floating point adding

Posted 06 March 2010 - 07:04 AM

polska03, on 05 March 2010 - 09:53 PM, said:

register 4 contains 3c and regitser 5 contains c8 which I stated

Yes, you stated the raw VALUES in the registers. But that does not tell us what those values represent.

I can only repeat what I said last night:

r.stiltskin, on 05 March 2010 - 09:45 PM, said:

... you have not posted enough information to answer your question. How are your floating point numbers represented? A number in this system "apparently" consists of 8 binary digits (I'm just guessing that based on the examples, but maybe I shouldn't assume that it's true). But which digits are the significand and which digits are the exponent? This information is crucial.

Read the section on "Floating Point Arithmetic Operations" here.

Was This Post Helpful? 0

#5 polska03

• D.I.C Regular

Reputation: 5
• Posts: 302
• Joined: 28-November 09

Re: floating point adding

Posted 06 March 2010 - 12:43 PM

Including the appendix of the op codes. This is the full question. Suppose the registers 4 and 5 in the machine described in appendix C(which is the information in the first post) contain the bit patterns 3C and C8 respectively. What bit pattern is is left in register 0 after executing each of the following instructions.
bunch of questions and i am stuck on e)6045.
the floating point format is 8 bits with 1 sign bit____3 bit exponent______4 bit mantissa
Was This Post Helpful? 0

#6 r.stiltskin

• D.I.C Lover

Reputation: 2030
• Posts: 5,427
• Joined: 27-December 05

Re: floating point adding

Posted 06 March 2010 - 01:18 PM

polska03, on 06 March 2010 - 02:43 PM, said:

the floating point format is 8 bits with 1 sign bit____3 bit exponent______4 bit mantissa

OK - so there it is. Mantissa means the same as significand. Now, if you read the Wikipedia article on floating point,especially the section on Floating Point Arithmetic, it will explain how to figure that out.
Was This Post Helpful? 0

#7 r.stiltskin

• D.I.C Lover

Reputation: 2030
• Posts: 5,427
• Joined: 27-December 05

Re: floating point adding

Posted 06 March 2010 - 02:47 PM

I found this explanation IEEE754 which actually gives a clearer (I think) explanation than the one in Wikipedia. You should be able to translate what he says about 16-bit encodings into your 8-bit encoding. Post again if you have any questions about it.
Was This Post Helpful? 0

#8 polska03

• D.I.C Regular

Reputation: 5
• Posts: 302
• Joined: 28-November 09

Re: floating point adding

Posted 06 March 2010 - 05:12 PM

using 3 point notation I i got 3C=00111100-->.01100=3/8 + C8=11001000-->.1000= -1/2
What do I do no to add this and put it into a register????
Was This Post Helpful? 0

#9 r.stiltskin

• D.I.C Lover

Reputation: 2030
• Posts: 5,427
• Joined: 27-December 05

Re: floating point adding

Posted 06 March 2010 - 08:41 PM

polska03, on 06 March 2010 - 07:12 PM, said:

using 3 point notation I i got 3C=00111100-->.01100=3/8 + C8=11001000-->.1000= -1/2is and put it into a register????

No, I don't think that's right. What do you mean by "3 point notation"?
You don't seem to be handling the exponent correctly -- how are you figuring the bias? Also, you haven't considered the implied initial digit. Finally, you shouldn't convert the binary numbers to decimal numbers before doing the arithmetic. That only creates more work for yourself. After you convert the floating-point numbers to their fixed-point binary equivalents, do the arithmetic on the binary numbers, then normalize the result and convert it back to floating-point.

First, review the first few paragraphs here, at least as far as the section headed "Putting it All Together".

I'll give you an example to work on: Using the IEEE754 approach modified to your 8-bit encoding, I would convert the floating-point value 6b to the binary number 1101.1
See if you can figure out how to arrive at that result.
Was This Post Helpful? 0

#10 polska03

• D.I.C Regular

Reputation: 5
• Posts: 302
• Joined: 28-November 09

Re: floating point adding

Posted 07 March 2010 - 10:23 AM

sorry not 3 bit notation, but 3 bit excess method****
would my answer still be wrong if I used it with 3 bit excess method??
Was This Post Helpful? 0

#11 r.stiltskin

• D.I.C Lover

Reputation: 2030
• Posts: 5,427
• Joined: 27-December 05

Re: floating point adding

Posted 07 March 2010 - 11:07 AM

Interesting. I found an encoding method here that seems to be the system you're using. Using it, 3c does convert to .01100 and c8 converts to -.1000 so you must be following that correctly.

So now just add those two binary numbers and use the same system to encode the result.

This post has been edited by r.stiltskin: 07 March 2010 - 11:21 AM

Was This Post Helpful? 0

Page 1 of 1

 .related ul { list-style-type: circle; font-size: 12px; font-weight: bold; } .related li { margin-bottom: 5px; background-position: left 7px !important; margin-left: -35px; } .related h2 { font-size: 18px; font-weight: bold; } .related a { color: blue; }