Hello, this is Dr. Miller, and this
is Episode twelve point eight of
Assembly today we're going
to talk about some changing modes
and then Tom instructions.
Thumbhole.
So we have a difference between our
mode and thumb mode, so in our
mode, each of our instructions are
thirty two bits wide or four bytes
and in thumb mode, we have
instructions that are only 16 bits
wide or two bytes.
So what is the benefit of thumbhole?
Well, one code is more compact, so
if you have eight bytes, I give it
to arm instructions are a good
fit for some instructions.
And then when we're fetching and
executing instructions, it's more
efficient and memory is slow.
And so basically, if you have
to load data in,
if you load the same amount of data,
you can get more instructions.
So if you have slow memory, then
that will make a difference.
And then the original thumb mode had
a limited instruction set, meaning
all in all, instructions could
be encoded using thumb mode
where a thumb to we have full
instruction encoding.
And so we have additional sort of
wide instructions in order to allow
the processor to accommodate
the fact that maybe an instruction
takes more space than you
would think.
So here's an example.
So if we look in here,
we can see that in the middle
it's showing the actual bytes that
are for our instruction.
So we got to move our five, our
zero, number five, and that's
E three a zero zero
zero zero five.
And that instruction is the same.
And this is just a dump is an object
dump, and so when we have
these two different instructions, so
in thumb mode, we can see that these
instructions are encoded using
less bytes. Right.
So we've got two bytes here, whereas
for each one of these instructions,
we've got four bytes.
Now, when we're going to change
modes, we can use a couple of
different instructions, so we've got
branch with linking exchange, branch
and exchange
and we'll talk about those in depth.
When we exchange the instructions
that if the address is odd,
then we're going to switch the thumb
mode and then thumb to
add the ability to have variable
with instructions, either two or
four bytes for our encoding.
So changing mode, so we've
got our two different instructions,
so we've got branch of Link Lincoln
Exchange, so exchange
is going to change the
instruction set and then the link is
going to set the link register.
And again, we can see that we have
things like conditions and wide
instructions.
We have a label and then where we
want to go
and then we have branch and
exchange.
And so this we're just going to
switch instruction sets and we'll go
from thumb to arm or from arm
to thumb.
Now I'm instructions.
So we do have the notion of having
unified assembly language or
UL, and this allows us to have
one syntax for any instruction
that's either arm or thumb.
And then if we have possible
different and multiple encodings,
we can use the W for wide
instructions or thirty two bits or
the end for narrow instructions.
And then if one of these is not
available and you try and do it,
it'll generate a compile time error.
So here's an example that we can see
we have the same instruction and
we will we have the same
function, but we have different
instructions. So we have maybe a
wide instruction versus a narrow
instruction. And they both do the
same thing
just depending on if you added the W
or not. And it would generate
the different encodings for
that.
And then when we talk about Thum,
there are two different
sets of registers that we care
about, and so that's the low
registers and the high registers
and so for a lot of instructions and
they only use the low registers,
but you can get access to the high
registers again using some of those
wide instructions.
So, for example, if we have ad with
Kerry, we can see down here
that it says or our media has to be
from zero to seven and then
our D and R and must both
be low registers.
And so that means that we can't use,
you know, higher registers in
that for that some instruction.
So today we talked about the mode
changing modes and then thum
instructions.
So in the future, we're going to
look at a film example and then
conditional execution.
So how many bytes are in
arm instructions?
Answers for bites and
how many bites are in thumb
instructions.
Two to four bites, again, we're we
can have variable with ones,
so if you have questions, you can
email me Middler, MJ at you
and Edu and you can find me on
Twitter at Milhouse there.