Question

In: Computer Science

(a) The 4 common ALU flags occur in most computers. Some computers have additional ALU flags....

(a) The 4 common ALU flags occur in most computers. Some computers have additional ALU flags. For example, the x86 flag set includes P, I, and H flags, and the ARM flag set includes T, F, and I. Select two of these additional flags, and research their purpose. Indicate, if appropriate, the logic used to calculate the flag value for a given ALU operation.

(b) An ALU can be used to compare two values, by subtracting the values and consulting the flags. For example, if the two values were the same, the zero flag will be active after they are subtracted. When subtracting A-B, which flags should be active to indicate A<B and A>B for signed numbers? Justify your reasoning.

BONUS: indicate which flags should be active for unsigned comparisons A<B, A>B, A=B

Solutions

Expert Solution

(a) The special flags in X86:

i) H flag:

  • It is called Half-carrry flags.
  • It is a conditional flag which sets when a carry or borrow occurs in the last 4 least significant bit in the previous arithmetic operation
  • It is helpful in carrying out BCD operation
  • Example:

0011 1001 + 0100 1000 = 1000 0001

The digits which are given in bold are LSB (Least significant bit). Note there is also a bold italic numbers where the carry gets set. So this sets the "Half-carry" flag.

ii) P flag:

  • It is called Parity flag
  • This will be set to 1 if there are even numbers of 1's in the last arithmetic operation result and it will be set to 0 if there are odd numbers of 1's.
  • A slight change in x86 is that, it takes only LSB into account.
  • Example:
  • 1010 0001: LSB has even number of odd bits so parity bit will be 1.

b) signed number comparison. We have to take both Overflow flag and sign flag into consideration.

Suppose, if A>B then OF (overflow flag) will be equal to SF (signed Flag)

Suppose, if A<B then OF<>SF

c) Bonus question:

If the number is unsigned then carry flag and zero flag are enough.

A>B carry flag will be 0

A<B carry flag will be 1

if A=B then zero flag will be set to 1.


Related Solutions

Question 2 (a) The 4 common ALU flags occur in most computers. Some computers have additional...
Question 2 (a) The 4 common ALU flags occur in most computers. Some computers have additional ALU flags. For example, the x86 flag set includes P, I, and H flags, and the ARM flag set includes T, F, and I. Select two of these additional flags, and research their purpose. Indicate, if appropriate, the logic used to calculate the flag value for a given ALU operation. (b) An ALU can be used to compare two values, by subtracting the values...
What are some common red flags in financial statement analysis and what steps should be taken...
What are some common red flags in financial statement analysis and what steps should be taken in the event that we notice a red flag when analyzing financial statements?
Some financial instruments can have both debt and equity features. The most common example is convertible...
Some financial instruments can have both debt and equity features. The most common example is convertible debt— bonds or notes convertible by the investor into common stock. A topic of debate for several years has been whether: 1. Issuers should account for an instrument with both liability and equity characteristics entirely as a liability or entirely as an equity instrument depending on which characteristic governs or 2. Issuers should account for an instrument as consisting of a liability component and...
Some financial instruments can have both debt and equity features. The most common example is convertible...
Some financial instruments can have both debt and equity features. The most common example is convertible debt—bonds or notes convertible by the investor into common stock. A topic of debate for several years has been whether: issuers should account for an instrument with both liability and equity characteristics entirely as a liability or entirely as an equity instrument depending on which characteristic governs; or issuers should account for an instrument as consisting of a liability component and an equity component...
This programming assignment involves learning about some of the common exceptions that occur in Java programs.
This programming assignment involves learning about some of the common exceptions that occur in Java programs. Consider the following exception types: NullPointerException ArrayIndexOutOfBoundsException ClassCastException IllegalArgumentException Research what each exception type means and the conditions under which each occurs (i.e., is thrown). Write programs that demonstrate each type of exception being thrown (one program per exception) and provide a screen capture of the output. You should write your code so that each exception type is forced to occur. Name your programs...
Describe some of the more common criminal offenses that occur in healthcare settings . Explain why...
Describe some of the more common criminal offenses that occur in healthcare settings . Explain why employers should place disclaimers in employee handbooks. Describe the role of the judge and jury in the trial process.
1. What are the main (most common) barriers to change? Explain why these barriers occur. 2....
1. What are the main (most common) barriers to change? Explain why these barriers occur. 2. Give examples of strategies for implementing change. In which conditions would these strategies be effective? When would they not be (so) effective? 3. How could resistance to change be overcome?
1. Four most common layout formats (170, PPT 4-10) – describe the four most common layout...
1. Four most common layout formats (170, PPT 4-10) – describe the four most common layout formats. 2. workcenter (Job shop) Layout (170-174, PPT 11-20) – for a given workcenter layout, be able to assess the material handling cost/distance. 3. Assembly Line Layout (174-180, PPT 21-40) – be able to balance an assembly line: 1) draw a precedence diagram, 2) determine the workstation cycle time, 3) determine the theoretical minimum number of workstations, 4) using the longest task time rule...
what are some of the most common clinical and pathological manifestations of human immunity
what are some of the most common clinical and pathological manifestations of human immunity
Imagine you have some workers and some handheld computers that you can use to take inventory...
Imagine you have some workers and some handheld computers that you can use to take inventory at a warehouse. There are diminishing returns to taking inventory. If one worker uses one computer, he can inventory 150 items per hour. Two workers sharing a computer can together inventory 200 items per hour. Three workers sharing a computer can together inventory 220 items per hour. And four or more workers sharing a computer can together inventory fewer than 235 items per hour....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT