32
Exemple chargement d’une instruction 3 0x00 0xXX 0x05 0x00 0x04 Addr Alu J M 4 to 16 Decoder High Bit C B MPC 4 9 8 2 2 6 8 B Bus C Bus Memory control signals (rd,wr,fetch) N Z MIR JMPC JAMN/JAMZ 0xXX Imaginons que l’instruction que nous venons de charger est ISTORE 0x36

Exemple chargement d’une instruction

  • Upload
    chung

  • View
    37

  • Download
    0

Embed Size (px)

DESCRIPTION

Exemple chargement d’une instruction. Memory control signals (rd,wr,fetch). 3. 4 to 16 Decoder. 4. MPC. 9. 0x00. 0xXX. 8. 0xXX. 8. Imaginons que l’instruction que nous venons de charger est ISTORE 0x36. 0x05. 0x00. JMPC. MIR. C. Addr. J. M. Alu. B. 0x04. JAMN/JAMZ. High - PowerPoint PPT Presentation

Citation preview

Page 1: Exemple chargement d’une instruction

Exemple chargement d’une instruction3

0x00

0xXX

0x05

0x00

0x04

Addr AluJ M

4 to 16 Decoder

High Bit

C B

MPC

4

9

8

2

2

6

8

B Bus

C Bus

Memory control signals (rd,wr,fetch)

N

Z

MIRJMPC

JAMN/JAMZ

0xXX

Imaginons que l’instruction que nous venons de

charger est ISTORE 0x36

Page 2: Exemple chargement d’une instruction

Exemple Istore3

0x01

0x36

0x05

0x00

0x04

Addr AluJ M

4 to 16 Decoder

High Bit

C B

MPC

4

9

8

2

2

6

8

B Bus

C Bus

Memory control signals (rd,wr,fetch)

N

Z

MIRJMPC

JAMN/JAMZ

Pour sauvegarder une variableen mémoire, il faut avant tout

calculer son adresse.Cette étape prépare le calcul:

Adr var =LV +num de var

Page 3: Exemple chargement d’une instruction

Exemple Istore (H=LV; Goto Istore2)3

0x01

0x36

0x05

0x00

0x04

Addr AluJ M

4 to 16 Decoder

High Bit

C B

MPC

4

9

8

2

2

6

8

B Bus

C Bus

Memory control signals (rd,wr,fetch)

N

Z

MIRJMPC

JAMN/JAMZ

Page 4: Exemple chargement d’une instruction

Exemple Istore (H=LV; Goto Istore2)3

0x01

0x36

0x05

0x00

0x04

Addr AluJ M

4 to 16 Decoder

High Bit

C B

MPC

4

9

8

2

2

6

8

B Bus

C Bus

Memory control signals (rd,wr,fetch)

N

Z

MIRJMPC

JAMN/JAMZ

Page 5: Exemple chargement d’une instruction

Exemple Istore (H=LV; Goto Istore2)

• En résumé nous venons de faire les opérations suivantes– H=LV; Goto Istore2

Next_Adress8 bits

JAM3 bits

ALU8 bits

Bus C9 bits

Mémoire

3 bits

Bus B4 bits

JMPC

JAMN

JAMZ

SLL8

SRA1

F0 F1 ENA

ENB

INVA

INC

H OPS

TOS

CPP

LV

SP

PC

MDR

MAR

WRITE

READ

FETCH

Istore2 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0x05

Page 6: Exemple chargement d’une instruction

Construisons le contrôleur

JMPCF0

F1

ENBINC

FETCHB=0x01

Main1

ISTORE

F1

ENBH

B=0x05

ISTORE1

ISTORE2

Page 7: Exemple chargement d’une instruction

Exemple Istore3

0x01

0x01

0x05

0x00

0x04

0x00

Addr AluJ M

4 to 16 Decoder

High Bit

C B

MPC

4

9

8

2

2

6

8

B Bus

C Bus

Memory control signals (rd,wr,fetch)

N

Z

MIRJMPC

JAMN/JAMZ

0x36

MBRU+H

Arrivée de la donnée.(Lecture déclenché

dans le Main1)

L’adresse de la variable est

calculée.

