bitwise (fjnish) / SEQ part 1
1
bitwise (fjnish) / SEQ part 1 1 Changelog Changes made in this - - PowerPoint PPT Presentation
bitwise (fjnish) / SEQ part 1 1 Changelog Changes made in this version not seen in fjrst lecture: 14 September 2017: slide 16-17: the x86 arithmetic shift instruction is sar , not sra 1 last time bitwise strategies: construct/apply mask =
1
1
AND/&— keep only marked OR/| — set marked XOR/^ — fmipped marked
2
3
4
5
6
7
8
9
10
short sentinel = -9999; short *x; x = malloc(sizeof(short)*4); x[3] = sentinel; ...
x[0] x[1] x[2] x[3]
typedef struct range_t { unsigned int length; short *ptr; } range; range x; x.length = 3; x.ptr = malloc(sizeof(short)*3); ...
typedef struct node_t { short payload; list *next; } node; node *x; x = malloc(sizeof(node_t)); ...
11
short sentinel = -9999; short *x; x = malloc(sizeof(short)*4); x[3] = sentinel; ...
x[0] x[1] x[2] x[3]
typedef struct range_t { unsigned int length; short *ptr; } range; range x; x.length = 3; x.ptr = malloc(sizeof(short)*3); ...
typedef struct node_t { short payload; list *next; } node; node *x; x = malloc(sizeof(node_t)); ...
11
12
13
14
14
15
15
16
16
17
18
19
19
20
21
22
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
to reg
l
i c
to PC
23
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
to reg
l
i c
to PC
23
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
to reg
l
i c
to PC
23
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
to reg
l
i c
to PC
23
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
to reg
l
i c
to PC
23
time
24
time
24
time
24
%rax, %rdx, … reg values read reg #s write reg #s data to write
time
25
%rax, %rdx, … reg values read reg #s write reg #s data to write
time
25
%rax, %rdx, … reg values read reg #s write reg #s data to write
time
25
%rax, %rdx, … reg values read reg #s write reg #s data to write
time
25
26
%rXX %rYY (two 4-bit register #s)
27
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
%rXX %rYY
28
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
%rXX %rYY
28
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
%rXX %rYY
28
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
%rXX %rYY
28
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
%rXX %rYY
28
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
%rXX %rYY
28
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
%rXX %rYY
28
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
%rXX %rYY
28
29
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
30
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
30
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
30
31
31
31
32
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
MUX
dest
nop 1 jmp Dest 7 Dest
33
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
MUX
dest
nop 1 jmp Dest 7 Dest
33
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
MUX
dest
nop 1 jmp Dest 7 Dest
33
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
MUX
dest
nop 1 jmp Dest 7 Dest
33
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
MUX
dest
nop 1 jmp Dest 7 Dest
33
34
35
36
37
38
38
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
to reg
l
i c
to PC
39
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
to reg
l
i c
to PC
39
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
to reg
l
i c
to PC
39
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
to reg
l
i c
to PC
39
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
to reg
l
i c
to PC
39
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
to reg
l
i c
to PC
39
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
to reg
l
i c
to PC
39
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
to reg
l
i c
to PC
39
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
to reg
l
i c
to PC
39
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
to reg
l
i c
to PC
39
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
to reg
l
i c
to PC
39
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
to reg
l
i c
to PC
39
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
to reg
l
i c
to PC
39
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
to reg
l
i c
to PC
40
41
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
to reg
l
i c
to PC
42
43