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
main.cpp@2:83422444c6e5, 2019-03-02 (annotated)
- Committer:
- zonzon14
- Date:
- Sat Mar 02 23:16:18 2019 +0000
- Revision:
- 2:83422444c6e5
- Parent:
- 1:4c0da981b35e
- Child:
- 3:b11d25e57ddd
code for project 2. Compiles but not sure if it works
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
zonzon14 | 0:12c36bcf88f3 | 1 | #include "mbed.h" |
zonzon14 | 0:12c36bcf88f3 | 2 | |
zonzon14 | 2:83422444c6e5 | 3 | Timer t1; |
zonzon14 | 2:83422444c6e5 | 4 | Timer t2; |
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 | 2:83422444c6e5 | 8 | MULS d,m,s;} |
zonzon14 | 2:83422444c6e5 | 9 | |
zonzon14 | 2:83422444c6e5 | 10 | |
zonzon14 | 0:12c36bcf88f3 | 11 | |
zonzon14 | 0:12c36bcf88f3 | 12 | int main() { |
zonzon14 | 2:83422444c6e5 | 13 | |
zonzon14 | 2:83422444c6e5 | 14 | register uint32_t r0= 0xA; |
zonzon14 | 2:83422444c6e5 | 15 | register uint32_t r1= 0x3; |
zonzon14 | 2:83422444c6e5 | 16 | register uint32_t r2= 0x0; |
zonzon14 | 2:83422444c6e5 | 17 | t1.start(); |
zonzon14 | 2:83422444c6e5 | 18 | Thumb_mult(r1,r0); |
zonzon14 | 2:83422444c6e5 | 19 | t1.stop(); |
zonzon14 | 2:83422444c6e5 | 20 | printf("The time taken was %f milliseconds\n", t1.read()/1000); |
zonzon14 | 2:83422444c6e5 | 21 | t2.start(); |
zonzon14 | 2:83422444c6e5 | 22 | Thumb2_mult(r2,r1,r0); |
zonzon14 | 2:83422444c6e5 | 23 | t2.stop(); |
zonzon14 | 2:83422444c6e5 | 24 | printf("The time taken was %f milliseconds\n", t2.read()/1000); |
zonzon14 | 2:83422444c6e5 | 25 | |
zonzon14 | 2:83422444c6e5 | 26 | |
zonzon14 | 2:83422444c6e5 | 27 | |
zonzon14 | 0:12c36bcf88f3 | 28 | } |