How Can I automate choices in a Calibre xRC flow ?

Document created by rick_sedlak on Nov 2, 2012Last modified by rick_sedlak on Aug 23, 2014
Version 4Show Document
  • View in full screen mode

Automating choices in a PEX flow can be accomplished through several means.


One method is to put placeholders in the ruledeck that you adjust through a set of values

across several PEX runs using a scripting language of your choice, e.g. csh, bash, tcl, perl, etc.


Another method of running a PEX flow across several cells in an automated manner is by using the

unix "sed" command to change a placeholder cellname in the rules for the desired primary cell name.


  sed "s/placeholder_layout_primary_cellname/target_cellname_1/g"  rules.reference > rules.temp1


  sed "s/placeholder_source_primary_cellname/target_cellname_1/g"  rules.temp1 > rules



In the rules.reference file:


    LAYOUT PRIMARY "placeholder_layout_primary_cellname"  .  .  . 
    SOURCE PRIMARY "placeholder_source_primary_cellname"  .  .  . 



Another method of controlling a PEX flow through a set of several choice is by using a combination

of environment variables and rulefile pre-processor directive IFDEFs to influence the desired rulefile settings.


If you run the extraction flow directly from a c-shell, you
could set an environment variable using arguments to the run script


    setenv $1 $2


This environment variable can be used to control several
choices of EXCLUDE statements in the rules file


Your run script could look like this:


------------------
run_xrc
--------------------------------------------------
#!/bin/csh -f

 

 

setenv MGC_HOME <path-to-calibre-product-tree>
setenv PATH $MGC_HOME/bin:$PATH

# clear the svdb and log files
/bin/rm -rf *svd* *SVD* *log


setenv $1 $2

calibre -xrc -phdb                 xrc.rule >&! phdb.log
calibre -xrc -pdb -rcc -select xrc.rule >&! pdb.log
calibre -xrc -fmt -all              xrc.rule >&! fmt.log
--------------------------------------------------

where you could invoke the run script with:

      run_xrc ISET 1
or   run_xrc ISET 2
or   run_xrc ISET 3


Since the IFDEF constructs have the form:
(from chapter 1 of the SVRF manual available at
  $MGC_HOME/shared/pdfdocs/svrf_ur.pdf  )

    Conditionals have the following form:

    { #IFDEF name [value] rule_file_text |
      #IFNDEF name [value] rule_file_text }
        [ #ELSE rule_file_text ]
      #ENDIF

    where name is a replaceable string that is defined
    with the #DEFINE directive, or implicitly defined
    from the shell environment. The value is an optional
    string that appears in a #DEFINE directive, or it is
    the value that name is assigned in the shell environment.
    #IFDEF (acronym for ?if defined?) and #IFNDEF (?if not defined?)
    test whether or not a name is defined, and do the
    opposite of the other. #ELSE statements are executed
    if the preceding #IFDEF or #IFNDEF
    conditionals evaluate to ?false?.


Your rule file could have sections like this:


    #IFDEF $ISET 1

        // Include set 1
        PEX EXTRACT INCLUDE  net100 net101 ...

    #ENDIF


    #IFDEF $ISET 2

        // Include set 2
        PEX EXTRACT INCLUDE  net200 net201 ...

    #ENDIF


    #IFDEF $ISET 3

        // Include set 3
        PEX EXTRACT INCLUDE  net300 net301 ...

    #ENDIF


And you don't have to work this through runscript arguments...

You could query the user for a response instead of
working this through the runscript arguments:


You could use some user choice code like this
to set an environment variable to a chosen value


This block of code is switched into play by the
environment variable called RUNTYPE set to "pex"


if(($RUNTYPE == "pex") || ($RUNTYPE == "PEX")) then
   echo " "
   echo "Which set of nets do you want to exclude? "
   echo " "
   echo "     if set A then enter: A"
   echo "     if set B then enter: B"
   echo " "
   echo " Your entry: "
   set mychosenset = $<
   switch ($mychosenset)
      case a:
      case A:
              setenv ISET A
      breaksw

      case b:
      case B:
              setenv ISET B
      breaksw

      default:
      breaksw
   endsw
endif


And the rulefile would need IFDEF sections defined
similar to those mentioned above.

 

 

 

 

Attachments

    Outcomes