| Line 106... | 
        Line 106... | 
      
      
            ov += dv;
  | 
            ov += dv;
  | 
      
      
          if length > 0 and ov >= 2**length:
  | 
          if length > 0 and ov >= 2**length:
  | 
      
      
            raise SSBCCException('Paramter length and value don\'t match:  "%s"' % save_v);
  | 
            raise SSBCCException('Paramter length and value don\'t match:  "%s"' % save_v);
  | 
      
      
          return ov;
  | 
          return ov;
  | 
      
      
         
  | 
         
  | 
      
      
           | 
        def IsIntExpr(value):
  | 
      
      
           | 
          """
  | 
      
      
           | 
          Test the string to see if it is a well-formatted integer or multiplication of
  | 
      
      
           | 
          two integers.
  | 
      
      
           | 
          Allow underscores as per Verilog.
  | 
      
      
           | 
          """
  | 
      
      
           | 
          if re.match(r'[1-9][0-9_]*',value):
  | 
      
      
           | 
            return True;
  | 
      
      
           | 
          elif re.match(r'\([1-9][0-9_]*(\*[1-9][0-9_]*)+\)',value):
  | 
      
      
           | 
            return True;
  | 
      
      
           | 
          else:
  | 
      
      
           | 
            return False;
  | 
      
      
           | 
         
  | 
      
      
        def IsPosInt(v):
  | 
        def IsPosInt(v):
  | 
      
      
          """
  | 
          """
  | 
      
      
          Indicate whether or not the argument is a positive integer.
  | 
          Indicate whether or not the argument is a positive integer.
  | 
      
      
          """
  | 
          """
  | 
      
      
          return re.match(r'[1-9][0-9_]*$',v);
  | 
          return re.match(r'[1-9][0-9_]*$',v);
  | 
      
      
        | Line 149... | 
        Line 162... | 
      
      
              tmpLine = tmpLine[0:-1];
  | 
              tmpLine = tmpLine[0:-1];
  | 
      
      
            v.append((tmpLine,ixLine,));
  | 
            v.append((tmpLine,ixLine,));
  | 
      
      
          fp.close();
  | 
          fp.close();
  | 
      
      
          return v;
  | 
          return v;
  | 
      
      
         
  | 
         
  | 
      
      
           | 
        def ParseIntExpr(value):
  | 
      
      
           | 
          """
  | 
      
      
           | 
          Convert a string containing well-formatted integer or multiplication of two
  | 
      
      
           | 
          integers.
  | 
      
      
           | 
          Allow underscores as per Verilog.
  | 
      
      
           | 
          Note:  If this routine is called, then the value should have already been
  | 
      
      
           | 
                 verified to be a well-formatted integer string.
  | 
      
      
           | 
          """
  | 
      
      
           | 
          if not IsIntExpr(value):
  | 
      
      
           | 
            raise Exception('Program Bug -- shouldn\'t call with a badly formatted integer expression');
  | 
      
      
           | 
          return eval(re.sub('_','',value));
  | 
      
      
           | 
         
  | 
      
      
        ################################################################################
  | 
        ################################################################################
  | 
      
      
        #
  | 
        #
  | 
      
      
        # Unit test.
  | 
        # Unit test.
  | 
      
      
        #
  | 
        #
  | 
      
      
        ################################################################################
  | 
        ################################################################################
  |