• 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. linereadstring() function problem

Stats

  • Locked Locked
  • Replies 6
  • Subscribers 143
  • Views 14878
  • 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

linereadstring() function problem

tyanata
tyanata over 14 years ago

 Hello,

I have such problem in my SKILL code. In one of the routines of it I create list of strings. And after that read them one by one and transform to symbols with the linereadstring()  function.

 

I have such a proble for example:

llinereadstring("x") 

returns  ->(x)

 

llinereadstring("X") 

returns  ->(X)

 

llinereadstring("9") 

returns  ->(9)

 

llinereadstring("X9") 

returns  ->(X9)

 

llinereadstring("9X") 

returns  ->

SYNTAX ERROR found at line 1 column 2 of file *string*
*Error* lineread/read: syntax error encountered in input

 

My question is how can I overcome this problem if some of the strings in the list is starting with digit and ends with letter as "9X" in the example above.

 

Best regards,

 

tyanata

 

 

 

 

 

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 14 years ago

    I modified the code - and added some comments - to show how to do this. The problem was that if you simply used the toggle field symbols as prompts, it expects the symbols to be legal names, which they aren't. This is easy to resolve - I also removed some of the less efficient parts of the code (see comments).

    Regards,

    Andrew

    procedure( Choose_skip_lib()

    let((lib_list l_libs l_fields_skip l_TField1_skip)
    ; Description
    ; Available project libraries: DIG, IO, ANA and 90123AATOP

    lib_list = list("DIG" "IO" "ANA" "90123AATOP")


    /*
    ; rather inefficient way of converting a list of strings to a list
    ; of symbols
    lib_list_length = length(lib_list)
    count_mem_list = 0
    l_libs=list()

    while( count_mem_list != lib_list_length

    lib_member = car(lib_list)
    lib_list = cdr(lib_list)

    lib_member_symbol=list(stringToSymbol(lib_member))
    l_libs=append1(l_libs lib_member_symbol)

    count_mem_list++
    ) ;; close while
    */

    ; Convert list of libraries to a list of symbols and strings. The symbol begins with
    ; tog_ so it has a legal name, and the second entry in the list is the prompt
    l_libs=foreach(mapcar libName lib_list
    list(concat('tog_ libName) libName)
    )

    l_fields_skip = list()

    l_TField1_skip = list( hiCreateToggleField(
    ?name 'TField1_skip
    ?prompt ""
    ?choices l_libs
    ?itemsPerRow 2
    ?value '(nil nil nil nil)
    ;?numSelect 6
    ?callback list("" "" "" "")
    ) 10:10 30:20 0)
    l_fields_skip=append1(l_fields_skip l_TField1_skip)


    hiCreateAppForm( ;create Form
    ?name 'SkipLibForm
    ?formTitle "Choose lybraries to be skipped"
    ?fields l_fields_skip
    ?buttonLayout 'OKCancel
    ?buttonDisabled '(Defaults Apply Help)

    ; ?initialSize '(560 630)
    ; ?initialSize t
    ?minSize '(300 120)
    ?callback 'CCSskip_lib_app_formApplyCB
    )

    ;----------------------------------------------------------------
    ; Record the list of libraries on the form (avoids a global variable)
    ;----------------------------------------------------------------
    SkipLibForm->lib_list=lib_list

    hiSetFormPosition( (xCoord(hiGetMaxScreenCoords())/2)-560/2 :
    (yCoord(hiGetMaxScreenCoords())/2)-200 )

    hiDisplayForm(SkipLibForm)

    )
    )


    procedure( CCSskip_lib_app_formApplyCB(form)
    let( (temp_lib_str_list skip_lib_final_string)

    ;--------------------------------------------------------------------
    ; Use setof with two lists - the first list is the names of the library
    ; to filter, whereas the second is the list of toggle values.
    ;--------------------------------------------------------------------
    temp_lib_str_list=setof((libName togField) form->lib_list form->TField1_skip->value togField)
    /*
    ; inefficient way of finding out the library names
    ;
    SkipLibForm_lib_op = SkipLibForm->TField1_skip->value
    SkipLibForm_lib_name_length = length(SkipLibForm_lib_name)
    count_mem_lib_name_list = 0
    temp_lib_str_list=list()
    while( count_mem_lib_name_list != SkipLibForm_lib_name_length

    t_key = car(SkipLibForm_lib_name)
    SkipLibForm_lib_name=cdr(SkipLibForm_lib_name)
    t_val = car(SkipLibForm_lib_op)
    SkipLibForm_lib_op = cdr(SkipLibForm_lib_op)
    t_key_i = car(t_key)
    if( t_val==t then
    temp_lib_str_list=append1(temp_lib_str_list t_key_i)
    )
    count_mem_lib_name_list++
    ) ;; close while
    */


    skip_lib_final_string = buildString(temp_lib_str_list)
    printf("List of libraries to be skipped:%s\n" skip_lib_final_string)

    ) ;let
    ) ;procedure

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 14 years ago

    I modified the code - and added some comments - to show how to do this. The problem was that if you simply used the toggle field symbols as prompts, it expects the symbols to be legal names, which they aren't. This is easy to resolve - I also removed some of the less efficient parts of the code (see comments).

    Regards,

    Andrew

    procedure( Choose_skip_lib()

    let((lib_list l_libs l_fields_skip l_TField1_skip)
    ; Description
    ; Available project libraries: DIG, IO, ANA and 90123AATOP

    lib_list = list("DIG" "IO" "ANA" "90123AATOP")


    /*
    ; rather inefficient way of converting a list of strings to a list
    ; of symbols
    lib_list_length = length(lib_list)
    count_mem_list = 0
    l_libs=list()

    while( count_mem_list != lib_list_length

    lib_member = car(lib_list)
    lib_list = cdr(lib_list)

    lib_member_symbol=list(stringToSymbol(lib_member))
    l_libs=append1(l_libs lib_member_symbol)

    count_mem_list++
    ) ;; close while
    */

    ; Convert list of libraries to a list of symbols and strings. The symbol begins with
    ; tog_ so it has a legal name, and the second entry in the list is the prompt
    l_libs=foreach(mapcar libName lib_list
    list(concat('tog_ libName) libName)
    )

    l_fields_skip = list()

    l_TField1_skip = list( hiCreateToggleField(
    ?name 'TField1_skip
    ?prompt ""
    ?choices l_libs
    ?itemsPerRow 2
    ?value '(nil nil nil nil)
    ;?numSelect 6
    ?callback list("" "" "" "")
    ) 10:10 30:20 0)
    l_fields_skip=append1(l_fields_skip l_TField1_skip)


    hiCreateAppForm( ;create Form
    ?name 'SkipLibForm
    ?formTitle "Choose lybraries to be skipped"
    ?fields l_fields_skip
    ?buttonLayout 'OKCancel
    ?buttonDisabled '(Defaults Apply Help)

    ; ?initialSize '(560 630)
    ; ?initialSize t
    ?minSize '(300 120)
    ?callback 'CCSskip_lib_app_formApplyCB
    )

    ;----------------------------------------------------------------
    ; Record the list of libraries on the form (avoids a global variable)
    ;----------------------------------------------------------------
    SkipLibForm->lib_list=lib_list

    hiSetFormPosition( (xCoord(hiGetMaxScreenCoords())/2)-560/2 :
    (yCoord(hiGetMaxScreenCoords())/2)-200 )

    hiDisplayForm(SkipLibForm)

    )
    )


    procedure( CCSskip_lib_app_formApplyCB(form)
    let( (temp_lib_str_list skip_lib_final_string)

    ;--------------------------------------------------------------------
    ; Use setof with two lists - the first list is the names of the library
    ; to filter, whereas the second is the list of toggle values.
    ;--------------------------------------------------------------------
    temp_lib_str_list=setof((libName togField) form->lib_list form->TField1_skip->value togField)
    /*
    ; inefficient way of finding out the library names
    ;
    SkipLibForm_lib_op = SkipLibForm->TField1_skip->value
    SkipLibForm_lib_name_length = length(SkipLibForm_lib_name)
    count_mem_lib_name_list = 0
    temp_lib_str_list=list()
    while( count_mem_lib_name_list != SkipLibForm_lib_name_length

    t_key = car(SkipLibForm_lib_name)
    SkipLibForm_lib_name=cdr(SkipLibForm_lib_name)
    t_val = car(SkipLibForm_lib_op)
    SkipLibForm_lib_op = cdr(SkipLibForm_lib_op)
    t_key_i = car(t_key)
    if( t_val==t then
    temp_lib_str_list=append1(temp_lib_str_list t_key_i)
    )
    count_mem_lib_name_list++
    ) ;; close while
    */


    skip_lib_final_string = buildString(temp_lib_str_list)
    printf("List of libraries to be skipped:%s\n" skip_lib_final_string)

    ) ;let
    ) ;procedure

     

    • 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