ASIC/FPGA  Design and Verification Out Source Services 
                            SPECMAN Text to Integer Conversion Method
                            
                            - This doc explains a very simple SPECMAN method. The method gets a string as input. The string starts with VC and than some digits may follow. Later in the input string we expect the letter P followed by a number. This number is converted to an integer.
 
                            - As an exercise this method demonstrates work with lists and AWK style command from SPECMAN.
 
                            - Method execution flow description:Extract a list of digits from the string. Get the list size and for each digit, sum to the result.
 
                            
 
 text_to_int() : uint is {
   var Bmatch : bool = name ~ "/VC.*P([0-9]*)/";
   var Smatch : string = $1;
   var Umatch := Smatch.as_a(list of int);
   var Usize := Umatch.size()-1;
   var pwr : uint = 1;
   result=0;
   for each in Umatch do {
     result=result + (pwr*(Umatch[Usize-index]-48));
     pwr=pwr*10;
   };--for
 };--text_to_int
 
							
                             
                           Contact me now at: |