Many microprocessor instruction sets include an instruction that tests a conditi
ID: 3567924 • Letter: M
Question
Many microprocessor instruction sets include an instruction that tests a condition and sets a destination operand if the condition is true. Examples include the SETcc on the x86, the Scc on the Motorola MC68000, and the Scond on the National NS32000.
a. There are a few differences among these instructions:
1. SETCC and Scc operate only on a byte, whereas Scond operates on byte, word, and doubleword operands
2. SETcc and Scond set the operand to integer one if true and to zero if false. Scc sets the byte to all binary ones if true and all zeros if false.
What are the relative advantages and disadvantages of these differences?
b. None of these instructions set any of the condition code flags, and thus an explicit test of the result of the instruction is required to determine its value. Discuss whether condition codes should be set as a result of this instruction.
c. A simple IF statement such as IF a>b THEN can be implemented using a numerical representation method, that is, making the Boolean value manifest, as opposed to a flow of control method, which represents the value of a Boolean expression by a point reached in the program. Acompiler might implement IFa > ssb THEN with the following x86 code:
SUB CX, CX ;set register CX to 0
MOV AX, B ;move contents of the location B to register AX
CMP AX, A ;compare contents of register AX and the location A
JLE TEST ;jump ifA< = B
INC CX ;add 1 to contents of the register CX
TEST JCXZ OUT ;jump if contents of CX equal 0
THEN OUT
Explanation / Answer
http://www.writingcentre.us/ saves your time
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.