Page 8: Exemple chargement d’une instruction

Exemple Istore (MAR=MBRU+H; Goto Istore3)3

0x01

0x01

0x05

0x00

0x04

0x00

Addr AluJ M

4 to 16 Decoder

High Bit

C B

MPC

4

9

8

2

2

6

8

B Bus

C Bus

Memory control signals (rd,wr,fetch)

N

Z

MIRJMPC

JAMN/JAMZ

Page 9: Exemple chargement d’une instruction

Exemple Istore (MAR=MBRU+H; Goto Istore3)3

0x01

0x01

0x05

0x00

0x04

0x00

Addr AluJ M

4 to 16 Decoder

High Bit

C B

MPC

4

9

8

2

2

6

8

B Bus

C Bus

Memory control signals (rd,wr,fetch)

N

Z

MIRJMPC

JAMN/JAMZ

Page 10: Exemple chargement d’une instruction

Exemple Istore

• En résumé nous venons de faire les opérations suivantes– MAR=MBRU+H; Goto Istore3

Next_Adress8 bits

JAM3 bits

ALU8 bits

Bus C9 bits

Mémoire

3 bits

Bus B4 bits

JMPC

JAMN

JAMZ

SLL8

SRA1

F0 F1 ENA

ENB

INVA

INC

H OPS

TOS

CPP

LV

SP

PC

MDR

MAR

WRITE

READ

FETCH

Istore3 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0x03

Page 11: Exemple chargement d’une instruction

Construisons le contrôleur

JMPCF0

F1

ENBINC

FETCHB=0x01

Main1

ISTORE

F1

ENBH

B=0x05

ISTORE1

ISTORE2

F0

F1

ENAENBMAR

B=0x03

ISTORE2

ISTORE3

Page 12: Exemple chargement d’une instruction

Exemple Istore3

0x01

0x01

0x01

0x05

0x00

0x04

Addr AluJ M

4 to 16 Decoder

High Bit

C B

MPC

4

9

8

2

2

6

8

B Bus

C Bus

Memory control signals (rd,wr,fetch)

N

Z

MIRJMPC

JAMN/JAMZ

On va donc envoyer l’élément

de tête de pile dans la mémoire

Page 13: Exemple chargement d’une instruction

Exemple Istore (MDR=TOS;Wr; Goto Istore4)3

0x01

0x01

0x01

0x05

0x00

0x04

Addr AluJ M

4 to 16 Decoder

High Bit

C B

MPC

4

9

8

2

2

6

8

B Bus

C Bus

Memory control signals (rd,wr,fetch)

N

Z

MIRJMPC

JAMN/JAMZ

Page 14: Exemple chargement d’une instruction

Exemple Istore (MDR=TOS;Wr; Goto Istore4)3

0x01

0x01

0x01

0x05

0x00

0x04

Addr AluJ M

4 to 16 Decoder

High Bit

C B

MPC

4

9

8

2

2

6

8

B Bus

C Bus

Memory control signals (rd,wr,fetch)

N

Z

MIRJMPC

JAMN/JAMZ

Page 15: Exemple chargement d’une instruction

Exemple Istore (MDR=TOS;Wr; Goto Istore4)

• En résumé nous venons de faire les opérations suivantes– MDR=TOS;Wr; Goto Istore4

Next_Adress8 bits

JAM3 bits

ALU8 bits

Bus C9 bits

Mémoire

3 bits

Bus B4 bits

JMPC

JAMN

JAMZ

SLL8

SRA1

F0 F1 ENA

ENB

INVA

INC

H OPS

TOS

CPP

LV

SP

PC

MDR

MAR

WRITE

READ

FETCH

Istore4 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0x07

Page 16: Exemple chargement d’une instruction

Construisons le contrôleur

JMPCF0

F1

ENBINC

FETCHB=0x01

Main1

ISTORE

F1

ENBH

B=0x05

ISTORE1

ISTORE2

F0

F1

ENAENBMAR

B=0x03

ISTORE2

ISTORE3

F1

ENBMDR

WRITEB=0x07

ISTORE4

ISTORE3

Page 17: Exemple chargement d’une instruction

Exemple Istore3

0x01

0x04

0x01

