Showing posts with label PERL in VLSI. Show all posts
Showing posts with label PERL in VLSI. Show all posts

1/11/2022

Data Structure in PERL : Associative Array and Reference


In this article, we explored data structures in PERL, focusing on  Associative Arrays/Hashes. We began with an overview of Hashes, highlighting their unique characteristics and differences from traditional arrays. Next, we demonstrated how to create and initialize Hashes with key-value pairs, as well as methods to access and manipulate their keys and values efficiently. We covered Hash functions with practical examples and techniques for converting between arrays and Hashes, offering flexibility in data organization. References were introduced, showcasing the backslash operator and `ref` function for creating references, along with real-world examples of their significance. Building on this, we discussed de-referencing, emphasizing arrow notation for navigating and manipulating Hashes. Finally, we explored unnamed Hashes, demonstrating their creation and usage to expand data manipulation possibilities. This episode equips you with practical knowledge to effectively use Hashes and references in PERL.

In previous article we have discussed about the Array . Now , in this article we will cover the Linked List or the HASH-Table i.e Associative Array in PERL.



Associative Array / Hash in PERL :

  • An associative array(hash) is an array of scalar values associated with the subscripts/index that are not 0, 1, 2, 3 ... 
  • Rather subscripts/index are any scalar values with no particular order. 
  • These subscripts are called "keys". Corresponding array elements are called "values".
  • A "value" is mapped to its corresponding "key".
  • Thus a hash is a table of uniquely mapped key-value pairs. Generically it is called as hash table or hash.
  • Hash variables always start with % (percent) symbol.

Creation of an Associative Array  :

The HASH can be created in below ways :-

1. Entire hash variables(key&value) are referenced using the “%” ;

my %hash = ("name", "Billy",

"age", 21 ,

"occupation", "student"

);

my %hash = ("name" => "Billy",

"age" => 21,

"occupation" => "student"

);

2. Individual hash variables (scalars) are mapped using $name{key} = value ;

$hash{"name"}= "Billy" ; # note we are using { } and not using  [ ]

$hash{"age"} = 21;

$hash{"occupation"} = "student";


Accessing Hash Key/Value after Hash Creation :

The key-value pair can be access in below ways :-

1. When you know the key :

print "$hash{"name"}"; #prints Billy

print "$hash{"age"}"; #prints 21;

print "$hash{"occupation"}"; # Prints student

2. When you do not know the keys:

my @arr = keys(%hash); #returns list of keys

foreach my $key (@arr) {

     print “Key = $key has Value = $hash{$key}\n”;

}

3. Get the Key Value pair at once using each function :

while (($key,$value) = each(%hash)) {

   print “Key = $key has Value = $value \n”;

}

Associative Array / Hash Functions :

There are few functions are there to operate exclusively on HASH :

  • keys - returns a list of the keys
  • my @keyArr = keys(%hash);
  • values - returns a list of the values
  • my @valArr = values(%hash);
  • each - returns a (key, value) pair in sequence
  • delete - removes a key-value pair from a hash
  • delete $hash{"key1"} ; 
  • %b = %a; # copies hash into other
  • %a = reverse %b; # swap keys and values, values should be unique

Array and Hash : Mutual Conversions

We can mutually convert the array and hash in to each other as :-

  • my @arr = %hash; # converts a hash into a array
  • # Not necessarily in that order, but always with keys
  • # and values paired adjacently
  • my %newHash = @arr; # converts array back to a hash
  • my %arr = ("key1", val1 ,"key2", val1, "key3", val3); # creates a hash from list
  • my @arr{"key1","key2","key3"} = (val1,val2,val3); # same thing

References in PERL :

  • PERL allows you have "hard" references to any piece of data or code.
  • Any scalar may hold a hard reference. 
  • Arrays and hashes contain scalars.
  • Hence one can now easily build nested data structures as :
  • arrays of arrays, arrays of hashes , hashes of arrays, arrays of hashes of functions, and many other combinations..…
  • [ ITEMS ] makes a new, anonymous array, and returns a reference to that array.
  • { ITEMS } makes a new, anonymous hash, and returns a reference to that hash.

