1A) Describe how to define an M4 macro B) Describe the effect a definition has w
ID: 3663974 • Letter: 1
Question
1A) Describe how to define an M4 macro
B) Describe the effect a definition has when M4 processes the file
C) List step-by-step how the macro you wrote for Programming Assignment 1 works
2. A) What are the groups of SPARC registers?
B) How many are in each group?
C) Which registers have special behavior?
3. What is a pseudo-op and why are they necessary?
4. What is pipelining and why is it useful?
5. A) Why do branch instructions have a branch delay slot?
B) What effect does the delay slot have?
6. Why is it better to implement a while loop as if it were a do-while loop inside an if?
7. A) Why does SPARC define synthetic instructions?
B) Give an example of a synthetic instruction.
8. Why are the immediate operands to SPARC’s data manipulation instructions limited to 13 bits?
9. List 4 GDB commands that you expect to find useful and briefly state what each of them does.
Explanation / Answer
1A) Describe how to define an M4 macro
Builtin: define (name, [expansion]
Defines name to expand to expansion. If expansion is not given, it is taken to be empty.
The expansion of define is void. The macro define is recognized only with parameters.
The following example defines the macro foo to expand to the text ‘Hello World.’.
define(`foo', `Hello world.')
The first argument to define should be quoted; otherwise, if the macro is already defined, you will be defining a different macro.
--------------------------------------------------------------------------------------
2. A) What are the groups of SPARC registers?
1. global registers
2. out
3. local,
4. in
--------------------------------------------------------------------------------------
B) How many are in each group?
1. global registers -8
2. out -8
3. local -8
4.in -8
--------------------------------------------------------------------------------------
4. What is pipelining and why is it useful?
Pipelining:
A technique used in advanced microprocessors where the microprocessorbegins executing a second instruction before the first has been completed. That is, several instructions are in the pipeline simultaneously, each at a different processing stage.
Use:
Pipelining increases the CPU instruction throughput(the number of instructions completed per unit of time).It usually slightly increases the execution time of each instruction due to overhead in the pipeline control.
The increase in instruction throughput means that a program runs faster and has lower total execution time.
--------------------------------------------------------------------------------------
7. A) Why does SPARC define synthetic instructions?
Ans: In order to load a 32-bit constant (such as an address) into a register, SPARC define synthetic instructions. This can't possibly be done in one instruction (since all instructions are 32 bits long, there isn't room for a 32-bit constant and also an opcode and a register number). There are instructions that can set the lower part of a register (add, or, etc), so this one complements those nicely.
--------------------------------------------------------------------------------------
B) Give an example of a synthetic instruction.
To set %L1 to 0x89ABCDEF, do the following:
--------------------------------------------------------------------------------------
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.