Can someone check if this is correct please

  • Thread starter chelsea9947
  • Start date
In summary, these are common questions asked by scientists seeking validation for their work. It is important to use reliable sources and follow the proper scientific method to ensure accuracy, and some may choose to have their work double-checked by a peer. To find someone to check your work, it's best to reach out to a knowledgeable individual in the field. If errors are found, it's important to carefully consider the feedback and make necessary revisions while acknowledging the contribution of the person who found the errors.
  • #1
chelsea9947
8
0
1. Given that the instruction

cmp.l d0,d1

subtracts d0 from d1 without changing either and then sets the flags accordingly.

What will be the state of the N and Z flags if

Homework Equations


a. d0 < d1 =
b. d0 > d1 =
c. d1 = d1 =

The Attempt at a Solution



a. is negative and N would be set.
b. the result is positive and neither N or Z is set.
c. the result is zero and Z would be set.
 
Physics news on Phys.org
  • #2
You mean: in each of the cases where d0 is smaller, equal or greater to d1, is d1 - d0 positive, negative or zero?
 
  • #3
i think is zero

Decision Making: In high level languages we use instructions of the form

If A< B then P else Q

Now what actually happens deep down in the machine is a subtraction of the form (A – B) and we look at the sign of the result.

If B is greater than A then the result is negative and N would be set.
If A is equal to B then the result is zero and Z would be set.
If A is greater than B the result is positive and neither N or Z is set.

Lots of combinations are possible e.g. “less than”, “less than or equal to”, “equal to each other”, “is something equal to, less than, or greater than zero” and so on.
 
  • #4
chelsea9947 said:
1. Given that the instruction

cmp.l d0,d1

subtracts d0 from d1 without changing either and then sets the flags accordingly.

What will be the state of the N and Z flags if




Homework Equations


a. d0 < d1 =
b. d0 > d1 =
c. d1 = d1 =




The Attempt at a Solution



a. is negative and N would be set.
b. the result is positive and neither N or Z is set.
c. the result is zero and Z would be set.


I don't believe you're thinking about this the right way. As you described it, the cmp d0, d1 instruction evaluates d1 - d0 and sets the N and Z flag, as appropriate. Obviously you aren't working with an x86-type processor, since it would evaluate d0 - d1.
a. If d0 < d1, then d1 - d0 > 0, so no flags get set.
b. If d0 > d1, then d1 - d0 < 0, so the N flag gets set.
c. I'm pretty sure you mean d0 = d1, since the value in d1 will always equal itself. When d0 = d1, the Z flag gets set.
 
  • #5
please can you check this if this is correct

cmpi.w #10,d5

What will the states of the N and Z flags would be if

a. d5 = 12 = No flags gets set.
b. d5 = -10 = Z flag gets set.
c. d5 = 5 = N would be set
 
  • #6
chelsea9947 said:
please can you check this if this is correct

cmpi.w #10,d5

What will the states of the N and Z flags would be if

a. d5 = 12 = No flags gets set.
b. d5 = -10 = Z flag gets set.
c. d5 = 5 = N would be set
a. correct
b. The N flag gets set, not the Z flag. The subtraction that is performed is -10 - 10, which is -20.
c. correct
 

FAQ: Can someone check if this is correct please

Can someone check if this is correct please?

This is a very common question asked in scientific communities when someone wants validation on their work. It usually means the person wants someone else to review their work and provide feedback on its accuracy and validity.

How do I know if my work is correct?

This question is often asked by scientists who are unsure about the accuracy of their work. It is important for scientists to use reliable sources and follow the proper scientific method to ensure the accuracy of their work.

Is it necessary to have someone else check my work?

This is a common question, and the answer depends on the individual and their level of expertise. Some scientists may feel confident enough in their work to not need a second opinion, while others may prefer to have their work double-checked by a peer.

How do I find someone to check my work?

If you are seeking validation for your work, it's important to reach out to someone who is knowledgeable in the subject matter and has a good understanding of the scientific method. This could be a colleague, mentor, or a professional in the field.

What should I do if someone finds errors in my work?

If someone finds errors in your work, it's important to carefully consider their feedback and make necessary revisions. It's also important to thank the person for their input and acknowledge their contribution to the accuracy of your work.

Back
Top