Backslash Operator & ref() function  :

By using the backslash operator on a variable, subroutine, or value typically creates another reference to a variable.

Backslash Operator (\) is similar to the address-of-operator(&) in C.

$scalarref = \$foo; #reference to a scalar 

$arrayref  = \@ARGV; #reference to an Array

$hashref   = \%ENV; #reference to a Hash

$constref = \186_282.42; #reference to a constant

$coderef   = \&handler; #reference to a piece of code

$objRef = new Student("Name", "Surname" , "Roll"); #reference to a object 

There is a inbuilt function ref() which will check & return the reference type 

Usage : ref($refVar) #$refVar is the reference variable in concern

Reference Example :

Through this example , we will demonstrate the use of ref() function and see its output in various cases :

 

Upon execution this code gives the below output which is self explanatory :


With the below code-example we do the Anonymous Referencing & De-Referencing :

Request you to run this code at your end .

De-Referencing : Arrow Notation 

# Accessing A Value 

print "$ArrayRef->[0]";

print "$HashRef->{"KEY"}";

# Assigning A Value

$ArrayRef->[0] = "January";   # Array element

$HashRef->{"KEY"} = "VALUE";  # Hash element

Unnamed Associative Array/Hash :

With the below code example we will create and access unnamed hash :

Upon execution the code gives the below output :


The entire article is well narrated in the below video :


Courtesy : Image by Jae Rue from Pixabay 



Data Structure in PERL : Array and Context


In this article, we explored the fundamentals of basic data structures in PERL, focusing on the versatile Array/List. We began by introducing arrays, covering their creation and methods for populating them with elements. Next, we demonstrated efficient techniques for accessing and manipulating array data. We also explored advanced topics, including Array of Arrays for creating multi-dimensional structures and Sub Arrays for extracting specific subsets. Additionally, we reviewed various Array Operators with real-world examples to illustrate their functionality. Our discussion on Context covered Scalar and List Context, highlighting how they influence array behavior and other data structures in PERL. By the episode’s end, readers gained a solid understanding of arrays, lists, and the critical concept of context for effective programming.

PERL has inbuilt data-structures. In this article we will be covering them. In PERL, generically any data structure is called as list. However we can make two broad classification as below :


In this article we will be focusing on Array . In the next article we will be focusing on Associative Array or Hash.

Arrays in PERL :

  • In PERL the array is much easier compared to the array in C-Language. Now let us understand how the array is organised in PERL : 
  • Array/List variables always start with @ (the “at” symbol).
  • Arrays/List are variable length. 
  • Array/List can be declared without length.
  • This length can vary even after creation.
  • Array/List can contain any sorts of scalars (even a combination of strings, numeric, etc.).
  • Array/List elements are written with parentheses.
  • Use “my” whenever creating the array/list.


Creation of List/Array in PERL :

We will understand the array creation by code-example as :

The above example is self explanatory .

Accessing an Array/List :

After we have created array , now it is the time to access the array. 

  • Each array element is accessed as  $arr[index]
  • my $ref = \@arr ; #gives the reference (pointer) to an array
  • my $length = scalar(@arr) ; #gives the array length
  • my $LastIndex = $#arr # gives the index of the last element of array
  • $arr[-1] #gives the last element of @arr
  • Negative indices count backward from the end of an array
  • my @arr = (1, 2, 3,4); # four  values in the array
  • my $ele1 = $arr[0]; # $ele1 gets the 1
  • my $ele2 = $arr[1]; # $ele2 gets the 2
  • ($arr[0],$arr[1]) = ($arr[1],$arr[0]); # swaps first two elements

The Array of Array :

The array structure can be nested in the below ways :

  • my @array1 = (1, 2, 3); #first array
  • my @array2 = (4, 5, 6); #second array
  • my @array3 = (@array1, @array2); #merged array
  • my @list1 = (1, 2, 3); # three values
  • my @list2 = @list1; # all three values are copied
  • my @list3 = (4, 5, @list2, 6); # six values

