CS350 Intro Computer Systems Homework
Homework 8 on Essential Steps of Instruction Execution
- For the 11 instructions shown below, fill the table with the numbers necessary to execute each instruction. See the figure attached for numbers associated with the simple computer. See the sample instruction addq %rax,%rbx. List numbers in the order in which they flow. You may ignore numbers 1,2,6,7,8,9,10,13,44,45 for this homework. Assume PC is filled with a correct address for fetching.
Instruction | Fetch | Decode | Execute | Memory | Write Back |
addq %rax,%rbx | 11,12,14,15,16,17,19 | 5,21,22,26,27 | 31,32,33,34,35,36,37,41 | --- | 38,22 |
rrmovq %rax,%rbx | | | | | |
irmovq 5,%rbx | | | | | |
mrmovq 5(%rdx),%rax | | | | | |
rmmovq %rax,5(%rdx) | | | | | |
push %rax | | | | | |
pop %rax | | | | | |
jne loop | | | | | |
call func | | | | | |
ret | | | | | |
cmovne %rax,%rbx | | | | | |
- Assuming the following values, fill the table below with values. If no applicable, leave it blank. See Figures 4.2 to 4.4 for icode, ifun, and register assignment.
- Memory addresses each are 8 bytes (64 bits).
- All instructions are at memory address 0x0000.
- memory 0x1000: 1 (64 bits)
- memory 0x2000: 2 (64 bits)
- memory 0x3000: 3 (64 bits)
- memory 0x4000: 4 (64 bits)
- rax=1, rbx=2, rdx=0x1000, rsp=0x2000
- loop is at 0x3000
- func is at 0x4000
- previous instructions resulted in greater than zero.
- If not specified, assume 0 at that memory location.
Instruction | icode | ifun | rA | rB | valC | valA | valB | dstE | dstM | srcA | valE | valM | Cnd |
addq %rax,%rbx | 6 | 0 | 0 | 3 | | | | | | | | | |
rrmovq %rax,%rbx | | | | | | | | | | | | | |
irmovq 5,%rbx | | | | | | | | | | | | | |
mrmovq 5(%rbx),%rax | | | | | | | | | | | | | |
rmmovq %rax,5(%rdx) | | | | | | | | | | | | | |
push %rax | | | | | | | | | | | | | |
pop %rax | | | | | | | | | | | | | |
jmp loop | | | | | | | | | | | | | |
call func | | | | | | | | | | | | | |
ret | | | | | | | | | | | | | |
cmove %rax,%rbx | | | | | | | | | | | | | |