Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 3:b11d25e57ddd
- Parent:
- 2:83422444c6e5
- Child:
- 4:050482cd9d95
--- a/main.cpp Sat Mar 02 23:16:18 2019 +0000
+++ b/main.cpp Wed Mar 06 15:38:30 2019 +0000
@@ -1,12 +1,15 @@
#include "mbed.h"
Timer t1;
-Timer t2;
+
#define Thumb_mult(d,s) __asm {\
MULS d,s;}
#define Thumb2_mult(d,m,s) __asm {\
- MULS d,m,s;}
-
+ MULS d,m,s;}
+#define Thumb_add(d,s) __asm {\
+ ADDS d,s;}
+#define Thumb2_add(d,n,s) __asm {\
+ ADDS d,n,s;}
int main() {
@@ -17,11 +20,32 @@
t1.start();
Thumb_mult(r1,r0);
t1.stop();
- printf("The time taken was %f milliseconds\n", t1.read()/1000);
- t2.start();
+ printf("the answer is %d\n", r1);
+ printf("The time taken for thumb mult was %f seconds\n", t1.read());
+
+ r1=0x3;
+ t1.start();
Thumb2_mult(r2,r1,r0);
- t2.stop();
- printf("The time taken was %f milliseconds\n", t2.read()/1000);
+ t1.stop();
+ printf("the answer is %d\n", r2);
+ printf("The time taken for thumb2 mult was %f seconds\n", t1.read());
+
+ printf("\n");
+ t1.start();
+ Thumb_add(r1,r0);
+ t1.stop();
+ printf("the answer is %d\n", r1);
+ printf("The time taken for thumb add was %f seconds\n", t1.read());
+
+ r1=0x3;
+ t1.start();
+ Thumb2_add(r2,r1,r0);
+ t1.stop();
+ printf("the answer is %d\n", r2);
+ printf("The time taken for thumb2 add was %f seconds\n", t1.read());
+
+
+