How can I calculate processing speed of microcontroller

I need a microcontroller that can process minimum 2mb data per second. How do I determine what processors will be able to do this?

Also how can I calculate the processing speed in per second of any microcontroller?

I am very much scared with my college project and I need help.

• When you say "process", do you mean the speed at which it can make calculations on data that's in-memory, or the speed at which it can read from and write to its inputs and outputs? – Ian Apr 8 '13 at 15:29
• I mean the reading and writing part to its input and output – Frank Apr 8 '13 at 15:44
• @Frank, it would make a huge difference if that is 2 mega-bytes (2MB) or 2 mega-bits (2Mb). Please edit your answer. – Shahbaz Apr 8 '13 at 16:13
• Frank, beside b standing for bit and B for byte, observe that m is used for milli (or, 1/1000) and M for mega (1000000). – James Waldby - jwpat7 Apr 8 '13 at 17:40
• @jwpat7: For correctness, I should point out that when talking about binary values (i.e., bytes), the M denotes $2^{20} = 1,048,576$ bytes. (More info: Megabyte and Kilobyte). – Ian Apr 9 '13 at 12:48

You need to consult the specifications. There is absolutely no other way unless you buy the micro, code it and run tests.

So first, you need to define what exactly processing means. Best way to do it is to write the program that does the processing, in assembly. Let's take a hypothetical program in a hypothetical assembly:

add R1, R1, 1
store portB, R1

First thing you need to know is how many cycles it takes the microcontroller to execute this code. Again, you need to consult the data sheet of the micro. Hypothetical numbers:

• Load takes 3 cycles
• Add takes 1 cycle
• Store takes 2 cycles
• Store to PortB adds 4 cycles overhead

So you would know that for each piece of data you read (hypothetically, 1 byte) you need 12 cycles to process them, assuming the micro is stupid enough to not use pipelines, prefetching of any sort etc.

If you read the specifications well, you will now get a good estimate of the speed of the micro for your task. In our hypothetical example, 1 byte per 12 cycles.

So to address your first question, how to know if the micro is good enough for your task, it's quite simple. You want X bytes of data per second so it takes 12X cycles to do that. All you need to know is how many cycles per second the micro runs (let's say Y). So if Y > 12X you're good.

Your second question is also simple to answer. You already have the speed in terms of "per cycle". To calculate the speed in terms of "per second", you just multiply the per-cycle speed by cycles/second of the microcontroller (again, found in the data sheet). In our hypothetical example:

speed (byte/cycle) = 1/12
speed (byte/second) = 1/12 * Y

Once you define your task, so it would be clear how heavy the computation is, probably higher grade students or even vendors would be able to help you pick up a suitable micro.