Sub-Array or Array Slicing :

A bigger array can be cut/slice in into smaller array in the below way :

  • my $arr = qw(apple orange jackfruit grape mango);
  • @arr[2,4] # is not a two dimensional array, it is ($a[2], $a[4]);
  • my @subArray1 = @arr[2,4] # actually is ("jackfruit" "mango") ;
  • my @subArray2 = @arr[2..4] # actually is ("jackfruit" "grape" "mango");

Miscellaneous Array Operations :

Apart from the major operations , we can do some small operation on array as :

  • push(@list, $new); # add to end of list. Same as @list = (@list, $new);
  • $old = pop(@list); # removes rightmost value
  • unshift(@list, $new); # insert at beginning. Same as @list = ($new, @list);
  • $old = shift(@list); # removes leftmost value. Same as ($old, @list) = @list;
  • @arr = reverse(@arr2); # @arr is the reverse of @arr2
  • @arr = sort(@arr2); # sorts on string (ASCII/Alphabetic Order) values
  • @sorted = sort { $a <=> $b } @unsorted; # sorts integer/real (ascending Order) 
  • @sorted = sort { $b <=> $a } @unsorted; # sorts integer/real (descending Order)
  • chomp(@arr); # chomps each element of @arr

Array Example :

With the below code , we have exemplified the discussed array operations.

When executed , the above code block gives the below output :


Scalar & List Context in PERL :

Perl has a notion of two different “contexts” in which evaluations can take place: 

scalar context and list context.

Things behave differently depending on what context they’re in.

An expression is in “scalar context” if the value it generates will be used as a scalar. 

An expression is in “list context” if the value it generates will be used as a list (i.e. an array or hash). 

  • my @things = (’peach’, 2, ’apple’, 3.1415927);
  • my @thing1 = @things;
  • my $thing2 = @things;
  • my ($thing3) = @things;
  • print "\@thing1: @thing1\n";
  • print "\$thing2: $thing2\n";
  • print "\$thing3: $thing3\n";

my ($first, $second) = @array;

$first and $second are assigned the first and second elements of @array,

my ($first, @rest) = @array;

$first is assigned the first element of @array, and @rest is assigned everything else.

my (@copy, $dummy) = @array;

In this case $dummy is not assigned.

Arrays are variable-length, so @copy has no reason to stop.

Hence  $dummy ends up with undef since @copy “eats up” the entire available array. 

Watch the video here:



Courtesy : Image by Jae Rue from Pixabay 




Loops in PERL

 



In this article, we delved into PERL's control structures and loops, covering essential topics for efficient programming. We began by exploring PERL operators as the foundation for control structures. Next, we examined If-Elsif-Else for decision-making, File Test Conditions for file handling, and the Unless structure as an alternative conditional approach, comparing it with If for clarity. Our loop exploration included the For Loop for range iteration, Foreach for arrays and lists, and While and Do-While Loops for condition-based execution. We also covered Until and Do-Until Loops for executing code until specific conditions are met and discussed Next and Last commands for precise loop control. By the end, readers  gained a comprehensive understanding of PERL's control structures and loops, enabling them to write effective and streamlined code.

The For Loop in PERL :

  • Initialization counter
  • Condition checking counter
  • Increment/decrement counter
Here the simple example will help you to grasp the for loop in PERL :

The for loop has three counters (c-style) :



You can run it your end to see the output !

The ForEach Loop in PERL :

  • Foreach operates on each element of an Array
  • This array may come form  Keys of a Hash/Associative-Array
  • Some array operations(reverse/sort) are allowed in the foreach loop
  • Default variable can take place if the element is not specified
  • This array may be the default array of Arguments (@_)
The simple below code will help you to understand the foreach loop :



It is very much self explanatory .
Here is an foreach code that you can run at your end :



This code iterates over the *.pl files in present directory. In VLSI Automation you may have to use such loops very frequently to iterate over files in a directory.
In the below example , we hand create a list and we iterate over it using the foreach loop :



