• Aucun résultat trouvé

7. Premiers répertoire d’instructions 8. Machine à accumulateur

N/A
N/A
Protected

Academic year: 2022

Partager "7. Premiers répertoire d’instructions 8. Machine à accumulateur"

Copied!
39
0
0

Texte intégral

(1)

1. Langage de programmation 2. Répertoire d’instruction

3. Format d’instruction 4. Modes d’adressage

5. Type de langage machine 6. Technologie et logiciels

7. Premiers répertoire d’instructions 8. Machine à accumulateur

9. Machine à registres

(2)

⇒ Outil d’écriture des programmes exécutables par ordinateur

• Langages de bas niveau : langages machine et langages d’assemblage

• Langages de haut niveau ou évolués

quelques instructions d’un programme en langage machine

….

101001011100111 ; transférer le contenu de l’adresse 103 à A 111100001011101 ; ajouter le contenu de A à B

….

quelque instructions d’un programme en langage d’assemblage

….

MOV A,103 ; transférer le contenu de l’adresse 103 à A ADD A,B ; ajouter le contenu de A à B

….

(3)

Langages de bas niveau

étroitement lié à l’ordinateur utilisé

difficiles à lire et à écrire

fortement exposés aux erreurs Langages de haut niveau

indépendance par rapport à l’ordinateur ⇒ portabilité

programmes facilement compréhensibles

faciles à apprendre

instructions proches de la langue naturelle

(4)

….

….

101001011100111 11110000101110

….

….

Ordinateur

Assembleur Interpréteur

Compilateur

….

….

MOV A,103 ADD A,B

….

….

….

….

A=A+B

….

….

Programme en langage haut niveau

Programme en langage

machine

Programme en langage d’assemblage

(5)

Ensemble d’instructions machine = répertoire d’instructions

Instruction de transfert de données entre la mémoire et les registre : MOVE, LOAD, STORE,…

Opération arithmétique ou logique : ADD, AND,…

Opération de contrôle d’aiguillage : BR, JUMP,…

Instruction d’entrée/sortie IN, OUT, …

(6)

⇒ Façon avec laquelle les instructions sont stockées en mémoire

101001011100111 ; transférer le contenu de l’adresse 103 à A

1010 0101 1100111

Code d’opération Adresse du registre A Adresse 103 instruction

(7)

Influence of Technology and Software on Instruction Sets:

Up to the dawn of IBM 360

Arvind

Computer Science and Artificial Intelligence Laboratory

M.I.T.

Based on the material prepared by

Arvind and Krste Asanovic

(8)

Importance of Technology

New technologies not only provide greater speed, size and reliability at lower cost, but more importantly these dictate the kinds of structures that can be considered and thus come to shape our whole view of what a computer is.

Bell & Newell

(9)

Technology is the dominant factor in computer design

Technology

Transistors

VLSI (initially)

Technology

Core memories Magnetic tapes Disks

Technology

ROMs, RAMs VLSI

Packaging Low Power

Computers

Laser disk, CD’s

Computers

Computers

Integrated circuits

(10)

But Software...

As people write programs and use computers, our understanding of programming and

program behavior improves.

This has profound though slower impact on computer architecture

Modern architects cannot avoid paying

attention to software and compilation issues.

Technology Software

Computers

(11)

Computers in mid 50’s

• Hardware was expensive

• Stores were small (1000 words)

⇒ No resident system-software!

• Memory access time was 10 to 50 times slower than the processor cycle

⇒ Instruction execution time was totally dominated by the memory reference time.

• The ability to design complex control

circuits to execute an instruction was the central design concern as opposed to the speed of decoding or an ALU operation

• Programmer’s view of the machine was

inseparable from the actual hardware

implementation

(12)

Programmer’s view of the machine IBM 650

A drum machine with 44 instructions

Instruction: 60 1234 1009

• “Load the contents of location 1234 into the

distribution; put it also into the upper accumulator;

set lower accumulator to zero; and then go to location 1009 for the next instruction.”

Good programmers optimized the placement of

instructions on the drum to reduce latency!

(13)

The Earliest Instruction Sets

Single Accumulator - A carry-over from the calculators.

LOAD x

STORE x

ADD x

SUB x

MUL x

DIV x

SHIFT LEFT SHIFT RIGHT

JUMP x

JGE x

LOAD ADR x STORE ADR x

AC ← M[x]

