Email: bknpk@hotmail.com Phone: +972-54-7649119
V

 

ASIC/FPGA Design and Verification Out Source Services

A simple script to calculate the percent of failing number of tests from the total and rounding up the results.

  1. In many occasions one needs to calculate the percentage of some results. In my case it was the percentage of failing tests from the total number of test.

  2. This page shows just part of the script. The constants and the mathematics to calculate the results and round up operation.
    1. ...
    2. cnt_del="5"
    3. cnt_prg="10"
    4. cnt_per="1000"
    5. cnt_ok="0"
    6. cnt_ko="0"
    7. ...
    8. #* 1000 to get higher precision
    9. per=$(($cnt_ko * $cnt_per)) #*1000
    10. per=$(($per / $cnt_tot))    #percent * 10
    11. per=$(($per + $cnt_del))    #round up by adding 5
    12. per=$(($per / $cnt_prg))    #result %
    13. echo "number of total tests "$cnt_tot" ok tests "${cnt_ok}" ko tests "${cnt_ko}" "$per" %" >> reg_res.txt

    Note: if the file, which stres the results (reg_res.txt), needs to have a uniqe name, one can add the process ID to the file name.
    1. fp="reg_res_"$$".txt"
    2. echo "number of total tests "$cnt_tot" ok tests "${cnt_ok}" ko tests "${cnt_ko}" "$per" %" >> $fp


  3. If the results need to be in hexadecimal, the following command can be used:
    printf '%02x\n' 12
    The opposite is also true (from hexadecimal to decimal):
    printf '%d\n' 0x23.

  ...


Home

Creating and usage example of dependency files in gcc / g++ compiler


... scoreboard, implemented in c++ using queues.


Download Area






Search This Site


Feedback This Site




new pages on this site