This is a very common use of the foreach loop in PERL, however in most of the cases the list is not created by hand , instead it comes from some other part of the code as a output.
By Now you have noticed the difference of the for-loop and the foreach loop.


While and Do-While Loop in PERL :

You already know the while loop from c-language. Also you might be familiar with the  do-while. 
The functioning of the while loop is described in the below code snippet :



The code snippet is self explanatory as you read trough it.
The below code-snippet does your tour of the do-while loop functioning  in PERL :



The meaning of the code snippet is self-explanatory.


Until and Do-until Loops in PERL :


The until loop continues executing as long as its test condition is false (i.e. until it becomes true).
The below code snippet explains the usage of the until and do-until loop :



The above code snippet is self-explanatory.



Loop Control : Next & Last  

The Next and the Last serves the same purpose as continue and break keywords from c-language. Now it is new easier for you to understand the below points :

  • The next and last operators allow you to modify the flow of your loop. 

  • It is not at all uncommon to have a special case; you may want to skip it,  use next.
  • Or a special case you want to quit when you encounter it, use last.

The code snippet mentioned above is self-explanatory.
The entire article is narrated in the video below :




Courtesy : Image by Jae Rue from Pixabay 



Operators and Control Structure in PERL



In this article, we explored control structures and loops in PERL, covering key concepts to enhance programming skills. We began with an overview of PERL operators, essential for understanding control structures and loops. We examined the If-Elsif-Else structure for decision-making, File Test Conditions for efficient file handling, and the Unless structure as an alternative for conditional logic, comparing it to If for clarity in usage. Our deep dive into loops included the For Loop for iterating over ranges, the Foreach Loop for arrays and lists, and the While and Do-While Loops for condition-based repetition. We also covered the Until and Do-Until Loops for executing code until specific conditions are met. Finally, we explored the Next and Last commands for fine-tuning loop control.  By the end, readers  gained a comprehensive understanding of PERL’s control structures and loops, empowering them to write more efficient and effective code.

Operators in PERL :

PERL has different kind of operators. In this article we are going to get familiar with them. Seven different categories of operators in PERL are listed below. These are used used every now and then in VLSI related scripting.

1. Assignment:

= is the normal assignment operator

+= -= *= /= ++ -- %= are all the same as in C/C++

2. Numeric:

+ - * / are the same as in C/C++

** is an exponentiation operator

% is the mod operator same as in C/C++

3. Relational:

Numeric comparisons: == != < <= > >=  are the same as in C/C++

String comparisons: eq ne lt le gt ge

RegEx matching/not-matching: =~ !~ (more later)

4. Logical :

|| && !    or and not

5. String:

(dot). is the string concatenation/joining operator:

x is the repetition operator: 

$var = "abc" x 3, turns $var into "abcabcabc"

6. Interpolation Operator : 

$name = "Havard"; 

$gen = "$name University"; # gives "Harding University”

7. File I/O Operators:

< : Read Operator

> : Write Operator

>> : Append Operator

|- : Output Pipe

-| : Input Pipe

Control Structure in PERL :  If-Elsif-Else

If we look carefully to the name above, Else if is the new concept as compare to C-Language . This helps to remove unnecessary nesting of If-Else loops.  When one of the conditions is found to be true, its block is executed and all the remaining branches are skipped.

The Typical Code Organisation for the if-elsif-else blocks is as below :

The code above  is self-explanatory in the way it is written. 

The if statement can be used as inline without its else/elsif counterpart  as :

Now let us look into an example of  the if-elsif-else as below:

The above code is easy to understand. Now you can play with this code by altering the conditions.

If and File-Test Conditions : VLSI Usage 

In the EDA Automation use of PERL , many times we have to check many situations that whether a file is existing on disk or is it zero size or is it writable . All these kind of tests can be done using the already existing file test switches in PERL :

-r -w -x -o : File or directory is readable,  writable, executable, or owned by user

-e : File or directory exists

-z : File exists and has zero size 

-s : File or directory exists and has nonzero size

-f : Entry is a plain file

-d : Entry is a directory

-l : Entry is a symbolic link

-T : File is text

-B : File is binary

