13 hours 15 minutes
Hello. This is Dr Miller in this episode 12.3 of Assembly.
Today we're gonna talk about vector floating point, the FP and neon on arm.
So floating point.
So in arm, we have the V, f p or Vector floating point. And this was traditionally a separate co processor.
It was on arm versions prior to version eight,
and then we also have traditional V FP and neon instructions that both provide together both single and double precision floating point operations.
So they provide the ability that an arm processor can do floating point.
So for floating point instructions,
we have the FP versus neon. So both V FP and neon are optional extensions to the are marked pictures. So whoever the manufacturers, if it's apple or if it's a raspberry pi, they get to decide what optional extensions they want to add to arm. And so Neon adds some new instructions that VFW didn't have.
And so what we end up with is traditionally will have a mixed mode operation on sort of newer processes, so we'll have some instructions that are VfB. Only some instructions are mixed, and then some instructions are
And then when you're using a device, you'll need to review the armed documentation and the processor version to see what types of instructions you can use on your processor.
So, for example, the raspberry pi uses V F P version for which has both, um, neon and VF p instructions. Together,
we've added that to our compiler options allow we weaken compile code for it.
So here's an example. So we have,
um, pie, which is a floating point number 3.1415
and so we can load that address into our zero. So LD r R zero, The address of pie.
copy the data from our zero into R two and R three, and then we can do a floating point moves. So if the move into s zero or were loading a floating point number from our too, So use r two and r three,
and so we look at that in the code we can see that are too gets this value are three gets this value and then if we look at the data at that location, we can see that those two pieces of data match
and then we go in print dollars Sinus zero. We can see that s zero is 3.1415
So we have additional operations that we can do. We can do things like we can add two numbers, So v ad. So we're doing a vector ad, and then we're saying we want to do a floating 20.32 bit number. So we'll take
X and Y, and we'll add them together and store them in D for the destination.
Or we could take X and Y and we can subtract them. We can do multiplication and weaken do division.
And you have to look at the arm documentation To understand the different types of operations that you're gonna do.
We can have sort of more complicated. So we got, negate and multiply. So you take the two together, multiply, um, together, multiply by negative one, and then store that result in SD or weaken do an absolute value.
Um, or we can do multiple and accumulate. So the destination would be the destination plus S x times s y. And so we can do again all of that in floating point,
the M for multiply and accumulate operation
We can also take and convert from single precision to double precision.
And so that's the V convert so we can do V convert again. We see a conditional it's optional conditional code,
and then we can save it into a double precision register or a single position register if we're going up or down.
So here we're going from a 32 bit register to a 64 bit register, and here we're going from a 64 bit registered to a 32 bit register.
So you just have to look up the right one so that you can get the right conversion and the right source and destination
and so we can see here.
We can take our big, which is afloat, and it's got 1000
and so we can again load that address. We can use LD R D to load
those into r two and r three, and then we can move a 32 bit number from our two into s to which is again. You have these of the move command
and then we can convert that floating point number of S two from a a 32 bit into a 64 bit so floating 32 bit, two floating 64 bit.
And then when we look at the one, we can see that it has floating 10.64 bit. Number
I'm sorry. One million.
So here's another example. So we can go ahead and we have pie and we have our big number
so we can load up. I convert that to a 64 bit number in D zero
and then we can load up big, right? So again, same thing that we did before Convert that into a 64 bit number and then we can do V mole floating 640.64 bit and we can multiply d zero times d one store the result in D two.
So here we can see d zero is pi d one is a 1,000,000 we multiply them together and get our result in d two.
And so this I just said a break point and then trace through it using Giff and GTB so that I could look at the values instead of having to necessarily print them off. So the examples very concise.
So today we talked about some V f p and then yon floating point instructions and how they're kind of Inter mixed together, especially in the arm documentation.
So looking forward will give an example using Floating Point and we'll look at S I m d. And then in the future we'll talk about some mode and conditional execution.
So here's our quiz. How would we convert a floating point? 32 bit to 64 bit number
so we can convert
We're going to convert to a 60 64 bit number from a 32 bit number.
We got our 32 bit register in our 64 bit register.
If you have questions, you can email me Miller, MJ at you and Kate at Utd. You and you can find me on Twitter at Milhouse 30.
How to Use GDB (BSWJ)
The GNU Debugger (GDB) is one of the most commonly-used debugging tools in the world. ...
Certificate of Completion Offered
How to Use IDA (BSWJ)
The IDA is used throughout the IT and cybersecurity industries by exploit developers, vulnerability analysts, ...
Certificate of Completion Offered