Hello, this is Dr. Miller, and this
is Episode twelve point six of
Assembly.
Today, we're going to talk about
ACMD and we're going to talk about
processing data,
so processing data.
So we'll give a
we'll give a few examples here, so
we got our Victor Pairwise maximum
and Victor Paraguay's minimum.
So we'll look at these and examples
so we can either do a pair
of wise men or Max.
So that's the operation that we can
do and then we can have a particular
condition again.
And then the data type either signed
eight, 16, 32 or unsigned
eight, 16 thirty two,
or this can be on of thirty two bit
floating point number.
And then we'll have three registers,
our destination, our antonym,
which are our two sources
that we're going to use for the
example.
So here we load into our zero
sum data, so I got
zero one one zero
zero two two zero and
then we got all zero
FS in our one.
So I take our zero and say both of
them to zero and one,
so that's the bottom half of
the bottom in the top of the row
and then our one goes
into two and three.
So those are the two parts of D one.
Right. And then we're going to do
VMAX you eight.
So we're doing unsigned eight
bit pieces of
data and we got our two sources
and then our destination.
And you can, you can see when you
look at this, I got D zero and D one
and I, I filled
them out so that they're all the
same, so it's easier to see so we
can see what it does is it takes,
it looks at zero and D one and
then it does a maximum
on each one of these.
So the max between 20
and F.
Is 20, and so that's
the result that we get and the
maximum between two and F
is F, the maximum
between 10 and F is F and the
maximum two one and F is F
sorry, one.
Yeah.
And then we can see here we again do
20 and F and we get 20
and then zero
to.
And F we get F in 10
and F we get 10 and one, and F
we get F, all right.
So went down the line and for each
one of these, it calculated which of
these was the maximum
using an unsigned number.
And so we don't have negative
numbers.
If we did right then
we would get a different result if
we had that same bit set.
So we had anything
from A through F as the first digit,
then we would have had negative
numbers for some of those.
We can also do addition on multiple
elements at once, so we've got
Vector Add or Vaid,
again, we have a condition and then
we have some data type so we can
either operate on eight, 16, 30
to sixty four or floating
thirty two bit numbers,
and then we can either operate on
the cue registers or we can operate
on the D registers.
So here we go ahead and we're going
to load up here is desirable
and then here is the one, and
then we do Vaid on both of those
to get the result.
So it goes down the line and adds
one to 60, get sixty one one
to fifty, get fifty one one to
forty, get forty one.
So on down the line each one gets
added in its own column and then
that result is stored in D two,
which was the destination that we
chose here.
So here we're able to add eight
distinct numbers all at the same
time with one instruction.
And if you think about if we were
going to do this one bit at a time,
then we would end up having at least
eight instructions to do each
additional add on each
one of those bytes.
So here we can actually do even
two things at once, right, so we can
multiply by a scalar and then do an
accumulate, so you multiply
the end times DMX.
So we'll see that here.
And a little bit you multiply those
two together, you store it and then
add it to whatever is in
the destination.
So we got our data type integer 16
or 32, floating point thirty two.
We got our destination and our.
Yeah, our destination register there
and then we've got the scaler that
we want to do.
Sorry, we've got our destination and
then our source of the
operation that we're going to need
to multiply.
So here again, we can see loading
these aero D1 d2.
So if we kind of look down the line,
we have DRL
has one, two, three, four,
and what we're going to do is we're
going to multiply by zero.
The third element and third,
starting this is zero one,
two and three.
So I've underlined it. So we're
going to multiply by four.
So we're going to take every element
of the one. We're going to multiply
it by four and then add it to what's
in D2.
So D2 had a
zero zero zero B zero
zero zero six zero zero zero
zero zero zero.
Right. And so we're going to take
four times three.
That gives us 12.
Add that to a zero.
We get a C, so
12 and hex is C,
four times five is 20.
Add that to the B zero.
We get 20 and Hexis
14.
Four times seven is
twenty eight.
So that's one C add that to C
with the zeros and then
four times nine is twenty
four in hex and then
add that to the D so you can see
that it was able to do this
multiplication and then add
it to the accumulated
register inside of D two.
So we are able here to do
four operations
for multiply and then four
additions, all with one instruction
which was a lot more
useful. Right here we have
a total of two, four,
six, seven instructions, but we did
eight things
with just seven instructions.
Another example is Victor
exclusive or so
your as it's called.
So we can do exclusive or we got
our destination register and then
our two sources, Q And in QM
or down
and D.M.
Right. And so we're going to use
those when we do the
exclusive or operation.
So here we go ahead and
we load in some data, so we'll just
look at the data before and after
and see how that works.
So if we load in some
data with these zero
and one.
So this has five three six five.
Right. And this is six one six F
so on and so forth.
If we exclusive all of them
together.
Right. You can expand all those
bits. And so if you take five, three
and six on an exclusive or
them together you get thirty two.
Same thing here. Right.
So you go through and we'll store
that result in this register.
So then what I did is I showed that
if we take D one and
two and we exclusive or those
together store that and three
noticed that if I take these two
that are result
here is the same as D
zero.
So the exclusive war is
an irreversible process.
So if we exclusive or
two pieces of data that were in
part of this, we'll get the third
piece out.
And so one of the things
that we'll do in our example next
time is we're going to do an
encryption example.
And so almost every piece of
encryption uses exclusive or
in some form or fashion.
So what you end up doing is
you generate a set of bytes
that you want to use as your
encryption key and then
you exclusive of them with your
original plaintext to
get your encrypted text and
then to get your original text out.
You again take the key and
exclusive or it with the encrypted
text and you end up with your plain
text again.
And so that's what we'll be doing in
the next song when we do our
example.
So today, we gave some
examples of some ACMD
instructions that allowed us to do
some processing on data.
In the future, we'll give an example
that encryption, an example of ACMD,
we'll talk about some code and then
conditional execution.
So quiz, how does Samed
create faster performance?
So it allows us to possible multiple
pieces of data with one instruction.
If you have questions, you can email
me, Milham, you and Kidada, you
and you find me on Twitter, Atenolol
30.