These switches are straight forward to use or implement inside the if-condition or elsif-condition . 

Unless-Control-Structure : Checking when the Given Condition is False 

Sometimes, you want to stay idle if the condition is true.  Do something ONLY if the condition is false. 

The unless block serves the purpose. This block of code executes only the provided condition is FALSE.

You may also use the inline version of the Unless as :

Unless Example :

Now let us look into an example of the unless block . Here first we have used a inline-unless. Here intentionally we provided a condition to fail so that the unless code block is executed. At the later part we have used two separate unless blocks to test which is getting executed based on the failure condition.

Once executed the block gives the below output :


If vs Unless Comparison : Example

In this code example we have tested multiple versions of the direct true/false statements , as available in PERL, inside both if and unless condition . This elaborate comparison helps you to understand the usage difference of if vs unless thoroughly.

Once this code is executed , it gives the below output. You may run the code at your end or compare code vs output line by line here while reading , to understand. The choice is yours.


The entire article is well Narrated in the below video :


Courtesy : Image by Jae Rue from Pixabay 



1/10/2022

Variables In PERL

In this article, we delved into the fascinating world of PERL, exploring its extensive usage in the domain of VLSI (Very Large-Scale Integration). We began by providing an introduction to PERL as a powerful scripting language, shedding light on its versatility and significance in VLSI-related tasks. To assist viewers in getting started, we offered a comprehensive installation guide, enabling seamless setup and configuration of PERL on various platforms. Continuing our journey, we embarked on a hands-on exploration by showcasing the iconic "Hello World" program in PERL, providing a gentle entry point for beginners to grasp the basic syntax and structure of the language. Furthermore, we ventured into the realm of variables in PERL, unraveling the process of defining variables and showcasing the different ways to declare variable types in the language. We delved into the concepts of My, Local, and Our variables, illuminating their unique functionalities and scoping rules within PERL programs. Moreover, we explored the realm of special variables in PERL, unveiling their significance and how they provide access to valuable information and system resources during program execution. Lastly, we touched upon special literals and bare-words, showcasing their usage and impact in PERL scripts. Through this episode, viewers gained a comprehensive understanding of the role of PERL in VLSI, a solid foundation in PERL scripting, and mastery over variable manipulation in the language, empowering them to excel in their VLSI endeavors and beyond.

Before We Begin :

  • PERL is abbreviation of Practical Extraction and Report Language
  • Every PERL script in Linux/Unix must begin with  :  #!/usr/bin/perl -w
  • Perl is Case-Sensitive, i.e. $c is a completely different variable than $C.
  • So highly recommend that you use the directive “use strict;” at the top of all your programs. This forces you to declare all your variables and causes Perl to complain when it sees a variable which has not been declared (often a misspelling).
  • It also checks variable scopes in different blocks of the long code.
  • # Starts a Comments in PERL
  • Every line of code ends with ; (semi-colon)

Where PERL is used in VLSI ?

  • Automation to Run Batch Jobs in local or remote machines (LSF).
  • QC/QA of Text Outputs of VLSI Tools.
  • Data Intensive Comparison between two Different large Output Data files.
  • Regression Automation of Testcases.
  • Regression Quality Analysis.
  • VLSI CAD Infrastructure Building and Maintenance
  • Modular/Object Oriented Programming to protect sensitive data.
  • And Many more .......

PERL Installations :

You will get the Installation Details of PERL in any of the OS as in 

URL  :  https://www.perl.org/get.html

"Hello World" In PERL :

Here is the code of the "Hello World" in PERL :

  • Save The Above Code as “hello.pl”
  • Give Executable Permission : chmod +x hello.pl
  • Execute As : ./hello.pl
  • Output is : "Hello World"
  • Inline Perl coding : where you do not have write permission or need a very short Perl script :
  • perl -e 'print "\n Hello, world \n";'

