recitation 2 pm/0 ~ p-machine with registers pl/0 code execution
DESCRIPTION
Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution. COP 3402 (Summer 2014). Announcements. TA's office hours cancelled (4-5pm) Keep checking course's webpage: first project coming soon. P-machine Overview. 1. 0. 2. 0. 0. 0. code. stack. 06 0 0 6 11 0 0 6 - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/1.jpg)
Recitation 2PM/0 ~ P-Machine with registers
PL/0 Code Execution
COP 3402(Summer 2014)
![Page 2: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/2.jpg)
Announcements
• TA's office hours cancelled (4-5pm)• Keep checking course's webpage: first
project coming soon.
![Page 3: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/3.jpg)
P-machine Overview
0 1 0PC BP SP
IR
CPU
0 6 0 0 6 1 1 0 0 62 4 0 0 43 3 0 0 44 1 1 0 05 22 0 0 16 8 0 0 177 3 0 0 48 14 0 0 09 4 0 0 510 3 0 0 411 1 1 0 112 13 0 0 113 4 0 0 414 3 0 0 515 9 0 0 116 7 0 0 317 3 0 0 418 9 0 0 119 3 0 0 520 9 0 0 121 2 0 0 0
code
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack00
01
02
…
![Page 4: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/4.jpg)
01 – LIT R, 0, M RF[R] M; 02 – RTN 0, 0, 0 sp bp - 1;
bp stack[sp + 3];pc stack[sp + 4];
03 – LOD R, L, M RF[R] stack[ base(L, bp) + M]; 04 – STO R, L, M stack[ base(L, bp) + M] RF[R]; 05 – CAL 0, L, M stack[sp + 1] 0; /* space to return value
stack[sp + 2] base(L, bp); /* static link (SL) stack[sp + 3] bp; /* dynamic link (DL)
stack[sp + 4] pc; /* return address (RA) bp sp + 1;
pc M; 06 – INC 0, 0, M sp sp + M; 07 – JMP 0, 0, M pc M; 08 – JPC R, 0, M if RF[R] == 0 then { pc M; } 09 – SIO R, 0, 1 print(RF[R]); 10 – SIO R, 0, 2 read(RF[R]);
P-machine ISA
![Page 5: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/5.jpg)
11 – NEG i, j, k (R[i] -R[j])
12 - ADD i, j, k (R[i] R[j] + R[k])
13 - SUB i, j, k (R[i] R[j] - R[k])
14 - MUL i, j, k (R[i] R[j] * R[k])
15 - DIV i, j, k (R[i] R[j] / R[k])
16 - ODD i, j, k (R[i] R[i] mod 2)
17 - MOD i, j, k (R[i] R[j] mod R[k])
18 - EQL i, j, k (R[i] R[j] == R[k])
19 - NEQ i, j, k (R[i] R[j] != R[k])
20 - LSS i, j, k (R[i] R[j] < R[k])
21 - LEQ i, j, k (R[i] R[j] <= R[k])
22 - GTR i, j, k (R[i] R[j] > R[k])
23 - GEQ i, j, k (R[i] R[j] >= R[k])
P-machine ISA
![Page 6: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/6.jpg)
procedure A; var y; procedure B; var x; procedure C; begin x:=y; end; begin x:=1; y:= 3; call C; end;begin y:= 2; call B;end;call A.
Nested Code 0 jmp 0 20 1 jmp 0 15 2 jmp 0 8 3 jmp 0 4 4 inc 0 3 5 lod 2 3 6 sto 1 3 7 opr 0 0 8 inc 0 4 9 lit 0 110 sto 0 311 lit 0 312 sto 1 313 cal 0 414 opr 0 015 inc 0 416 lit 0 217 sto 0 3 18 cal 0 819 opr 0 020 inc 0 321 cal 0 1522 opr 0 0
code
RTN 0,0 sp bp -1; pc stack[sp + 3]; bp stack[sp + 2];
![Page 7: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/7.jpg)
P-machine Overview
0 1 0PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stackSPPC
Initial State
00
Initial State
![Page 8: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/8.jpg)
P-machine Overview
inc 0 0 6
1 1 0PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stackSPPC
Initial State
00
Fetch…
![Page 9: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/9.jpg)
P-machine Overview
inc 0 0 6
1 1 6PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC 01
02
03
04
05
06
00
…Execute!
From now on, we’ll only show the result after the instruction have been executed.
![Page 10: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/10.jpg)
P-machine Overview
lit 0 0 3
2 1 6PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
3
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC01
02
03
04
05
06
00
![Page 11: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/11.jpg)
Store04 – STO R, L, M stack[ base(L, bp) + M] RF[R];
int base(l, base){ // l stand for L in the instruction formatint b1; //find base L levels down b1 = base; while (l > 0) {
b1 = stack[b1 + 1]; l--;
}return b1;
}
![Page 12: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/12.jpg)
P-machine Overview
lit 0 0 3
2 1 6PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
3
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC01
02
03
04
05
06
00
![Page 13: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/13.jpg)
P-machine Overview
sto 0 0 4
3 1 6PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
3
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
35
06
00
![Page 14: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/14.jpg)
P-machine Overview
lit 0 0 1
4 1 6PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
35
06
00
![Page 15: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/15.jpg)
P-machine Overview
sto 0 0 5
5 1 6PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
35
16
00
![Page 16: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/16.jpg)
P-machine Overview
sto 0 0 5
5 1 6PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
Wait! Let’s break the next instruction into fetch and execute…
01
02
03
04
35
16
00
![Page 17: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/17.jpg)
P-machine Overview
cal 0 0 7
6 1 6PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
FETCH
01
02
03
04
35
16
00
![Page 18: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/18.jpg)
P-machine Overview
cal 0 0 7
6 1 6PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
Execute
01
02
03
04
35
16
00
CAL 0, L, M stack[sp + 1] 0;stack[sp + 2] base(L, bp);stack[sp + 3] bp;stack[sp + 4] pc;bp sp + 1;pc M;
![Page 19: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/19.jpg)
P-machine Overview
cal 0 0 7
6 1 6PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
Execute
01
02
03
04
35
16
00
CAL 0, L, M stack[sp + 1] 0;stack[sp + 2] base(L, bp);stack[sp + 3] bp;stack[sp + 4] pc;bp sp + 1;pc M;
07
![Page 20: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/20.jpg)
P-machine Overview
cal 0 0 7
6 1 6PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
Execute
01
02
03
04
35
16
00
CAL 0, L, M stack[sp + 1] 0;stack[sp + 2] base(L, bp);stack[sp + 3] bp;stack[sp + 4] pc;bp sp + 1;pc M;
07
18
![Page 21: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/21.jpg)
P-machine Overview
cal 0 0 7
6 1 6PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
Execute
01
02
03
04
35
16
00
CAL 0, L, M stack[sp + 1] 0;stack[sp + 2] base(L, bp);stack[sp + 3] bp;stack[sp + 4] pc;bp sp + 1;pc M;
07
18
19
![Page 22: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/22.jpg)
P-machine Overview
cal 0 0 7
6 1 6PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
Execute
01
02
03
04
35
16
00
CAL 0, L, M stack[sp + 1] 0;stack[sp + 2] base(L, bp);stack[sp + 3] bp;stack[sp + 4] pc;bp sp + 1;pc M;
07
18
19
610
![Page 23: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/23.jpg)
P-machine Overview
cal 0 0 7
6 7 6PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
Execute
01
02
03
04
35
16
00
CAL 0, L, M stack[sp + 1] 0;stack[sp + 2] base(L, bp);stack[sp + 3] bp;stack[sp + 4] pc;bp sp + 1;pc M;
07
18
19
610
![Page 24: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/24.jpg)
P-machine Overview
cal 0 0 7
7 7 6PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SPPC
Execute
01
02
03
04
35
16
00
CAL 0, L, M stack[sp + 1] 0;stack[sp + 2] base(L, bp);stack[sp + 3] bp;stack[sp + 4] pc;bp sp + 1;pc M;
07
18
19
610
![Page 25: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/25.jpg)
P-machine Overview
inc 0 0 4
8 7 10PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
35
16
00
07
18
19
610
![Page 26: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/26.jpg)
P-machine Overview
lod 0 1 4
9 7 10PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
3
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
35
16
00
07
18
19
610
![Page 27: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/27.jpg)
P-machine Overview
lod 1 1 5
10 7 10PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
3
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
35
16
00
07
18
19
610
![Page 28: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/28.jpg)
P-machine Overview
mul 1 0 1
11 7 10PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
3
3
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
35
16
00
07
18
19
610
![Page 29: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/29.jpg)
P-machine Overview
sto 1 1 5
12 7 10PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
3
3
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
35
36
00
07
18
19
610
![Page 30: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/30.jpg)
P-machine Overview
lit 1 0 1
13 7 10PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
3
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SPPC
01
02
03
04
35
36
00
07
18
19
610
![Page 31: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/31.jpg)
P-machine Overview
sub 0 0 1
14 7 10PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
2
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SPPC
01
02
03
04
35
36
00
07
18
19
610
![Page 32: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/32.jpg)
P-machine Overview
sto 0 1 4
15 7 10PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
2
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SPPC
01
02
03
04
25
36
00
07
18
19
610
![Page 33: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/33.jpg)
P-machine Overview
neq 0 0 1
16 7 10PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
1
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
25
36
00
07
18
19
610
![Page 34: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/34.jpg)
P-machine Overview
jpc 0 0 18
17 7 10PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
1
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
25
36
00
07
18
19
610
![Page 35: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/35.jpg)
P-machine Overview
cal 0 1 7
7 11 10PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
1
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
25
36
00
07
18
19
610
011
112
713
1814
![Page 36: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/36.jpg)
P-machine Overview
inc 0 0 4
8 11 14PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
1
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
25
36
00
07
18
19
610
011
112
713
1814
![Page 37: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/37.jpg)
P-machine Overview
lod 0 1 4
9 11 14PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
2
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
25
36
00
07
18
19
610
011
112
713
1814
![Page 38: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/38.jpg)
P-machine Overview
lod 1 1 5
10 11 14PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
2
3
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
25
36
00
07
18
19
610
011
112
713
1814
![Page 39: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/39.jpg)
P-machine Overview
mul 1 0 1
11 11 14PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
2
6
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
25
36
00
07
18
19
610
011
112
713
1814
![Page 40: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/40.jpg)
P-machine Overview
sto 1 1 5
12 11 14PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
2
6
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
25
66
00
07
18
19
610
011
112
713
1814
![Page 41: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/41.jpg)
P-machine Overview
lit 1 0 1
13 11 14PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
2
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
25
66
00
07
18
19
610
011
112
713
1814
![Page 42: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/42.jpg)
P-machine Overview
sub 0 0 1
14 11 14PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
1
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
25
66
00
07
18
19
610
011
112
713
1814
![Page 43: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/43.jpg)
P-machine Overview
sto 0 1 4
15 11 14PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
1
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
15
66
00
07
18
19
610
011
112
713
1814
![Page 44: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/44.jpg)
P-machine Overview
neq 0 0 1
16 11 14PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
0
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
15
66
00
07
18
19
610
011
112
713
1814
![Page 45: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/45.jpg)
P-machine Overview
jpc 0 0 18
18 11 14PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
0
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
15
66
00
07
18
19
610
011
112
713
1814
![Page 46: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/46.jpg)
Return
02 – RTN 0, 0, 0 sp bp - 1;bp
stack[sp + 3];pc
stack[sp + 4];
![Page 47: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/47.jpg)
P-machine Overview
rtn 0 0 0
19 11 14PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
0
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SPPC
01
02
03
04
15
66
00
07
18
19
610
011
112
713
1814
02 – RTN 0, 0, 0sp bp - 1;bp stack[sp + 3];pc stack[sp + 4];
Fetch
![Page 48: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/48.jpg)
P-machine Overview
rtn 0 0 0
19 11 10PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
0
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
15
66
00
07
18
19
610
011
112
713
1814
02 – RTN 0, 0, 0sp bp - 1;bp stack[sp + 3];pc stack[sp + 4];
Execute
![Page 49: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/49.jpg)
P-machine Overview
rtn 0 0 0
19 7 10PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
0
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
15
66
00
07
18
19
610
011
112
713
1814
02 – RTN 0, 0, 0sp bp - 1;bp stack[sp + 3];pc stack[sp + 4];
Execute
![Page 50: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/50.jpg)
P-machine Overview
rtn 0 0 0
18 7 10PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
0
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
15
66
00
07
18
19
610
011
112
713
1814
02 – RTN 0, 0, 0sp bp - 1;bp stack[sp + 3];pc stack[sp + 4];
Execute
![Page 51: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/51.jpg)
P-machine Overview
rtn 0 0 0
19 7 10PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
0
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
15
66
00
07
18
19
610
011
112
713
1814
02 – RTN 0, 0, 0sp bp - 1;bp stack[sp + 3];pc stack[sp + 4];
Fetch
![Page 52: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/52.jpg)
P-machine Overview
rtn 0 0 0
19 7 6PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
0
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
15
66
00
07
18
19
610
011
112
713
1814
02 – RTN 0, 0, 0sp bp - 1;bp stack[sp + 3];pc stack[sp + 4];
Execute
![Page 53: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/53.jpg)
P-machine Overview
rtn 0 0 0
19 1 6PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
0
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
15
66
00
07
18
19
610
011
112
713
1814
02 – RTN 0, 0, 0sp bp - 1;bp stack[sp + 3];pc stack[sp + 4];
Execute
![Page 54: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/54.jpg)
P-machine Overview
rtn 0 0 0
6 1 6PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
0
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
15
66
00
07
18
19
610
011
112
713
1814
02 – RTN 0, 0, 0sp bp - 1;bp stack[sp + 3];pc stack[sp + 4];
Execute
![Page 55: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/55.jpg)
P-machine Overview
jmp 0 0 19
19 1 6PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
0
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
15
66
00
07
18
19
610
011
112
713
1814
![Page 56: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/56.jpg)
P-machine Overview
lod 0 0 5
20 1 6PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
6
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
15
66
00
07
18
19
610
011
112
713
1814
![Page 57: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/57.jpg)
P-machine Overview
sio 0 0 1
21 1 6PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
6
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
15
66
00
07
18
19
610
011
112
713
1814
print(6);
![Page 58: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/58.jpg)
P-machine Overview
rtn 0 0 0
22 1 6PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
6
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stack
SP
PC
01
02
03
04
15
66
00
07
18
19
610
011
112
713
1814
02 – RTN 0, 0, 0sp bp - 1;bp stack[sp + 3];pc stack[sp + 4];
Fetch
![Page 59: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/59.jpg)
P-machine Overview
rtn 0 0 0
22 1 0PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
6
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stackSP
PC
01
02
03
04
15
66
00
07
18
19
610
011
112
713
1814
02 – RTN 0, 0, 0sp bp - 1;bp stack[sp + 3];pc stack[sp + 4];
Fetch
![Page 60: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/60.jpg)
P-machine Overview
rtn 0 0 0
22 0 0PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
6
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stackSP
PC
01
02
03
04
15
66
00
07
18
19
610
011
112
713
1814
02 – RTN 0, 0, 0sp bp - 1;bp stack[sp + 3];pc stack[sp + 4];
Fetch
![Page 61: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/61.jpg)
P-machine Overview
rtn 0 0 0
0 0 0PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
6
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stackSPPC
01
02
03
04
15
66
00
07
18
19
610
011
112
713
1814
02 – RTN 0, 0, 0sp bp - 1;bp stack[sp + 3];pc stack[sp + 4];
Fetch
![Page 62: Recitation 2 PM/0 ~ P-Machine with registers PL/0 Code Execution](https://reader036.vdocument.in/reader036/viewer/2022062321/56814037550346895daba1d2/html5/thumbnails/62.jpg)
P-machine Overview
rtn 0 0 0
0 0 0PC BP SP
IR
CPU
0 inc 0 0 61 lit 0 0 32 sto 0 0 43 lit 0 0 14 sto 0 0 55 cal 0 0 76 jmp 0 0 197 inc 0 0 48 lod 0 1 49 lod 1 1 510 mul 1 0 111 sto 1 1 512 lit 1 0 113 sub 0 0 114 sto 0 1 415 neq 0 0 116 jpc 0 0 1817 cal 0 1 718 rtn 0 0 019 lod 0 0 520 sio 0 0 121 rtn 0 0 0
code
6
1
RF
R1
R2
R3
R4
R5
R6
R7
R0 R8
R9
R10
R11
R12
R13
R14
R15
stackSPPC
01
02
03
04
15
66
00
07
18
19
610
011
112
713
1814
02 – RTN 0, 0, 0sp bp - 1;bp stack[sp + 3];pc stack[sp + 4];
Fetch
End State. Halt P-Machine