0x01

0x05

0x00

0x04

Addr AluJ M

4 to 16 Decoder

High Bit

C B

MPC

4

9

8

2

2

6

8

B Bus

C Bus

Memory control signals (rd,wr,fetch)

N

Z

MIRJMPC

JAMN/JAMZ

SP-1

Il faut mettre les registres gérant la

pile à jour.On commence par

décrémenter le haut de la pile et on va chercher dans la

mémoire le nouvelle élément qui sera la

tête de la pile.

Page 18: Exemple chargement d’une instruction

Exemple Istore (MDR=TOS;Wr; Goto Istore4)3

0x01

0x04

0x01

0x01

0x05

0x00

0x04

Addr AluJ M

4 to 16 Decoder

High Bit

C B

MPC

4

9

8

2

2

6

8

B Bus

C Bus

Memory control signals (rd,wr,fetch)

N

Z

MIRJMPC

JAMN/JAMZ

Page 19: Exemple chargement d’une instruction

Exemple Istore (MDR=TOS;Wr; Goto Istore4)3

0x01

0x04

0x01

0x01

0x05

0x00

0x04

Addr AluJ M

4 to 16 Decoder

High Bit

C B

MPC

4

9

8

2

2

6

8

B Bus

C Bus

Memory control signals (rd,wr,fetch)

N

Z

MIRJMPC

JAMN/JAMZ

Page 20: Exemple chargement d’une instruction

Exemple Istore

• En résumé nous venons de faire les opérations suivantes– SP=MAR=SP-1;Rd; Goto Istore5

Next_Adress8 bits

JAM3 bits

ALU8 bits

Bus C9 bits

Mémoire

3 bits

Bus B4 bits

JMPC

JAMN

JAMZ

SLL8

SRA1

F0 F1 ENA

ENB

INVA

INC

H OPS

TOS

CPP

LV

SP

PC

MDR

MAR

WRITE

READ

FETCH

Istore5 0 0 0 0 0 1 1 0 1 1 10 0 0 0 0 1 0 0 1 0 1 0 0x04

Page 21: Exemple chargement d’une instruction

Construisons le contrôleur

JMPCF0

F1

ENBINC

FETCHB=0x01

Main1

ISTORE

F1

ENBH

B=0x05

ISTORE1

ISTORE2

F0

F1

ENAENBMAR

B=0x03

ISTORE2

ISTORE3

F1

ENBMDR

WRITEB=0x07

ISTORE4

ISTORE3 F0

F1

ENBINVAINCSP

MARREAD

B=0x04

ISTORE5

ISTORE4

Page 22: Exemple chargement d’une instruction

Exemple Istore3

0x04

0x04

0x01

0x01

0x04

0x00

0x04

Addr AluJ M

4 to 16 Decoder

High Bit

C B

MPC

4

9

8

2

2

6

8

B Bus

C Bus

Memory control signals (rd,wr,fetch)

N

Z

MIRJMPC

JAMN/JAMZ

PC+1

On incrémente le compteur de

programme car l’instruction ISTORE

est codée sur 2 bytes

Page 23: Exemple chargement d’une instruction

Exemple Istore (PC=PC+1;fetch; Goto Istore6)3

0x04

0x04

0x01

0x01

0x04

0x00

0x04

Addr AluJ M

4 to 16 Decoder

High Bit

C B

MPC

4

9

8

2

2

6

8

B Bus

C Bus

Memory control signals (rd,wr,fetch)

N

Z

MIRJMPC

JAMN/JAMZ

Page 24: Exemple chargement d’une instruction

Exemple Istore (PC=PC+1;fetch; Goto Istore6)3

0x04

0x04

0x01

0x01

0x04

0x00

0x04

Addr AluJ M

4 to 16 Decoder

High Bit

C B

MPC

4

9

8

2

2

6

8

B Bus

C Bus

Memory control signals (rd,wr,fetch)

N

Z

MIRJMPC

JAMN/JAMZ

Page 25: Exemple chargement d’une instruction

Exemple Istore

• En résumé nous venons de faire les opérations suivantes– PC=PC+1;fetch; Goto Istore6

Next_Adress8 bits

JAM3 bits