Defining A Variable(Scalar) in PERL :

  • To declare a variable, use the my operator: my $var = 32;
  • To declare multiple variables at once : my ($var1, $var2, $var3);
  • Perl has a special “undefined” value, often written undef.
  • Declared but not assigned variables have the value undef.
  • Explicitly a variable can be also defined : $var = undef;
  • There is no boolean type as such in Perl. Instead, Perl has a notion of the truth or falsity of any scalar :
  •  '0' Zero the number itself is false.
  • The empty string ’ ’ and the string ’0’ are false.
  • undef is false.
  • Anything else is true.
  • Floating point values include the special values "Inf" and "NaN", for infinity and not-a-number. The infinity can be also negative.

Type Declaration in PERL :

PERL do not have explicit separate data-type declaration such as Integer, Real, Double/Float.
However a scalar can accommodate all the below types as:

  • $int = 42; # is an integer
  • $pi = 3.14159265; # is a "real" number
  • $data = 6.02e23; # exponential notation
  • $animal = "Camel"; # is a string
  • $sign = "I love my $pet"; # string with interpolation ($pet replaced with "Camel")
  • $cost = 'It costs $100'; # string without interpolation 
  • $num1 = $var2; # another variable value is assigned to $num
  • $ab = $a * $b; # an mathematical operation
  • $out = `pwd`; # output from a command stored in $out
  • $exit = system("vi $x"); # numeric return status of a command
  • $apple = new UserDefindClassName "Fruits"; # an object from OOPs in PERL

My / Local / Our Variables :

A my() declares the listed variables to be local (lexical) to the enclosing block, file, or eval. If more than one variable is listed, the list must be placed in parentheses.

A local() modifies the listed variables to be local to the enclosing block, file, or eval. If more than one value is listed, the list must be placed in parentheses. 

An our() creates a package variable: It declares an alias for a package variable that will be visible across its entire lexical scope, even across package boundaries. 

  • package Foo;
  • our $bar;      # declares $Foo::bar for rest of lexical scope
  • $bar = 20;
  • package Bar;
  • our $bar = 30; # declares $Bar::bar for rest of lexical scope
  • print $bar;    # prints 30
  • our $bar;      # emits warning but has no other effect
  • print $bar;    # still prints 30

Special Variables in Perl :

  • $_  The default input and pattern-searching space. It is an global variable.
  • The following functions use $_ as a default argument:
  • abs, alarm, chomp, chop, chr, chroot, cos, defined, eval, evalbytes, exp, fc, glob, hex, int, lc, lcfirst, length, log, lstat, mkdir, oct, ord, pos, print, printf, quotemeta, readlink, readpipe, ref, require, reverse (in scalar context only), rmdir, say, sin, split (for its second argument), sqrt, stat, study, uc, ucfirst, unlink, unpack.
  • The pattern matching operations m//, s/// and tr/// (or, y///) in absence of =~ operator.
  • The default iterator variable in a foreach loop if no other variable is supplied.
  • The implicit iterator variable in the grep() and map() functions.
  • The implicit variable of given().
  • The default place to put the next value or input record when a <FILE_HANDLE>, readline, readdir or each operation's result is tested by itself as the sole criterion of a while test. Outside a while test, this will not happen.
  • @_   Within a subroutine the array @_ contains the parameters passed to that subroutine. Inside a subroutine, @_ is the default array for the array operators pop and shift.
  • $a & $b :  Special package variables when using sort(), see "sort" in perlfunc. Because of this specialness $a and $b don't need to be declared (using use vars, or our()) even when using the strict 'vars' pragma. Don't lexicalize them with my $a or my $b if you want to be able to use them in the sort() comparison block or function.
  • %ENV : The hash %ENV contains your current system environment variables & their values can be manipulted by this hash/associateive array. 
  • @INC : The array @INC contains the list of places that the do EXPR, require, or use constructs look for their library files. It initially consists of the arguments to any -I command-line switches, followed by the default Perl library, probably /usr/local/lib/perl.
  • @ISA : Each package contains a special array called @ISA which contains a list of that class's parent classes, if any. This array is simply a list of scalars, each of which is a string that corresponds to a package name. The array is examined when Perl does method resolution, which is covered in perlobj.
  • $$ The process number of the Perl running your present script itself.
  • $0 Contains the name of the Perl program being executed.
  • $<digits> ($1, $2, ...) : Contains the sub-pattern from the corresponding set of capturing parentheses from the last successful pattern match, not counting patterns matched in nested blocks that have been exited already.
  • $& : The string matched by the last successful pattern match (not counting any matches hidden within a BLOCK or eval() enclosed by the current BLOCK).
  • $ARGV : Contains the name of the current file when reading from <>.
  • @ARGV : The array @ARGV contains the command-line arguments intended for the script. 
  • Refer the Complete & Exhaustive  list : https://perldoc.perl.org/perlvar

