Exemple chargement d’une instruction

Preview:

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

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

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

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

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

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

Construisons le contrôleur

JMPCF0

F1

ENBINC

FETCHB=0x01

Main1

ISTORE

F1

ENBH

B=0x05

ISTORE1

ISTORE2

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.

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

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

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

Construisons le contrôleur

JMPCF0

F1

ENBINC

FETCHB=0x01

Main1

ISTORE

F1

ENBH

B=0x05

ISTORE1

ISTORE2

F0

F1

ENAENBMAR

B=0x03

ISTORE2

ISTORE3

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

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

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

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

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

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.

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

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

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

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

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

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

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

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

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

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)

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

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

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

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

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.

Recommended