ALU8 bits

Bus C9 bits

Mémoire

3 bits

Bus B4 bits

JMPC

JAMN

JAMZ

SLL8

SRA1

F0 F1 ENA

ENB

INVA

INC

H OPS

TOS

CPP

LV

SP

PC

MDR

MAR

WRITE

READ

FETCH

Istore6 0 0 0 0 0 1 1 0 1 0 10 0 0 0 0 0 10 0 0 0 1 0x01

Page 26: Exemple chargement d’une instruction

Construisons le contrôleur

JMPCF0

F1

ENBINC

FETCHB=0x01

Main1

ISTORE

F1

ENBH

B=0x05

ISTORE1

ISTORE2

F0

F1

ENAENBMAR

B=0x03

ISTORE2

ISTORE3

F1

ENBMDR

WRITEB=0x07

ISTORE4

ISTORE3 F0

F1

ENBINVAINCSP

MARREAD

B=0x04

ISTORE5

ISTORE4

ISTORE4

F1

ENBTOS

FETCHB=0x00

ISTORE6

ISTORE5

Page 27: Exemple chargement d’une instruction

Exemple Istore3

0x04

0x07

0x02

0x01

0x04

0x00

0x04

Addr AluJ M

4 to 16 Decoder

High Bit

C B

MPC

4

9

8

2

2

6

8

B Bus

C Bus

Memory control signals (rd,wr,fetch)

N

Z

MIRJMPC

JAMN/JAMZOn met a jour la tête de la pile qui vient d’arriver en

mémoire

Arrivée de la donnée.(Lecture

déclenché dans Istore4)

Page 28: Exemple chargement d’une instruction

Exemple Istore (TOS=MDR; Goto Main1)3

0x01

0x07

0x02

0x01

0x04

0x00

0x04

Addr AluJ M

4 to 16 Decoder

High Bit

C B

MPC

4

9

8

2

2

6

8

B Bus

C Bus

Memory control signals (rd,wr,fetch)

N

Z

MIRJMPC

JAMN/JAMZ

0x36

Page 29: Exemple chargement d’une instruction

Exemple Istore (TOS=MDR; Goto Main1)3

0x01

0x07

0x02

0x01

0x04

0x00

0x04

Addr AluJ M

4 to 16 Decoder

High Bit

C B

MPC

4

9

8

2

2

6

8

B Bus

C Bus

Memory control signals (rd,wr,fetch)

N

Z

MIRJMPC

JAMN/JAMZ

Page 30: Exemple chargement d’une instruction

Exemple Istore

• En résumé nous venons de faire les opérations suivantes– TOS=MDR; Goto Main1

Next_Adress8 bits

JAM3 bits

ALU8 bits

Bus C9 bits

Mémoire

3 bits

Bus B4 bits

JMPC

JAMN

JAMZ

SLL8

SRA1

F0 F1 ENA

ENB

INVA

INC

H OPS

TOS

CPP

LV

SP

PC

MDR

MAR

WRITE

READ

FETCH

Main1 0 0 0 0 0 0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0x00

Page 31: Exemple chargement d’une instruction

Construisons le contrôleur

JMPCF0

F1

ENBINC

FETCHB=0x01

Main1

ISTORE

F1

ENBH

B=0x05

ISTORE1

ISTORE2

F0

F1

ENAENBMAR

B=0x03

ISTORE2

ISTORE3

F1

ENBMDR

WRITEB=0x07

ISTORE4

ISTORE3 F0

F1

ENBINVAINCSP

MARREAD

B=0x04

ISTORE5

ISTORE4

F1

ENBTOS

FETCHB=0x00

ISTORE6

ISTORE5

F1

ENBTOS

B=0x00

ISTORE6

Main1ISTORE4 ISTORE5

Page 32: Exemple chargement d’une instruction

Résultat3

0x04

0x07

0x02

0xXX

0x04

0x00

0x07

Addr AluJ M

4 to 16 Decoder

High Bit

C B

MPC

4

9

8

2

2

6

8

B Bus

C Bus

Memory control signals (rd,wr,fetch)

N

Z

MIRJMPC

JAMN/JAMZArrivée de la prochaine instruction.