Special Literals & Bare-Word :

  • The special literals __FILE__, __LINE__, and  __PACKAGE__ represent the current filename, line number, and package name at that point in your program. 
  • __SUB__ gives a reference to the current subroutine. 
  • Bare-words : A word that has no other interpretation will be treated as a quoted string. These are known as "barewords". 
  • A bare-word that consists entirely of lowercase letters risks conflict with future reserved words, and if you use the "use warnings" or the -w switch, Perl will warn you about any such words.
  • If you use the “use strict”; then any bare-word that would NOT be interpreted as compile-time error. Only bare-words are allowed as Hash key (  NOT  the value). 

Watch the video here:

Courtesy : Image by Jae Rue from Pixabay 



3/13/2021

PERL Automation Script in Linux/Unix Environment




In this article, we explore the goals of automation and the challenges it addresses. We analyze the critical decision-making process of selecting appropriate unit binaries for automation workflows, emphasizing the importance of choosing the right tools and software. To clarify the automation process, we present a detailed flow chart illustrating the sequential steps and dependencies involved in efficient automation. We also highlight the power and versatility of PERL scripting for automation, showcasing its practical application through live test cases. Additionally, we explain the automation outcome and log files, which provide valuable insights for troubleshooting, analysis, and documentation. This article equips readers with practical knowledge to enhance productivity and efficiency through automation.

PERL as a programming language is used for automation in the the VLSI industry.In this industry most of the the EDA tools are command line. Hence we have to use any kind of shell or Scripting Language to automate the VLSI tool flow. PERL is a chosen language because it has its own ability to to match Regular Expression (RegEx) match your level of of Shell Interaction and easy debugging methods.



In this particular example we have chosen a challenging scenario where we have to use PERL as a automation language and do a mammoth amount of task in an very easy way. In this particular case each Rar file has multiple JPG files which we need to to convert and combine into one single PDF. At beginning this seems to be a very easy task. Yes you are right this is very easy when we do only few of such conversions. when this amount of RAR files is is at large , Say we have thousand search RAR files, then at this situation the task will become Mammoth, error will come every now and then. We did not consider any manual mistake that can take place. To deal with such scenario we have to design one PERL automation that will help us to achieve the goal with zero human mistake and maximum accuracy.



Now at the situation we have huge number of RAR files which we need to convert EACH into one single PDF. So we need an automation script using PERL. To capture the error warning coming from any unit tool included in this automation. So  in this coding will use a PERL module which will create a professional looking log file for or normal screen outputs as well as error/warning. 

For Detailed Description & Usage Please See the video below: 



Here is the PERL Code :

Useful Tips : 

In case you are facing the issue with PDF conversion in ImageMagick convert binary  then 

1. Open : sudo gvim /etc/ImageMagick-6/policy.xml

Your Installed Version of ImageMagick may be different , then choose the above file corectly from the same path in /etc/.....

2. Edit the policy.xml file as :

  <policy domain="coder" rights="read|write" pattern="PS" />

  <policy domain="coder" rights="read|write" pattern="PS2" />

  <policy domain="coder" rights="read|write" pattern="PS3" />

  <policy domain="coder" rights="read|write" pattern="EPS" />

  <policy domain="coder" rights="read|write" pattern="PDF" />

  <policy domain="coder" rights="read|write" pattern="XPS" />

3. Save the file and exit.


Thanks for Reading The Blog ! 



Courtesy: Image by www.pngegg.com