# How to evaluate the energy of an arithmetic operation

1. ## How to evaluate the energy of an arithmetic operation

Hi,

I have an ALU described in SV, with the corresponding Testbench that takes some input vectors, feeds them into the ALU, gets the result and then compares with the expected result.

The Testbench dumps a VCD file that, combined with the gate-level netlist, is fed to PrimeTime for time_based and average power evaluation. And I get the power waveform showing how the power varies in time. The Waveform is in FSDB format, and I can visualize it using the Synopsys Verdi tool.

Now, what I would like to do, is for each particular instruction (say addition, multiplication ...) in the testbench I would like to estimate the amount of energy spent. Since, some operations like addition would take only one cycle, but others (like sqrt/div) are iterative and they take more cycles. So I guess reasoning about energy per operation would be a more meaningful metric, say to compare the energy effeciency of several ALU architectures for example. (Am I right ?)

So my question is, is there any standard/usual/easy way to do this process?
I thought actually about coding a whole Python tool that would go throught the power waveform and integrate over time for each instruction. It could take a lot of time to build and test it. Any recommendations about that?
Is it possible to do this kind of stuff in Verdi itself? Or is PrimeTime capable of outputting the Energy values instead of time_based power?

•

2. ## Re: How to evaluate the energy of an arithmetic operation

The power report of PrimeTimePX does give us the average power consumption of a circuit. You can multiply the reported power by the total simulation time to get the amount of energy consumed by each function.

Let's say you have 7 different functions. You can write 7 different testbenches, each one tests for a single function of your circuit. They should have different simulation time (e.g. 1st function 1 cycle, 2nd function 2 cycles etc.); and you can have PrimeTimePX to report power for each simulation waveform.

•

3. ## Re: How to evaluate the energy of an arithmetic operation

Originally Posted by kungchuking
Let's say you have 7 different functions. You can write 7 different testbenches, each one tests for a single function of your circuit.
I agree that having different testbenches for each use case is the simplest way to go.

•