M[x] ← (AC)

AC ← (AC) + M[x]

Involved a quotient register AC ← 2 × (AC)

PC ← x

if (AC) ≥ 0 then PC ← x

AC ← Extract address field(M[x])

Typically less than 2 dozen instructions!

(14)

Programming:

Single Accumulator Machine

C

i

← A

i

+ B

i

, 1 ≤ i ≤ n

A

LOOP LOAD N B

JGE DONE

ADD ONE

STORE N C

F1 LOAD A

F2 ADD B

F3 STORE C N

JUMP LOOP ONE

DONE HLT

code

How to modify the addresses A, B and C ?

-n 1

(15)

JUMP LOOP DONE HLT

Self-Modifying Code

LOOP

F1 F2F3

modify the program for the next iteration

LOAD JGE ADD STORE LOAD ADD STORE

N

DONE ONE N A B C

C

i

← A

i

+ B

i

, 1 ≤ i ≤ n

Each iteration involves total book- LOAD ADR

ADD

STORE ADR LOAD ADR ADD STORE ADR LOAD ADR ADD STORE ADR

ONE F1 F1 F2 ONE F2 F3 ONE F3

JUMP LOOP

instruction fetches operand fetches stores

keeping

17 14

10 8

5 4

(16)

Processor-Memory Bottleneck:

Early Solutions

• Fast local storage in the processor

– 8-16 registers as opposed to one accumulator

• Indexing capability

– to reduce book keeping instructions

• Complex instructions

– to reduce instruction fetches

• Compact instructions

– implicit address bits for operands, to reduce instruction fetches

Memory

Processor

(17)

Processor State

The information held in the processor at the end of an instruction to provide the processing context for the next instruction.

Program Counter, Accumulator, . . . Programmer visible state of the processor (and memory)

plays a central role in computer organization for both hardware and software:

Software must make efficient use of it

• If the processing of an instruction can be interrupted then the hardware must save and restore the state in a transparent manner

Programmer’s machine model is a contract

between the hardware and software

(18)

Index Registers

Tom Kilburn, Manchester University, mid 50’s

One or more specialized registers to simplify address calculation

Modify existing instructions

LOAD x, IX AC ← M[x + (IX)]

ADD x, IX AC ← (AC) + M[x + (IX)]

...

Add new instructions to manipulate index registers

JZi x, IX if (IX)=0 then PC ← x

else IX ← (IX) + 1 LOADi x, IX IX ← M[x] (truncated to fit IX) ...

Index registers have accumulator-like

characteristics

(19)

Using Index Registers

C

i

← A

i

+ B

i

, 1 ≤ i ≤ n

LOADi -n, IX A

LOOP JZi DONE, IX LOAD LASTA, IX ADD LASTB, IX STORE LASTC, IX

JUMP LOOP LASTA

DONE HALT

• Program does not modify itself

• Efficiency has improved dramatically (ops / iter)

with index regs without index regs instruction fetch 5(2) 17 (14)

operand fetch 2 10 (8)

store 1 5 (4)

• Costs:

Instructions are 1 to 2 bits longer

Index registers with ALU-like circuitry

(20)

Indexing vs. Index Registers

Suppose instead of registers, memory locations are used to implement index registers.

LOAD x, IX

Arithmetic operations on index registers can be performed by bringing the contents to the

accumulator

Most bookkeeping instructions will be avoided but each instruction will implicitly cause several

fetches and stores

complex control circuitry

(21)

Operations on Index Registers

To increment index register by k

AC ← (IX) new instruction AC ← (AC) + k

IX ← (AC) new instruction

also the AC must be saved and restored.

It may be better to increment IX directly

INCi k, IX IX ← (IX) + k

More instructions to manipulate index register

STOREi x, IX M[x] ← (IX) (extended to fit a word) ...

IX begins to look like an accumulator

⇒ several index registers

several accumulators

(22)

Support for Subroutine Calls

ProgramMain

call F a1 a2

call F b1 b2

F:

return

Subroutine F

A special subroutine jump instruction

M: JSR F F ← M + 1 and

jump to F+1

(23)

M+1M+2

Indirect Addressing and Subroutine Calls

Indirect addressing

LOAD (F) inc F

STORE(F) inc F

JUMP (F) M+3 Subroutine LOAD (x) means AC ← M[M[x]] F

... F+1

Caller

Events:

S1 fetch

