Uploaded by vicvonvyac

examReview

advertisement
Given the following information about the instruction mix of a program, determine the average
cycles per instruction of that program. Think back to the way the pipeline handles these
different types of instructions and the
stalls that might occur. (10 points)
30% of the instructions are loads, and 25% of these are followed by an
instruction that uses the data just loaded
20% of the instructions are conditional branches, and 30% of the
branches are not taken
5% of the instructions are call instructions
5% of the instructions are ret instructions
40% of the instructions are arithmetic instructions
Detail what happens during the 5 stages of the pipeline discussed in class for the following
instruction: (10 points)
Given a nonpipelined processor A that requires 5 cycles to complete an instruction and a
pipelined processor B that still requires 5 cycles to complete an instruction but allows for
overlapping execution. Detail how many cycles Processor A and Processor B require to execute
100 instructions assuming no stalls. (10 points)
In 3-5 sentences, describe the benefit forwarding paths provide in a pipelined processor. (5
points)
In the HCL description of our y86 processor the following descriptions are used to determine
when to stall the processor. (5 points)
bool F_stall = E_icode in { IMRMOVQ, IPOPQ } && (E_dstM == d_srcB ||
(E_dstM == d_srcA && !D_icode in { IRMMOVQ, IPUSHQ })) ||
IRET in { D_icode, E_icode, M_icode };
bool D_stall = E_icode in { IMRMOVQ, IPOPQ } && E_icode in
{ IMRMOVQ, IPOPQ } && (E_dstM == d_srcB || (E_dstM == d_srcA &&
!D_icode in { IRMMOVQ, IPUSHQ }));
bool D_bubble = (E_icode == IJXX && !e_Cnd) || !(E_icode in
{ IMRMOVQ, IPOPQ } && E_dstM in { d_srcA, d_srcB }) && IRET in
{ D_icode, E_icode, M_icode };
bool E_stall = 0;
bool E_bubble = (E_icode == IJXX && !e_Cnd) || E_icode in
{ IMRMOVQ, IPOPQ } && (E_dstM == d_srcB || (E_dstM == d_srcA &&
!D_icode in { IRMMOVQ, IPUSHQ }));
in 3-5 sentences why F_stall has the following snippet as part of its expression:
Detail what happens during the 5 stages of the pipeline discussed in class for the ret instruction:
(10 points)
This problem considers a linked list that has been created in memory. (15 points total)
We know the linked list consists of 4 nodes, starts at address 0x6021c0, and has the
following declaration in the C code.
struct lnode {
char *firstname;
char middleinit;
char*lastname;
struct lnode *next;
};
Looking at location 0x6021c0 (stored in the variable list) in memory we see:
(gdb) x/16x 0x6021c0
0x6021c0: 0x00000000006021f0 0x0000000000602210
0x6021d0: 0x0000000000602230 0x0000000000602130
0x6021e0: 0x0000000000000000 0x0000000000000021
0x6021f0: 0x6e696c6b6e617266 0x0000000000000000
0x602200: 0x0000000000000000 0x0000000000000021
0x602210: 0x000000000000006f 0x0000000000000000
0x602220: 0x0000000000000000 0x0000000000000021
0x602230: 0x0000000a65706f70 0x0000000000000000
a) Label in the memory dump where all of the fields of the structure are in the memory
dump. If there are multiple nodes shown, you should mark where all of the firstname
fields are in the memory dump. (5 points)
b) How many of the 4 nodes are shown in the memory dump above? (5 points)
c) How much space (in bytes) does one node of the structure require? (5 points)
Download