Discussion:
Lab 1 problem
(too old to reply)
IV
2005-10-23 02:05:32 UTC
Permalink
My lab runs fine through the first few commands, then I have problems
with a udiv. The line looks like:
udiv %r4, %r1, %r8
register 4 has the value 0x AF.
register 1 has the value 0x20.
I checked some output to make sure both of those values are correct.
For some reason, I am getting a result of 0xFFFFFFFF. The same code
works elsewhere in the code (I even copied and pasted it from other
places a few times to see if I had a typo). Does anyone have any idea
what could be going on?

Thanks,
William
B A Bair
2005-10-23 02:56:14 UTC
Permalink
Did you read guideline #12?

;-)
Post by IV
My lab runs fine through the first few commands, then I have problems
udiv %r4, %r1, %r8
register 4 has the value 0x AF.
register 1 has the value 0x20.
IV
2005-10-23 03:25:15 UTC
Permalink
Post by B A Bair
Did you read guideline #12?
That says for sdiv. I tried adding a smul anyway, and it didn't make
any difference. Should I try a umul?
B A Bair
2005-10-23 12:57:51 UTC
Permalink
Then I'm confused... why are you doing a udiv for the SAM DIV31 operation?
Post by IV
Post by B A Bair
Did you read guideline #12?
That says for sdiv. I tried adding a smul anyway, and it didn't make
any difference. Should I try a umul?
IV
2005-10-24 00:22:59 UTC
Permalink
Post by B A Bair
Then I'm confused... why are you doing a udiv for the SAM DIV31 operation?
It's during the store operation. I am using it on the SAM OPCODE to
get the first three digits so I can subtract them off. It worked for
the first three operations, but The division got funky in this case. I
have run the program multiple times, and I cannot figure it out.
B A Bair
2005-10-24 13:11:10 UTC
Permalink
You don't need to strip off the opcode in this assignment. Wait for lab2.

:-)
Post by IV
Post by B A Bair
Then I'm confused... why are you doing a udiv for the SAM DIV31 operation?
It's during the store operation. I am using it on the SAM OPCODE to
get the first three digits so I can subtract them off. It worked for
the first three operations, but The division got funky in this case. I
have run the program multiple times, and I cannot figure it out.
Wayne D. Heym
2005-10-24 13:14:12 UTC
Permalink
Post by IV
Post by B A Bair
Then I'm confused... why are you doing a udiv for the SAM DIV31 operation?
It's during the store operation. I am using it on the SAM OPCODE to
get the first three digits so I can subtract them off.
Good for you! In Labs 2 and 3 we'll ask you to do such bit
manipulations to decode what's in SAM's instruction register. However,
in Lab 1 you are allowed and encouraged just to hard-code the
(known-in-advance) value of the SAM instruction's address field as an
immediate value in a Sparc instruction, like the "set" (synthetic)
instruction.
--
Wayne
Wayne D. Heym
2005-10-24 13:09:41 UTC
Permalink
Post by IV
Post by B A Bair
Did you read guideline #12?
That says for sdiv. I tried adding a smul anyway, and it didn't make
any difference. Should I try a umul?
Yes.
--
Wayne
Loading...