M JSR F Execute M arg Execute S1 arg result

Execute S2

M+3 Execute S3 S2

store result

Indirect addressing almost eliminates the

need to write self-modifying code (location

S3

F still needs to be modified)

Problems with recursive procedure calls

(24)

Recursive Procedure Calls and Reentrant Codes

Indirect Addressing through a register

LOAD R1, (R2)

Load register R

1

with the contents of the

word whose address is contained in register R

2

PC SP

registers Pure Code

Data

Stack

memory

(25)

Evolution of Addressing Modes

1. Single accumulator, absolute address

LOAD x

2. Single accumulator, index registers

LOAD x, IX

3. Indirection

LOAD (x)

4. Multiple accumulators, index registers, indirection

LOAD R, IX, x

or

LOAD R, IX, (x) the meaning?

R ← M[M[x] + (IX)]

or R ← M[M[x + (IX)]]

5. Indirect through registers

LOAD RI, (RJ)

6. The works

(26)

Variety of Instruction Formats

• Two address formats: the destination is same as one of the operand sources

(Reg × Reg) to Reg RI ← (RI) + (RJ) (Reg × Mem) to Reg RI ← (RI) + M[x]

– x can be specified directly or via a register

– effective address calculation for x could include indexing, indirection, ...

• Three address formats: One destination and up to two operand sources per instruction

(Reg x Reg) to Reg RI ← (RJ) + (RK) (Reg x Mem) to Reg RI ← (RJ) + M[x]

(27)

More Instruction Formats

Zero address formats: operands on a stack

add M[sp-1] ← M[sp] + M[sp-1]

load M[sp] ← M[M[sp]]

– Stack can be in registers or in memory (usually top of stack cached in registers)

One address formats: Accumulator machines

– Accumulator is always other implicit operand

Many different formats are possible!

(28)

Data Formats and Memory Addresses

Data formats:

Bytes, Half words, words and double words

Some issues

• Byte addressing

Big Endian 0 1 2 3

vs. Little Endian 3 2 1 0

• Word alignment

Suppose the memory is organized in 32-bit words.

Can a word address begin only at 0, 4, 8, .... ?

0 1 2 3 4 5 6 7

(29)

Some Problems

• Should all addressing modes be provided for every operand?

regular vs. irregular instruction formats

• Separate instructions to manipulate

Accumulators, Index registers, Base registers

large number of instructions

• Instructions contained implicit memory

references -- several contained more than one

very complex control

(30)

Compatibility Problem at IBM

By early 60’s, IBM had 4 incompatible lines of computers!

701

7094 650

7074 702

7080 1401

→ 

7010

Each system had its own

• Instruction set

• I/O system and Secondary Storage:

magnetic tapes, drums and disks

• assemblers, compilers, libraries,...

• market niche

business, scientific, real time, ...

IBM 360

(31)

IBM 360 : Design Premises

Amdahl, Blaauw and Brooks, 1964

The design must lend itself to growth and successor machines

• General method for connecting I/O devices

• Total performance - answers per month rather than bits per microsecond ⇒ programming aids

Machine must be capable of supervising itself without manual intervention

Built-in hardware fault checking and locating aids to reduce down time

• Simple to assemble systems with redundant I/O devices, memories etc. for fault tolerance

• Some problems required floating point words

larger than 36 bits

(32)

IBM 360: A General-Purpose Register (GPR) Machine

• Processor State

– 16 General-Purpose 32-bit Registers

• may be used as index and base register

• Register 0 has some special properties

– 4 Floating Point 64-bit Registers

– A Program Status Word (PSW)

• PC, Condition codes, Control flags

• A 32-bit machine with 24-bit addresses

– No instruction contains a 24-bit address !

• Data Formats

– 8-bit bytes, 16-bit half-words, 32-bit words,

64-bit double-words

(33)

IBM 360: Implementation

Model 30 . . . Model 70

Storage 8K - 64 KB 256K - 512 KB

Datapath 8-bit 64-bit

Circuit Delay 30 nsec/level 5 nsec/level

Local Store Main Store Transistor Registers Control Store Read only 1µsec Conventional circuits

IBM 360 instruction set architecture completely hid the underlying technological differences between various models.

With minor modifications it survives till today

(34)

IBM S/390 z900 Microprocessor

• 64-bit virtual addressing

– first 64-bit S/390 design (original S/360 was 24-bit, and S/370 was 31-bit extension)

