Architecture des ordinateurs

carenextSoftware and s/w Development

Nov 18, 2013 (3 years and 6 months ago)

76 views

Architecture des ordinateurs

Juri

Luca De Coi

Saint
-
Etienne, France, 26
-
09
-
2011

Outline


Introduction


Motivations


A bit of history


The AMD64 instruction set


General
-
purpose programming


General registers


(Some) General
-
Purpose Instructions


Low
-
level programming languages
(LLPLs)

Did you ever try to write a non
-
trivial application in
assembly?


Limited expressiveness


Simple tasks require many instructions


Limited usability


Long development time (


costs
)


Error
-
prone


No portability


Your program will only work on the platform you
wrote it for


Efficiency (if skillfully used)


Optimized usage of computational resources

High
-
level programming languages
(HLPLs)


Greater expressiveness


Each statement typically maps to many LLPL
instructions


Greater usability


Shorter development time (


costs
)


Less chances to make errors


Portability


to all platforms supporting the language


Less efficiency than (skillfully used) LLPLs


More computational resources are required


NOTE:

Need compilation/interpretation

LLPLs vs HLPLs

LLPLs


Visibility/Manipulation of hardware resources


Statements drawn from the instruction set



Low abstraction w.r.t. the architecture

HLPLs


Visibility/Manipulation of abstract resources


Statements drawn from the constructs of the
language



High abstraction w.r.t. the architecture


Code reuse (I)

Some problems are common to different
applications


It does not make sense reinventing the wheel
each time


Solve the problem once


Reuse the solution over and over

Code reuse (II)


Less code to write


The code is written only once


Less code to debug


If there is a problem, you know where to find it


Less code to mantain


Modifications are centralized


This observation underlays a number of
programming paradigms


Procedural programming


Object
-
oriented programming


Component
-
based programming


Agent
-
oriented programming

Functions vs procedures (I)

Functions compute something


namely, a
return value

based on
input values

EX:

The taxes you have to pay given your income

Procedures do something


namely, modify the state of the world

EX:

Move this computer to another place

Functions vs procedures (II)

(Purely) Functional languages do not support
the definition of procedures

EX:

Haskell

(Purely) Procedural languages do not support
the definition of functions

EX:

Assembly of TM
-
based architectures


HLPLs typically support the definition of both
functions and procedures (F&Ps)


and something which is neither F nor P

How to implement
functions/procedures in assembly

(

Expressions vs statements


Beside enabling the definition of F&Ps, HLPLs
typically provide built
-
in functions (used in
expressions
) and procedures (used in
statements
)


Typical built
-
in functions are


bit string functions

EX:

Left shift, arithmetical/logical right shift, flip


boolean

(string) functions

EX:

(Bitwise) NOT/AND/OR/XOR


number functions

EX:

Arithmetical operations

Java operands

Unary operators

Binary operators

Ternary operator

~

bit string


bit string

&

bit
string, bit string


bit string

?:

boolean, entity, entity


entity

!

boolean


boolean

^

bit string, bit string


bit string

+

number


number

|

bit string, bit string


bit string

-

number


number

<<

bit string, number


bit string

>>

bit string, number


bit string

>>>

bit string, number


bit string

&&

boolean, boolean


boolean

||

boolean, boolean


boolean

>

number, number


boolean

>=

number, number


boolean

<

number, number


boolean

<=

number, number


boolean

+

number, number


number
or

string
, string


string

-

number, number


number

*

number, number


number

/

number, number


number

%

number, number


number

==

entity, entity


boolean

!=

entity, entity


boolean

instanceof

object, class


boolean

Statements

Assignments


Change the value of some entity

Branches


Do different things according to the value of
some expression

Loops


Keep doing something as long as some
expression has a given value