ECE 5465 group 6 / Mbed 2 deprecated Project_2

Dependencies:   mbed

Committer:
AkashGutha
Date:
Fri Mar 08 04:51:18 2019 +0000
Revision:
4:050482cd9d95
Parent:
3:b11d25e57ddd
ADD div

Who changed what in which revision?

UserRevisionLine numberNew contents of line
zonzon14 0:12c36bcf88f3 1 #include "mbed.h"
zonzon14 0:12c36bcf88f3 2
zonzon14 2:83422444c6e5 3 Timer t1;
zonzon14 3:b11d25e57ddd 4
zonzon14 2:83422444c6e5 5 #define Thumb_mult(d,s) __asm {\
zonzon14 2:83422444c6e5 6 MULS d,s;}
zonzon14 2:83422444c6e5 7 #define Thumb2_mult(d,m,s) __asm {\
zonzon14 3:b11d25e57ddd 8 MULS d,m,s;}
zonzon14 3:b11d25e57ddd 9 #define Thumb_add(d,s) __asm {\
zonzon14 3:b11d25e57ddd 10 ADDS d,s;}
zonzon14 3:b11d25e57ddd 11 #define Thumb2_add(d,n,s) __asm {\
zonzon14 3:b11d25e57ddd 12 ADDS d,n,s;}
AkashGutha 4:050482cd9d95 13 #define Thumb_div(d,s) __asm {\
AkashGutha 4:050482cd9d95 14 DIVS d,s;}
AkashGutha 4:050482cd9d95 15 #define Thumb2_div(d,n,s) __asm {\
AkashGutha 4:050482cd9d95 16 DIVS d,n,s;}
zonzon14 2:83422444c6e5 17
zonzon14 0:12c36bcf88f3 18
zonzon14 0:12c36bcf88f3 19 int main() {
zonzon14 2:83422444c6e5 20
zonzon14 2:83422444c6e5 21 register uint32_t r0= 0xA;
zonzon14 2:83422444c6e5 22 register uint32_t r1= 0x3;
zonzon14 2:83422444c6e5 23 register uint32_t r2= 0x0;
zonzon14 2:83422444c6e5 24 t1.start();
zonzon14 2:83422444c6e5 25 Thumb_mult(r1,r0);
zonzon14 2:83422444c6e5 26 t1.stop();
zonzon14 3:b11d25e57ddd 27 printf("the answer is %d\n", r1);
zonzon14 3:b11d25e57ddd 28 printf("The time taken for thumb mult was %f seconds\n", t1.read());
zonzon14 3:b11d25e57ddd 29
zonzon14 3:b11d25e57ddd 30 r1=0x3;
zonzon14 3:b11d25e57ddd 31 t1.start();
zonzon14 2:83422444c6e5 32 Thumb2_mult(r2,r1,r0);
zonzon14 3:b11d25e57ddd 33 t1.stop();
zonzon14 3:b11d25e57ddd 34 printf("the answer is %d\n", r2);
zonzon14 3:b11d25e57ddd 35 printf("The time taken for thumb2 mult was %f seconds\n", t1.read());
zonzon14 3:b11d25e57ddd 36
zonzon14 3:b11d25e57ddd 37 printf("\n");
zonzon14 3:b11d25e57ddd 38 t1.start();
zonzon14 3:b11d25e57ddd 39 Thumb_add(r1,r0);
zonzon14 3:b11d25e57ddd 40 t1.stop();
zonzon14 3:b11d25e57ddd 41 printf("the answer is %d\n", r1);
zonzon14 3:b11d25e57ddd 42 printf("The time taken for thumb add was %f seconds\n", t1.read());
zonzon14 3:b11d25e57ddd 43
zonzon14 3:b11d25e57ddd 44 r1=0x3;
zonzon14 3:b11d25e57ddd 45 t1.start();
zonzon14 3:b11d25e57ddd 46 Thumb2_add(r2,r1,r0);
zonzon14 3:b11d25e57ddd 47 t1.stop();
zonzon14 3:b11d25e57ddd 48 printf("the answer is %d\n", r2);
zonzon14 3:b11d25e57ddd 49 printf("The time taken for thumb2 add was %f seconds\n", t1.read());
zonzon14 3:b11d25e57ddd 50
AkashGutha 4:050482cd9d95 51 r1 = 0xA;
AkashGutha 4:050482cd9d95 52 printf("\n");
AkashGutha 4:050482cd9d95 53 t1.start();
AkashGutha 4:050482cd9d95 54 Thumb_div(r1,r0);
AkashGutha 4:050482cd9d95 55 t1.stop();
AkashGutha 4:050482cd9d95 56 printf("the answer is %d\n", r1);
AkashGutha 4:050482cd9d95 57 printf("The time taken for thumb div was %f seconds\n", t1.read());
zonzon14 2:83422444c6e5 58
AkashGutha 4:050482cd9d95 59 r1=0xA;
AkashGutha 4:050482cd9d95 60 printf("\n");
AkashGutha 4:050482cd9d95 61 t1.start();
AkashGutha 4:050482cd9d95 62 Thumb2_div(r2, r1,r0);
AkashGutha 4:050482cd9d95 63 t1.stop();
AkashGutha 4:050482cd9d95 64 printf("the answer is %d\n", r2);
AkashGutha 4:050482cd9d95 65 printf("The time taken for thumb2 div was %f seconds\n", t1.read());
zonzon14 0:12c36bcf88f3 66 }