• 1.1 GHz clock rate (announced ISSCC 2001)

– 0.18µm CMOS, 7 layers copper wiring

– 770MHz systems shipped in 2000

• Single-issue 7-stage CISC pipeline

• Redundant datapaths

– every instruction performed in two parallel datapaths and results compared

• 256KB L1 I-cache, 256KB L1 D-cache on-chip

• 20 CPUs + 32MB L2 cache per Multi-Chip Module

• Water cooled to 10

o

C junction temp

(35)

What makes a good instruction set?

One that provides a simple software interface yet allows simple, fast, efficient hardware

implementations

… but across 25+ year time frame Example of difficulties:

ƒ

Current machines have register files with more storage than entire main memory of early machines!

ƒ

On-chip test circuitry in current machines has hundreds

of times more transistors than entire early computers!

(36)

Full Employment for Architects

• Good news: “Ideal” instruction set changes continually

– Technology allows larger CPUs over time

– Technology constraints change (e.g., now it is power) – Compiler technology improves (e.g., register allocation)

– Programming styles change (assembly, HLL, object-oriented, …) – Applications change (e.g., multimedia, ....)

– Bad news: Software compatibility imposes huge damping coefficient on instruction set innovation

– Software investment dwarfs hardware investment

– Innovate at microarchitecture level, below the ISA level (this is what most computer architects do)

• New instruction set can only be justified by new large market and technological advantage

– Network processors – Multimedia processors

(37)

⇒ chemin à suivre pour obtenir l’adresse effective Mode direct ou absolu :

MOVE R1, R2 ; R1 Å (R2)

MOVE R1, 405 ; R1 Å (405)

Mode immédiat :

MOVI R1, 405 ; R1 Å 405

MOVI 103, 405 ; 103 Å 405

Mode indirect :

MOVE R1, @100 ; R1 Å ((100)) Mode indexé :

MOVE R1, 17(R2) ; R1 Å (10 + (R2)) MOVE 1, Table(R2) ; 1 Å (Table + (R2))

(38)

Considérons l’instruction : A= B + C

Machine à plusieurs opérandes (Vax 11) :

ADDW3 B,C,A ; A Å (B) + (C) Machine à deux opérandes (PDP 11) :

MOVE B,A ; A Å (B)

ADD C,A ; A Å (B) + (C)

Machine à un opérande (Vax 11)

LDM B ; Charger B dans l’accumulateur

ADD C ; Ajouter C a l’accumulateur

STM A ; Stocker l’accumulateur dans A

(39)

Considérons l’instruction : A= B + C Machine à registres (Cyber 170)

EA1 B ; X1 Å (B)

EA2 C ; X2 Å (C)

IX6 X1 + X2 ; X6 Å (X1) + (X2)

SA6 A ; A Å (X6)

Machine à registres (HP 3000)

LOAD B ; mettre B dans la pile LOAD C ; mettre C dans la pile

ADD ; ajouter les 2 élément au dessus de la pile et mettre

; le résultat sur la pile

STORE A ; 1 Å (Table + (R2))

Références

Documents relatifs

[5], which used a technique new to psychology called network meta-analysis, and examined the effect- iveness of procedures to change implicit bias, our focus was solely on the

Direction de la sécurité sociale, bureau des régimes spéciaux : réglementation, tutelle de l’Etat et fonctionnement de la Caisse autonome nationale de sécurité sociale

- Etablissements publics de lutte contre la tuberculose, problème de reconversion : rapports, études, comptes rendus de réunion,

1726K-2 EK / CK Footboard with drawer & Slat / Pied de Lit avec tiroir et lattes-Tres Grand Lit.. A Queen / EK / CK Footboard with drawer & slat / Pied de Lit avec

It takes place by the exposure of students to grammar forms in a meaningful input so that they acquire them unconsciously and naturally, the targeted structure is not

D Le dernier octet du code machine généré est 02 (hexadécimal) E Le premier octet du code machine est 32 (hexadécimal) F la valeur du symbole x est 07 (hexadécimal).. G Ce

Il s'agit du regroupement de deux versements n° 634 du 24 juillet et n° 639 du 1er août 1980 du bureau JEP/4 relations et échanges internationaux, sous-direction de

Il va falloir une variable entière pour stocker N, une variable entière pour stocker la somme, une variable entière pour stocker un compteur (qui compte 1, 2, 3, ..., N), une