18
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 IADD 0x60

Exemple chargement dune instruction 3 0x00 0xXX 0x05 0x00 0x04 Addr Alu JM 4 to 16 Decoder High Bit C B MPC 4 9 8 2 2 6 8 B Bus C Bus Memory control signals

Embed Size (px)

Citation preview

Page 1: Exemple chargement dune instruction 3 0x00 0xXX 0x05 0x00 0x04 Addr Alu JM 4 to 16 Decoder High Bit C B MPC 4 9 8 2 2 6 8 B Bus C Bus Memory control signals

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 IADD 0x60

Page 2: Exemple chargement dune instruction 3 0x00 0xXX 0x05 0x00 0x04 Addr Alu JM 4 to 16 Decoder High Bit C B MPC 4 9 8 2 2 6 8 B Bus C Bus Memory control signals

Comment faire un IADD

• Mettre à jour « SP ».• Prendre en mémoire les éléments à additionner• Déplacer une donnée dans le registre H• Additionner les deux valeurs• Mettre à jour la tête de la pile « TOS » et la

mémoire.

Page 3: Exemple chargement dune instruction 3 0x00 0xXX 0x05 0x00 0x04 Addr Alu JM 4 to 16 Decoder High Bit C B MPC 4 9 8 2 2 6 8 B Bus C Bus Memory control signals

Exemple IADD3

0x00

0x60

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

0x60

Nécessaire d’obtenir l’avant dernier élément

de la pile

SP-1

Page 4: Exemple chargement dune instruction 3 0x00 0xXX 0x05 0x00 0x04 Addr Alu JM 4 to 16 Decoder High Bit C B MPC 4 9 8 2 2 6 8 B Bus C Bus Memory control signals

Exemple IADD (MAR=SP=SP-1; Rd ; Goto iadd2)3

0x00

0x60

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 dune instruction 3 0x00 0xXX 0x05 0x00 0x04 Addr Alu JM 4 to 16 Decoder High Bit C B MPC 4 9 8 2 2 6 8 B Bus C Bus Memory control signals

Exemple IADD (MAR=SP=SP-1; Rd ; Goto iadd2)3

0x00

0x60

0x05

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 6: Exemple chargement dune instruction 3 0x00 0xXX 0x05 0x00 0x04 Addr Alu JM 4 to 16 Decoder High Bit C B MPC 4 9 8 2 2 6 8 B Bus C Bus Memory control signals

Exemple IADD

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

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

iadd2 0 0 0 0 0 1 1 0 1 1 10 0 0 0 0 1 0 0 1 0 1 0 0x04

Page 7: Exemple chargement dune instruction 3 0x00 0xXX 0x05 0x00 0x04 Addr Alu JM 4 to 16 Decoder High Bit C B MPC 4 9 8 2 2 6 8 B Bus C Bus Memory control signals

Construisons le contrôleur

JMPCF0

F1

ENBINC

FETCHB=0x01

Main1

IADD

F0

F1

ENBINVAINCSP

MARREAD

B=0x04

IADD1

IADD2

Page 8: Exemple chargement dune instruction 3 0x00 0xXX 0x05 0x00 0x04 Addr Alu JM 4 to 16 Decoder High Bit C B MPC 4 9 8 2 2 6 8 B Bus C Bus Memory control signals

Exemple IADD 3

0x04

0x00

0xXX

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

TOS

Arrivée de la prochaine instruction

Une opération binaire ne peut être

effectuée qu’en utilisant le registre H

Page 9: Exemple chargement dune instruction 3 0x00 0xXX 0x05 0x00 0x04 Addr Alu JM 4 to 16 Decoder High Bit C B MPC 4 9 8 2 2 6 8 B Bus C Bus Memory control signals

Exemple IADD (H=TOS ; Goto iadd3)3

0x04

0x00

0xXX

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 10: Exemple chargement dune instruction 3 0x00 0xXX 0x05 0x00 0x04 Addr Alu JM 4 to 16 Decoder High Bit C B MPC 4 9 8 2 2 6 8 B Bus C Bus Memory control signals

Exemple IADD (H=TOS ; Goto iadd3)3

0x04

0x00

0xXX

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

0x60

Page 11: Exemple chargement dune instruction 3 0x00 0xXX 0x05 0x00 0x04 Addr Alu JM 4 to 16 Decoder High Bit C B MPC 4 9 8 2 2 6 8 B Bus C Bus Memory control signals

Exemple IADD

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

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

iadd3 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0x07

Page 12: Exemple chargement dune instruction 3 0x00 0xXX 0x05 0x00 0x04 Addr Alu JM 4 to 16 Decoder High Bit C B MPC 4 9 8 2 2 6 8 B Bus C Bus Memory control signals

Construisons le contrôleur

JMPCF0

F1

ENBINC

FETCHB=0x01

Main1

IADD

F0

F1

ENBINVAINCSP

MARREAD

B=0x04

IADD1

IADD2 F1

ENBH

B=0x07

IADD2

IADD3

Page 13: Exemple chargement dune instruction 3 0x00 0xXX 0x05 0x00 0x04 Addr Alu JM 4 to 16 Decoder High Bit C B MPC 4 9 8 2 2 6 8 B Bus C Bus Memory control signals

Exemple IADD3

0x04

0x09

0x00

0xXX

0x04

0x00

0x04

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

MDR+H

Arrivée de la valeur de l’adresse

mémoire 0x04

Page 14: Exemple chargement dune instruction 3 0x00 0xXX 0x05 0x00 0x04 Addr Alu JM 4 to 16 Decoder High Bit C B MPC 4 9 8 2 2 6 8 B Bus C Bus Memory control signals

Exemple IADD (MDR=TOS=MDR+H ;Wr ;Goto Main1)

3

0x04

0x09

0x00

0xXX

0x04

0x00

0x04

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 dune instruction 3 0x00 0xXX 0x05 0x00 0x04 Addr Alu JM 4 to 16 Decoder High Bit C B MPC 4 9 8 2 2 6 8 B Bus C Bus Memory control signals

Exemple IADD (MDR=TOS=MDR+H ;Wr ;Goto Main1)3

0x04

0x09

0x00

0xXX

0x04

0x00

0x04

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 16: Exemple chargement dune instruction 3 0x00 0xXX 0x05 0x00 0x04 Addr Alu JM 4 to 16 Decoder High Bit C B MPC 4 9 8 2 2 6 8 B Bus C Bus Memory control signals

Exemple IADD

• En résumé nous venons de faire les opérations suivantes– MDR=TOS=MDR+H ;Wr ;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 1 1 1 1 0 0 0 0 1 0 0 0 0 1 0 1 0 0 0x00

Page 17: Exemple chargement dune instruction 3 0x00 0xXX 0x05 0x00 0x04 Addr Alu JM 4 to 16 Decoder High Bit C B MPC 4 9 8 2 2 6 8 B Bus C Bus Memory control signals

Construisons le contrôleur

JMPCF0

F1

ENBINC

FETCHB=0x01

Main1

IADD

F0

F1

ENBINVAINCSP

MARREAD

B=0x04

IADD1

IADD2F1

ENBH

B=0x07

IADD2

IADD3

F0

F1

ENAENBTOSMDR

WRITEB=0x00

IADD3

Page 18: Exemple chargement dune instruction 3 0x00 0xXX 0x05 0x00 0x04 Addr Alu JM 4 to 16 Decoder High Bit C B MPC 4 9 8 2 2 6 8 B Bus C Bus Memory control signals

Résultat3

0x04

0x0D

0x00

0xXX

0x04

0x00

0x0D

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