SLIDE 3 12a.9
Clock Signal
- Alternating high/low voltage
pulse train
- Controls the ordering and timing
- f operations performed in the
processor
- 1 cycle is usually measured from
rising edge to rising edge
- Clock frequency = # of cycles per
second (e.g. 2.8 GHz = 2.8 * 109 cycles per second)
Processor
Clock Signal
0 (0V) 1 (5V) 1 cycle 2.8 GHz = 2.8*109 cycles per second = 0.357 ns/cycle
12a.10
FROM X86 TO RISC
Basic HW organization for a simplified instruction set
12a.11
From CISC to RISC
- Complex Instruction Set Computers often
have instructions that ______ widely in how much _________ they perform and how much _________ they take to execute
– Benefit is _________ instructions are needed to accomplish a task
- Reduced Instruction Set Computers favor
instructions that take roughly the _______ time to execute and follow a common _____________ of steps
– It often requires _______ instructions to describe the overall task (larger code size)
- See example to the right
- RISC makes the ___________ design easier
so let's tweak our x86 instructions to be more RISC-like
// CISC instruction movq 0x40(%rdi, %rsi, 4), %rax // RISC Equiv. w/ 1 mem. or ALU op. // per instruction mov %rsi, %rbx # use %rbx as a temp. shl 2, %rbx # %rsi * 4 add %rdi, %rbx # %rdi + (%rsi*4) add $0x40, %rbx # 0x40 + %rdi + (%rsi*4) mov (%rbx), %rax # %rax = *%rbx CISC vs. RISC Equivalents 12a.12
A RISC Subset of x86
- Split mov instructions that access memory
into separate instructions:
– ld = _____________ from memory – st = _____________ to memory
- Limit ld & st instructions to use at most
____________________________
– No ld 0x04(%rdi, %rsi, 4), %rax
– At most ld ____________, %rax or
st %rax, _____________
- Limit arithmetic & logic instructions to only
- perate on registers
– No add (%rsp), %rax since this implicitly accesses (dereferences) memory – Only add ______________
// CISC instruction add %rax, (%rsp) // Equiv. RISC sequence (w/ ld and st) ld 0(%rsp), %rbx add %rax, %rbx st %rbx, 0(%rsp) // 3 x86 memory read instructions mov (%rdi), %rax // 1 mov 0x40(%rdi), %rax // 2 mov 0x40(%rdi,%rsi), %rax // 3 // Equiv. load sequences ld 0x0(%rdi), %rax // 1 ld 0x40(%rdi), %rax // 2 mov %rsi, %rbx // 3a add %rdi, %rbx // 3b ld 0x40(%rbx), %rax // 3c // 3 x86 memory write instructions mov %rax, (%rdi) // 1 mov %rax, 0x40(%rdi) // 2 mov %rax, 0x40(%rdi,%rsi) // 3 // Equiv. store sequences st %rax, 0x0(%rdi) // 1 st %rax, 0x40(%rdi) // 2 mov %rsi, %rbx // 3a add %rdi, %rbx // 3b st %rax, 0x40(%rbx) // 3c