660 likes | 938 Views
30 h. de théorie, lundi 16-18 h. Transparants (PDF) + Textes infoweb.vub.ac.be education/ulbarch Jacques Tiberghien tiberghien@info.vub.ac.be tel : 0 2 629 29 05 (?...) gsm : 0 4 75 81 93 27. Architecture des ordinateurs. Chapitre 0 Une première aproximation
E N D
30 h. de théorie, lundi 16-18 h. Transparants (PDF) + Textes infoweb.vub.ac.be education/ulbarch Jacques Tiberghien tiberghien@info.vub.ac.be tel : 02 629 29 05 (?...) gsm : 0475 81 93 27 Architecture des ordinateurs
Chapitre 0 Une première aproximation de l’ordinateur de Von Neumann
Computer System Source Code + User’s Data User’s results HLL interpretation
The “Von Neuman” Computer Data Memory Arithmetic Unit Output Interface Control Input Interface Unit Program Memory Program Interface
Data Memory Arithmetic Unit Output Interface Control Input Interface Unit Program Memory Program Interface The “Von Neuman” Computer
Memories 00000 00001 00010 00011 00100 00101 00110 00111 01000 01001 01010 01011 01100 01101 01110 01111 10000 10001 10010 00011 10100 10101 10110 10111 11000 11001 11010 11011 11100 11101 11110 11111
The “Von Neuman” Computer Data Memory Arithmetic Unit Output Interface Control Input Interface Unit Program Memory Program Interface
OPC OP1 OP2 RES NEXT Instructions Format Information handling instructions Control instructions OPC OP1 OP2 NEXT1 NEXT2
1 2 3 4 5 6 Control 7 8 9 Unit * 0 # Electronic Lock Data Memory Arithmetic Unit Program Memory Program Interface
1 2 3 4 5 6 7 8 9 * 0 # MODULE Lock; CONST Key = 321; VAR ND : [1..3]; SC : [0..999]; KFL[IO1] : BOOLEAN; KDA[IO2] : [0..9]; DDA[IO3] : BOOLEAN; BEGIN LOOP SC := 0; FOR ND := 1 TO 3 DO REPEAT UNTIL KFL; SC := SC * 10 + KDA; KFL := FALSE; END; (* FOR LOOP *) IF SC = Key THEN DDA := TRUE END; (* IF *) END; (* LOOP *) END Lock KFL = DDA = KDA =
1 2 3 4 5 6 7 8 9 * 0 # #define Key = 321; int main (void){ int sc = 0; int nd; int * kfl=(int*)1; int * kda=(int*)2; int * dda=(int*)3; *kfl = 0; do{ for nd=1; nd<=3; nd++ { while *kfl==0; sc = sc * 10 + *kda; *kfl = 0; }; if (sc == Key) { dda = 1 } }while(true) } KFL = DDA = KDA =
Assign addresses to variables Note the IO hardware addresses Make program in machine language performing the task specified by the HLL program Load program in the program memory Fetch first instruction of program Executing an HLL program
Arithmetic Unit 1 2 3 Control Unit 4 5 6 7 8 9 p1 0 D1 P2 10 * 0 # p2 0 D2 P3 10 p3 IO1 0 P3 P4 40 p4 D2 10 D2 P5 22 p5 20 D2 IO2 D2 P6 p6 0 IO1 P7 10 p7 D1 1 D1 P8 20 p8 D1 3 P3 P9 41 p9 D2 321 P1 P10 41 p10 1 IO3 P1 10 Data Memory D1: ND D2: SC IO1:KFL IO3:DDA IO2:KDA Program Memory
Variables keep their symbolic name. IO interfaces keep their symbolic name. Operation codes receive a name that evokes the performed action. each machine instruction corresponds to one assembly language instruction An assembly language program can have pseudo instructions which do not correspond to machine instructions Machine vs. Assembly language
Arithmetic Unit 1 2 3 Control Unit 4 5 6 7 8 9 p1 #0 ND P2 STO * 0 # p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE? p10 #1 DDA P1 STO Data Memory ND = SC = KFL = DDA = KDA = Program Memory
1 2 3 #0 ND P2 STO 4 5 6 7 8 9 p1 #0 ND P2 STO * 0 # p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE? p10 #1 DDA P1 STO ND = 0 SC = DDA = KFL = 0 KDA = Program Memory
ND = 0 SC = 0 1 2 3 #0 SC P3 STO 4 5 6 7 8 9 p1 #0 ND P2 STO * 0 # p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE? p10 #1 DDA P1 STO DDA = KFL = 0 KDA = Program Memory
ND = 0 SC = 0 1 2 3 KFL #0 P3 P4 EQ? 4 5 6 7 8 9 p1 #0 ND P2 STO * 0 # p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE? p10 #1 DDA P1 STO (KFL = 0) = TRUE DDA = KFL = 0 KDA = Program Memory
ND = 0 SC = 0 1 2 3 KFL #0 P3 P4 EQ? 4 5 6 7 8 9 p1 #0 ND P2 STO * 0 # p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE? p10 #1 DDA P1 STO (KFL = 0) = TRUE DDA = KFL = 0 KDA = Program Memory
ND = 0 SC = 0 1 2 KFL #0 P3 P4 EQ? 4 5 7 8 9 p1 #0 ND P2 STO * 0 # p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE? p10 #1 DDA P1 STO (KFL = 0) = FALSE DDA = KFL = 1 3 KDA = 3 6 Program Memory
ND = 0 SC = 0 MUL SC #10 SC P5 p1 #0 ND P2 STO p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE? p10 #1 DDA P1 STO (0 * 10) = 0 DDA = KFL = 1 1 2 3 KDA = 3 4 5 6 Program Memory 7 8 9 * 0 #
ND = 0 SC = 3 1 2 3 ADD SC KDA SC P 6 4 5 6 7 8 9 p1 #0 ND P2 STO * 0 # p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE? p10 #1 DDA P1 STO (0 + 3) = 3 DDA = KFL = 1 KDA = 3 Program Memory
ND = 1 SC = 3 1 2 3 4 5 6 7 8 9 p1 #0 ND P2 STO * 0 # p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE? p10 #1 DDA P1 STO DDA = KFL = 0 #0 KFL P7 STO KDA = Program Memory
ND = 1 SC = 3 1 2 3 ND #1 ND P8 ADD 4 5 6 7 8 9 p1 #0 ND P2 STO * 0 # p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE? p10 #1 DDA P1 STO (0 + 1) = 1 DDA = KFL = 0 KDA = Program Memory
ND = 1 SC = 3 1 2 3 ND #3 P3 P9 NE? 4 5 6 7 8 9 p1 #0 ND P2 STO * 0 # p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE? p10 #1 DDA P1 STO (1 # 3) = TRUE DDA = KFL = 0 KDA = Program Memory
ND = 1 SC = 3 1 2 3 KFL #0 P3 P4 EQ? 4 5 6 7 8 9 p1 #0 ND P2 STO * 0 # p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE? p10 #1 DDA P1 STO (0 = 0) = TRUE DDA = KFL = 0 KDA = Program Memory
ND = 1 SC = 3 KFL #0 P3 P4 EQ? p1 #0 ND P2 STO p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE? p10 #1 DDA P1 STO (1 = 0) = FALSE DDA = KFL = 1 1 2 3 KDA = 2 4 5 6 Program Memory 7 8 9 * 0 #
ND = 1 SC = 30 MUL SC #10 SC P5 p1 #0 ND P2 STO p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE? p10 #1 DDA P1 STO (3 * 10) = 30 DDA = KFL = 1 1 2 3 KDA = 2 4 5 6 Program Memory 7 8 9 * 0 #
ND = 1 SC = 32 1 2 3 ADD SC KDA SC P6 4 5 6 7 8 9 p1 #0 ND P2 STO * 0 # p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE? p10 #1 DDA P1 STO (30 + 2) = 32 DDA = KFL = 1 KDA = 2 Program Memory
ND = 1 SC = 3 1 2 3 4 5 6 7 8 9 p1 #0 ND P2 STO * 0 # p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE? p10 #1 DDA P1 STO DDA = KFL = 0 #0 KFL P7 STO KDA = Program Memory
ND = 2 SC = 32 1 2 3 ND #1 ND P8 ADD 4 5 6 7 8 9 p1 #0 ND P2 STO * 0 # p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE? p10 #1 DDA P1 STO (1 + 1) = 2 DDA = KFL = 0 KDA = Program Memory
ND = 2 SC = 32 1 2 3 ND #3 P3 P8 NE? 4 5 6 7 8 9 p1 #0 ND P2 STO * 0 # p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE? p10 #1 DDA P1 STO (2 # 3) = TRUE DDA = KFL = 0 KDA = Program Memory
ND = 2 SC = 32 1 2 3 KFL #0 P3 P4 EQ? 4 5 6 7 8 9 * 0 # p10 #1 DDA P1 STO (0 = 0) = TRUE DDA = KFL = 0 KDA = Program Memory p1 #0 ND P2 STO p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE?
ND = 2 SC = 32 KFL #0 P3 P4 EQ? p10 #1 DDA P1 STO (1 = 0) = FALSE DDA = KFL = 1 1 2 3 KDA = 1 4 5 6 Program Memory 7 8 9 p1 #0 ND P2 STO * 0 # p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE?
ND = 2 SC = 320 MUL SC #10 SC P5 p10 #1 DDA P1 STO (32 * 10) = 320 DDA = KFL = 1 1 2 3 KDA = 1 4 5 6 Program Memory 7 8 9 p1 #0 ND P2 STO * 0 # p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE?
ND = 2 SC = 321 1 2 3 ADD SC KDA SC P6 4 5 6 7 8 9 * 0 # p10 #1 DDA P1 STO (320 + 1) = 321 DDA = KFL = 1 KDA = 1 Program Memory p1 #0 ND P2 STO p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE?
ND = 1 SC = 3 1 2 3 4 5 6 7 8 9 p1 #0 ND P2 STO * 0 # p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE? p10 #1 DDA P1 STO DDA = KFL = 0 #0 KFL P7 STO KDA = Program Memory
ND = 3 SC = 321 1 2 3 ND #1 ND P8 ADD 4 5 6 7 8 9 * 0 # p10 #1 DDA P1 STO (2 + 1) = 3 DDA = KFL = 0 KDA = Program Memory p1 #0 ND P2 STO p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE?
ND = 3 SC = 321 1 2 3 ND #3 P3 P9 NE? 4 5 6 7 8 9 * 0 # p10 #1 DDA P1 STO (3 # 3) = FALSE DDA = KFL = 0 KDA = Program Memory p1 #0 ND P2 STO p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE?
ND = 3 SC = 321 1 2 3 SC #321 NE? P1 P10 4 5 6 7 8 9 * 0 # p10 #1 DDA P1 STO (321 # 321) = FALSE DDA = KFL = 0 KDA = Program Memory p1 #0 ND P2 STO p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE?
ND = 3 SC = 321 DDA = 1 1 2 3 #1 DDA P1 STO 4 5 6 7 8 9 * 0 # KFL = 0 KDA = Program Memory p1 #0 ND P2 STO p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE? p10 #1 DDA P1 STO
1 2 3 #0 ND P2 STO 4 5 6 7 8 9 * 0 # p10 #1 DDA P1 STO ND = 0 SC = DDA = KFL = 0 KDA = Program Memory p1 #0 ND P2 STO p2 #0 SC P3 STO p3 KFL #0 P3 P4 EQ? p4 SC #10 SC P5 MUL p5 ADD SC KDA SC P6 p6 #0 KFL P7 STO p7 ND #1 ND P8 ADD p8 ND #3 P3 P9 NE? p9 SC #321 P1 P10 NE?
OPC OP1 OP2 RES OPC OP1 OP2 NEXT Instructions Formatwith P-Register Information handling instructions Control instructions
Arithmetic Unit 1 2 3 4 5 6 7 8 9 p1 STO #0 ND * 0 # p2 #0 SC STO p3 KFL #0 P3 EQ? p4 SC #10 SC MUL p5 ADD SC KDA SC p6 STO #0 KFL p7 ND #1 ND ADD p8 ND #3 P3 NE? p9 SC #321 P1 NE? p10 DDA #1 STO p11 P1 JMP Data Memory ND = SC = KFL = DDA = Control Unit KDA = Program Memory
The “Von Neuman” Computer Data Memory Arithmetic Unit Output Interface Control Input Interface Unit Program Memory Program Interface
Arithmetic Unit 1 2 3 4 5 6 7 8 9 * 0 # Data Memory 101: ND 102: SC 1:KFL 3:DDA Control Unit 2:KDA Program Memory (from 11) 11 0 101 10 12 0 102 10 13 1 0 13 40 14 102 10 102 22 15 20 102 2 102 16 0 1 10 17 101 1 101 20 18 101 3 13 41 19 2 321 11 41 20 1 3 10 21 11 47