• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. Help needed in parsing file!!!!!

Stats

  • Locked Locked
  • Replies 11
  • Subscribers 143
  • Views 16646
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Help needed in parsing file!!!!!

Messi
Messi over 14 years ago

Hi,

    I am trying to parse a rule file and make into a table.My input file was like:

          ;RULE NO.  LAYER      TYPE       VALUE
               R1A,      POLY,      WIDTH,      0.6
               R1B,      POLY,      SPACE,      0.75
               R2A,      ACTIVE,    WIDTH,      1.5
               R2B,      ACTIVE,    SPACE,      0.75

 I was sucessful in parsing this and making into table using the following code:

               procedure( parseFile( ipFile )
                    let( ( index Table rulesFile value key line ruleLookup)
                      unless( ruleFile = infile( ipFile)
                      error( "Cannot open file %L for reading" ipFile)
                       ) ; unless
  
  
                Table = makeTable("myTable" nil)
                   rulesFile = infile( ipFile )
                  while( gets( line rulesFile )
                  index = parseString( line ",")
                  when(index
                   value = nil
          ;;Remove Headers of the rules file
                       unless(rexMatchp("RULE NO" car(index))
                        rexCompile("^ *")
                       key = rexReplace(car(index) "" 0)
                        foreach(col cdr(index)
                          col = buildString(parseString(col))
                           value = append1(value col))
                          when(key && value
                           Table[key] = value))
                           )
                          ) ;while file
                         close( rulesFile )
   
                   ;;Return values and arrange table
                  foreach(key sort(Table~>? 'alphalessp)
                      printf("%s:  " key)
                        foreach(col Table[key]
                        printf("%-15s " col))
                       printf("\n")
                         )
                      Table
                      ) ;let
                ) ;procedure

But if i modify my input file as:

             ;RULE NO.     LAYER/LAYERS      PURPOSE  MIN.VALUE    COMMENTS
                 R1A,          POLY,                     WIDTH,          0.5
                 R1B,          POLY/ACTIVE,      SPACING,         0.25        ;spacing btn POLY and ACTIVE
                 R1C,          POLY:PIN,                WIDTH,          0.5         ;                "
                 R2A,          ACTIVE,                    WIDTH,          0.5         ; 
                 R2B,          ACTIVE,                 SPACING,         0.25
                 R3A,          MET1:PIN,                 WIDTH,          0.5
                 R3B,          MET1/POLY,           SPACING,         0.3

 What changes i need to make in my earlier code so that it checks the layers instead of a single layer and parse them and put in list?? ie in the Table the layers section should have both the layers specified in rulefile after parsing them(eg: (POLY ACTIVE) in layer section for R1B...

Also i want to know how to ignore the COMMENTS section present in the input file.If anyone in the forum find solution for it,please help me out....

Thanks,

Messi

  • Cancel
Parents
  • Messi
    Messi over 14 years ago

    Hi,

      thanks as per expert help i have modified my code as:

     

              
    procedure( parseFile( ipFile )
      let( ( index Table rulesFile value key line ruleLookup)
       unless( ruleFile = infile( ipFile)
          error( "Cannot open file %L for reading" ipFile)
          ) ; unless
     
     
        Table = makeTable("DRC_Table" nil)
        rulesFile = infile( ipFile )
        while( gets( line rulesFile )
          index = parseString( line ",")
      ;; To process two layers:
         i         =   setof(x parseString(line "/" equal(length(x)  5)
         index  =  appendl(list(cadr(x) caddr(x)) line)
         ipin    =   setof(y parseString(line ":" equal(length(y)  5)
         index  =  append1(list(cadr(y) caddr(y)) line)   
          when(index
            value = nil
     ;;Remove Headers of the rules file
            unless(rexMatchp("RULE NO" car(index))
            rexCompile("^ *")
              key = rexReplace(car(index) "" 0)
              foreach(col cdr(index)
                  col = buildString(parseString(col))
                  value = append1(value col))
          
                   )
           when(key && value
                  Table[key] = value)
             )
          ) ;while file
        close( rulesFile )
        

     ;;Return values and arrange table
        foreach(key sort(Table~>? 'alphalessp)
            printf("%s:  " key)
            foreach(col Table[key]
                printf("%-15s " col))
                printf("\n")
              )
             Table
       ) ;let
    ) ;procedure

    But i am not able to get the output,modified part is shown in bold font.If anyone can debug the error please help.

     Thanks,

    Messi
     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Messi
    Messi over 14 years ago

    Hi,

      thanks as per expert help i have modified my code as:

     

              
    procedure( parseFile( ipFile )
      let( ( index Table rulesFile value key line ruleLookup)
       unless( ruleFile = infile( ipFile)
          error( "Cannot open file %L for reading" ipFile)
          ) ; unless
     
     
        Table = makeTable("DRC_Table" nil)
        rulesFile = infile( ipFile )
        while( gets( line rulesFile )
          index = parseString( line ",")
      ;; To process two layers:
         i         =   setof(x parseString(line "/" equal(length(x)  5)
         index  =  appendl(list(cadr(x) caddr(x)) line)
         ipin    =   setof(y parseString(line ":" equal(length(y)  5)
         index  =  append1(list(cadr(y) caddr(y)) line)   
          when(index
            value = nil
     ;;Remove Headers of the rules file
            unless(rexMatchp("RULE NO" car(index))
            rexCompile("^ *")
              key = rexReplace(car(index) "" 0)
              foreach(col cdr(index)
                  col = buildString(parseString(col))
                  value = append1(value col))
          
                   )
           when(key && value
                  Table[key] = value)
             )
          ) ;while file
        close( rulesFile )
        

     ;;Return values and arrange table
        foreach(key sort(Table~>? 'alphalessp)
            printf("%s:  " key)
            foreach(col Table[key]
                printf("%-15s " col))
                printf("\n")
              )
             Table
       ) ;let
    ) ;procedure

    But i am not able to get the output,modified part is shown in bold font.If anyone can debug the error please help.

     Thanks,

    Messi
     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information