Module 3_DMIPS ECEN 5803 Project 1 Submitted by 1. Rahul Yamasani 2. Srivishnuj Alvakonda
Fork of Dhrystone by
Diff: main.cpp
- Revision:
- 0:f96b0b385ec4
- Child:
- 1:a4840e30d4a9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Jun 13 18:30:37 2014 +0000 @@ -0,0 +1,31 @@ +#include "mbed.h" +#include "dhry.h" + +DigitalOut myled(LED1); +Timer timer; +Serial pc(USBTX, USBRX); //serial channel over HDK USB interface + +int main() { + double benchtime, dps; + unsigned long loops; + + pc.baud(9600); + printf("Dhrystone Benchmark Program C/1 12/01/84\r\n"); + timer.start(); + while(1) { + loops = 0l; + myled = 1; + timer.reset(); + do { + Proc0(); + loops += LOOPS; + benchtime = timer.read(); + } while (benchtime <= 60.000); + myled = 0; + dps = (double)loops / benchtime; + printf("Dhrystone time for %ld passes = %.3f sek\r\n", loops, benchtime); + printf("This machine benchmarks at %.0f dhrystones/second\r\n", dps); + + wait(1.0); + } +}