[MUSIC] So we just heard from Gaetano how
to encode integers and floats.
And now in this new section we're
going to start looking at machine codes.
Okay, so by machine code recall, we saw
in the, in the first section, are this
zeros, and ones that tell the computer
what to do when executing the program.
Okay, and that's going to, we also going
to start looking at an introduction to
assembly language.
And what you have to understand, in terms
of basic machine organization, in order
to learn about assembly programming.
And learn how a computer work works down
a little bit lower level.
Okay?
So here's what we're going to see in this
section.
We're going to see what instruction set
architecture is, which is the heart of
software interface.
It's the contract between hard and
software.
We going to look at briefly at the
history of Intel processors and
architectures.
And then we're going to see how C in
assembly code machine code relates, and
it's going to start looking at x86
basics.
So, we saw this picture in the very first
section, and if you recall, this is the
lifetime.
The, the , the life time of a program
starts with coding time when you write
the code.
Compile time, when you translate from the
high level language all the way down to
machine code, 0s and 1s that compose what
the computer understands.
Okay?
And then run time is what happens when
you actually executing the program.
Okay?
Now also recall that, what makes programs
fast is well, your algorithm, how you
write your code.
Okay?
what the compiler does in other words,
how the compiler translates from C code
to the
To the hardware, software interface, to
DISA, the instructions that are chosen
with the compiler.
And then the assembler converts that to
0s and 1s, to, to machine code.
And then, you know, depending on how the
hardware executes it, it's going to make
your program run faster, okay.
So just, just to review, repeat what I
just said.
You know, the, the time required to
execute a program depends well, on the
program itself.
What algorithm you've used, how the
compiler translates that code written by
the program into assembly instructions.
It also depends on the instructions of
that architecture, which is a set of
basic instructions offered by the
processor to the compiler, or to
whoever's writing assembly code.
And then, ultimately, of course, the
program performance is also a function of
the actual hardware implementation.
How's the hardware itself how the
hardware itself is organized to execute
those instructions.
Okay, so now let's spend a little bit
more time on understanding exactly what
the ISA is.
OKay?
So the ISA defines three things, three
important things.
The first one is a system state.
What defines the state of your system,
okay, of your imperial system.
That includes the contents of registers,
which is as Gaetano told you you know, a
basic unit of storaging inside the CPU
itself.
Okay?
It includes the program counter, which
tells what instruction's being executed
at that time in the, in the processor.
And also, it includes all of the contents
of memory.
Everything that's stored in registries,
memory and including the program counter
is part of the system state.
Okay?
So the ISA also defines the instructions
that you execute, that the CPU can
execute in the most basic level.
Think of that as very, very simple
instructions, things that do like, an add
or a subtraction or say, a load from
memory.
Okay that gets there from memory in to a
register as another example, of a, of an
instruction, okay?
And finally, the ISA also defines what
exactly happens when these instructions
are executed.
Because one, one of these, when one of
these basic instructions are executed, it
changes the state of your computer
system.
Okay?
So, and how this state Changes his
function of, also function of what the
ISA specifies.
Okay?
So here are the major decisions when
designing an ISA.
First of all, obviously, what
instructions are available like: add,
subtract, multiplication, floating point
operations and so on.
Okay?
And what do they do?
Exactly how they change the system state,
and also how they are encoded.
Because if you recall, when say you have
an add instruction in assembly, it
becomes some sequences of zeros and ones,
that's, that's what the computer actually
understands.
And encoding is actually this mapping
between the instruction in the ISA and
the actual bit sequence that determines
that instru-, that that encodes that
instruction.
So the ISA also tells how many registers
your computer has.
You know, how many, you know, explicit
units of storage you have inside your
processor.
Okay?
So how many you have available, and also,
how wide they are.
Right, for example, are they 32 bits, are
they 64 bits, or are they smaller, like
in case of a very simple processors and
so on.
Okay?
And finally, the ISA also defines
something very important, which is, how
do you specify a location in memory?
Okay?
So how do you specify an address in your
assembly code, or how in, in your
instructions?
Okay?
How do you tell instructions what
addresses they should be manipulating.
Okay?
It's also called you know, what are the
addressing modes supported.
Okay?
So let me write it here, addressing
modes.
The, all the ways that it can specify an
instructions in an address in your
program.
So now x86 is one type of ISA.
Okay?
so it's very, very popular.
Okay?
So that's and in fact it's so popular
that x86, which is, you, you probably
know, Intel Intel Corporation makes x86
processors, or processors that implement
x86 ISA.
And these processors completelly dominate
the server, desktop and laptop markets
for now.
And they actually had a very
revolutionary design.
You know, in fact if you have code
written 8086 all the way when it was
designed in 1978, in fact very close to
when I was born.
so code written for the 8086, still runs
in the most modern Intel x86 processors.
Since we had very, very, evolutionary
design, and more features were added as
time, as time went on.
An x86 ISA is something that we, is a
type of[UNKNOWN] that we call CISC which
stands for Complex Instruction Set
Computer.
Okay?
What that says is that the instructions,
the basic, the basic instructions
specified by the x86 ISA are very rich.
Okay?
They can do things like you know, move a,
move a string in memory.
They do things that are much more basic
than just a simple add or subtraction or
move a little bit of data here and there.
These things are much richer than that.
Okay?
So, and we call it CISC, that is a
Complex Instruction Set Computer.
As opposed to RISC, which stands for
Reduced Instruction Set Computers.
Okay?
A RISC machine has much fewer
instructions, and instructions are much
much simpler.
Okay?
So, in more advanced computer
architecture courses, you will see that
this has a lot of implications of how the
hardware itself is designed.
Okay?
But it's a little bit out of the scope of
this class to give you the details of why
whether an ISA being RISC or CISC how,
why and how it affects computer design.
So, le, let's look at some numbers here
just to, to give an idea of how amazing
this evolution was.
Okay?
So if you go back to 1978, when the 8086
was introduced.
That processor had 29,000 transistors,
and it ran on between five and ten MHz.
That's the cycle time of the processor,
between five and ten Million cycles per
second.
Okay?
At that time that was the first 16 bit
processor.
That means that the word size was 16 bits
or two bytes, and it was the basis for
the I, the IBM PC and DOS.
It really popularized personal computing.
That's a very very important processor.
And the total address space, a maximum
memory you could you could address was
one MB.
Can you imagine that?
It can't even hold a photograph.
[LAUGH] But and then another major step
was that the, the 386 that was introduced
in 19, seven years later in 1985.
And it had ten times as many transistors,
it ran about you know three times faster
in it's clock's frequency.
But it was significant for a number of
things.
Okay?
It was the first 32-bit microprocessor.
Okay?
It was referred to as the IA-32.
you had a flat addressing mode.
In that, it didn't have to divide the
me-, the, the memory into regions called
segments and addressed them individually.
You had a single address that could point
anywhere in memory.
So, that made the process of managing
memory and accessing memory much, much
simpler.
Okay?
So, and this machine is also capable of,
capable of running an operating system
called Unix.
Which is very similar to what we call
Linux today.
Okay?
And so it's very similar, Linux is a type
of Unix Operating system.
Okay?
And and today, a 32 bit Linux GCC
targets, targets the 386 by default.
So the 386 are very, very important
architecture as well.
Now let's jump 20 years later and look at
what happened.
Now with the Pentium 4, when, when it was
introduced in 2005, had 230 million
instructions.
We're talking about a 10,000, 10,000 fold
increase in the number of transistors.
Okay?
And, you know?
A sim-, in about, about a a huge increase
in, in frequency as well.
Okay?
And then the Pentium 4F was the first 64
bit processor as,as also introduced by
first 64 bit x86 processor, introduced by
Intel.
It's also referred to x86-64.
The AMD was actually involved in, in
defining what the x86-64 looks like,
which we're going to see in a second.
A little bit more history of Intel
processors, the 486 was introduced in
1989, was also a very important
processor.
Then there was a series of Pentium
processors that hit the that had a lot of
evolutions.
In-, including like around this time,
they were starting to worry about power
consumption as well.
So and then, it was a Core 2 Duo, you
know, which was a dual core processor.
A processor that had multiple multiple
compute cores in the same chip.
And then, more recently, we had the i7,
that for example, here we have a dipex.
It's a picture of the actual silicon of
the i7, and it has four cores.
It is essentially, you know, these are
exactly, each, each one of these boxes
here, okay.
Are each, each one of these boxes is a
processor, and you have four of them on a
chip, and they all share a bunch of cache
memory.
That we, we are going to see exactly what
that means in the later sections of this
class.
Okay?
So, and along this history, there are a
lot of other things that were introduced
along the way.
One was support for multimedia
operations.
Essentially, multimedia operation tends
to have a lot of fine grain pair at
instruction level, we called it vector
type of parellism.
So, in order to take advantage of that
Intel introducedt an exception the ISA
called SIMD.
Which stands for Single Instruction
Multiple Data, and that that's that
instruction actually operates in multiple
data items simultaneously.
So taking advantage parallels that the
application has.
Okay.
So and also, along this way like in this
ISA evolution, not only the ISA
architecture evolution.
There were instructions that were
introduced to do more efficient condition
operations.
Okay?
We'll see later, in this class, that
there are these instructions called
branches that changes the flow of
execution to the processor.
And these instructions can be very, very
expensive.
So in part of the innovation that happens
in this evolution of microprocessor was
to make some of that much cheaper.
And then, obviously, as I mentioned
before, there are lots of cores
introduced along the way.
Okay?
So if you're interested in learning more
about the specifics of of Intel's
architecture.
You can go to the automated relational
knowledge base great name.
that's available in Intel website.
And also you can look at the list of
Intel micro processors in Wikipedia,
which is great to get more information as
well.
But now, let's not forget about AMD, a
company called Advanced Micro Devices
that made clones of x86.
By clones it means other processors that
had completly different hardware, but
also implemented this same instructor set
of architecture.
That's one example of the beauty of
abstractions.
See it had the same abstraction call the
instruction, the instruction for that
architecture, the[INAUDIBLE] interface
was the same.
The implementation underneath doesn't
really affect the software as long as the
ISA stays this, the same.
And so AMD came up with completely
different hardware that implemented x86
ISA, and it had some advantage at first.
You know, they were a lot cheaper and
were a tiny bit slower but it made sense
in terms of, of, of price performance.
OKay.
Typically just followed behind Intel but
then AMD just got really, really
aggressive in terms of taking advantage
of new secret design techniques and they
designed very, very, very fast
processors.
And you know one great example is the AMD
Opteron which is really, really tough
competitor.
To the Pentium 4.
And AMD, was also instrumented, was also
instrumental in developing the x86-64.
Which is a 64 bit extension of uh,of the
x86 ISA, that later on actually became a
good part of what x86-64 looks today,
even for Intel processors.
It has really, really interesting you
know, quote, unquote collaboration
between two companies that are
essentially competitors.
Okay?
So now to to end this mod-, first module
of the section, just to tell, we are
going to cover now this section in, in
x86 program, which will be the, the
following section.
we are going to look at what's called
IA-32, which is the traditional 32 bit,
32 bit ISA.
And um,[INAUDIBLE] here, 32-bit[LAUGH] ,
32-bit ISA.
And then we're going to also talk about
the 64-bit version of the x86 ISA.
Okay?
And keep in mind that all lab
assignment's actually going to use
x86-64.
But in teaching you assembly programming,
it, it, it's going to be larger
transparent to you.
We you're going to know when it matters,
okay?
Thank you and see you soon.
Wyszukiwarka
Podobne podstrony:
czujnik asymetrii napięć?m 01 instrukcjaThe Complete Pentium Instruction Set Table (32 Bit Addressing Mode Only)AVR Instruction SetNokia X1 01 Instrukcja Obsługi PLprzekaznik bistabilny pbm 01$v instrukcjaczujnik kolejnosci?z ckh 01 instrukcjaTunika(01) instrukcja ENwylacznik zmierzchowy wzm 01 instrukcjaczujnik kolejnosci?z ckm 01 instrukcjaMC68HC11 Instruction Set Tableprzekaznik czasowy pcm 01 instrukcjawylacznik zmierzchowy wzh 01 instrukcjaautomat schodowy ash 01 instrukcjaogranicznik mocy pmm 01 instrukcjaIs 01 Instrukcja gospodarki odpadamiwskaznik zasilania lkm 01 instrukcjawięcej podobnych podstron