21 November

50 Most Useful Linux Commands for VLSI Engineers

Linux is an open-source operating system which is the first choice of every technocrat. For VLSI Design Engineers also most of the EDA tools are only compatible with Linux. In Linux, we interact with OS majorly with Command-Line Interface (CLI). In beginning, it might look a bit tedious as you have to remember lots of commands and we are addicted to GUI interface but later you will definitely love it.

In this article, we will learn some of basic Linux commands with examples. I would request to my reader don't just read this article but, practice these commands parallelly for best understanding and clarity. If you wish you can also make a small cheat sheet for your use. In this article, we will learn 4 categories of 50 most useful basic commands. For advance level commands we are going to publish another article later.



Category-1:  File System Management


1.  ls

: list files and directories


Use:

    ls -l   ; indicates file/directory type, permissions, owner, size, last modified

        - normal, d- directory, s-socket file, l-link file

    ls  -a  ; shows hidden files/directories

    ls -t   ; lists the files/directory on basis of modification time

    ls -lart   ; lists all the files and directories in order of last modified.


2.  clear 

: clear the terminal (but keep the history of commands intact)


3.  man / --help 

: Show a manual of command and switches written in details.


4.  pwd

: Print Working Directory, The directory where you are currently.


5.  cd

: Change Directory, to move to another directory.



Use:

    cd  .. ; back to parent directory 

    cd  - ; back to previous directory 

    cd ~ ; go to home directory

    cd ../../../ ; back to n steps

    cd ‘abc xyz’   ; go to a directory whose name contain white space


6.  mkdir

: create a directory


Use:

    mkdir directory_name ; To create a new directory with the given name.

    mkdir dir1 dir2 dir3 ; To create multiple directories in a single step.

    


7.  touch

: create a file


Use:

    touch file_name ; create a new file

    touch file1 file2 file3 ; To create multiple files

    touch –a file_name ; to change file access time

    touch –m file_name ; to change the file modification time  


8.  gedit file_name &

: create and edit a file in GUI mode


Use:

    gedit /path/to/file_name ; create and edit a file in specified location

                                                  ; word count, line no. , language 

9.  vi file_name

: create and edit a file using command-line interface


Use:

    i    ; Switch to edit mode

    ESc    ; Exit from edit mode and Switch to command mode

    /string ; find the string

    Esc + :q ;exit without saving

    Esc + :s   ; Save only not exit

    Esc + :wq  ; save and exit


10.  cp source destination

: copy command


Use:

    cp source_file destination_dir     ; To copy a file

    cp source_file .     ; To copy a file to current directory ("." means current dir)

    cp -f source_file destination_dir     ; To copy forcefully a regular file

    cp -R source_file destination_dir ; To coppy recursive a directory


11.  mv source destination

: move command, like cut+paste


Use:

    mv f1 f2     ; rename f1 by f2

    mv -rf   ; recursive and force moving of a directory


12.  rm

: remove file/directory, like delete


Use:

    rm -rf   ; remove recursive and force

                    ! One of dangerous command as root, use carefully!!!

    rm *.txt ; Will remove all the file having extension .txt in PWD


13.  cat 

: stands for concatenate


Use:

    cat file_name   ; Display a contain of a file in CLI

    cat text1 > text2 ; redirection of text, overwrite

    cat text1 >> text2 ; appending the text 


14.  which 

: Path of the command


Use:

    which virtuoso ; Display the path of the executable file for virtuoso

    which vi ; Will show the vi command path

    which python ; Will show the installation path of the python program


15.  find 

: searching a file/directory


Use:

    find / -name "dir_name" ; to find a file/dir

    find /home/user_name -name "file_name" ; to find a file/dir only in user's home area

    man find ; to get more details on find command



16.  history 

: Get the list of executed commands


Use:

    history ; the history of all command

    history n   ;list of last n command executed

                !n            ; repeat any command in the history list

    export HISTTIMEFORMAT=‘%F %T ’   ; setting history command with timestamp format

    unset export HISTTIMEFORMAT ; unsetting the time format

    history -c ; clear all the history

    ~/.bash_history ; location of stored command history


17.  chmod

: Change mode, change the permission of file/directory


Use:

    ls -l  file_name          ; To see the current permissions of the file/dir


Let's understand the permissions through this ecample.



r   w   x 7     7     7 7      5      4

4   2  1 rwx  rwx rwx rwx   r-x    r- -  


Numeric and Symbolic permissions

    chmod  777 file_name         ; set all the permission for all users

    chmod  754 file_name        ; set rwx for owner, r-x for the group and r– for others

    chmod –R 777 dir_name    ; Set all permission recursively inside the dir



Category-2:  Text processing commands



18. touch

: create a new file


Use:

    touch file1 ; create an empty file

    touch file1 file2 file3 ; create multiple files in one command

    touch –am file2   ; change access and modification time


19. gedit

: A GUI based Linux text editor  


Use:

    gedit & ; open gedit text editor and release the CLI

    gedit file1 ; create/open a file in geditor


20. head

: To read the first 10 lines of a file in CLI  


Use:

    head file_name   ; To read the first 10 lines of a file

    head –n 8 file_name   ; To read first 8 lines of a file OR head -8 file

    head -4 *.log           ; Read first 4 lines of all log files in PWD   

 

21. tail

: To read the last 10 lines in the command line  


Use:

    tail file_name   ; To read last 10 lines of a file

    tail –n 12 file_name   ; To read last 12 lines of a file OR tail -2 file


22. sort

: To sort the list 

  

Use:

    sort file_name   ; sort the content of file

    sort –n file_name   ; sorting a file which has numbers

    sort –r file_name   ; sorting  the file in reverse order

    sort –o outputfile inputfile  ; redirection of sorted output

    sort –n -k2 file_name   ; sorting  the file on basis of the nth column


23. unique

: An utility for filtering the repeated lines in a file


Use:

    unique file_name   ; will display only unique lines

    unique –c file_name   ; will tell no. of times a line has repeated


24. more

: Display text one screen at a time


Use:

    more  file_name   ; display the text in command line

                               <space> next screen,

                                    <b> back to previous screen,

                                    <enter>  next line

    more -10 file_name ; will display 10 lines at a time

    dmesg | more ; more with pipe.


25. less

: to read the text file in the command line


Use:

    less  file_name ; To view the content of a file

                                    similar to more command with some advance features

     less -N file_name ; Will show the content with line number

                                        <Enter> or Down Arrow: To move next line

                                        Up Arrow: to move up a line

                                        <space>: To move down one page

                                        <b>: To move up one page

26. grep

: global regular expression print


Use:

    grep –i  words file_name ; display the line contains searched word

    dmesg | grep sda   ; filtered the output and show only line having sda

    dmesg | grep sda –A 5 ; Display 5 lines after the matching word sda


27. diff or vimdiff

: find the difference between two files/dir


Use:

    diff file1 file2 ; To check the difference between two files

    diff dir1 dir2 ; To check the difference between contains of two dir

     A similar GUI tool is “meld”

    vimdiff f1 f2 , gvimdiff f1 f2


28. wc

: word count of a file


Use:

    wc file_name ; Newline, word and byte count in the file

    wc –l file_name ; To count total new lines in the file

    wc –w file_name ; T count total words only

    wc –c file_name ; T count total characters only



Category-3:  Process management commands


29. top or htop

: It will show the status of various resources and tasks


Use:

    top    ; you can see the utilization statics for resources and get PID of all running process

    htop    ; Similar to the top command but an improved version. 


30. ps

: Known as Process Status 


Use:

    ps            ; process for the current shell

    ps -e       ; Display all active process

    ps -ef       ; Display all active process in full format

    ps –ef | grep virtuoso   ; If the list is too big we can grep it to a specific command


31. kill

: To terminate a process


Use:

    kill PID   ; Killing a process by PID, PID is a numeric value.

    kill PID1 PID2 PID3    ; Kill multiple processes together. You can specify the signal name in between Kill and PID. If no signal has been specified, by default TERM signal will be sent. 


32. who

: Display the users who are currently logged in your Linux machine


Use:

    who   ; Without any argument who command will display user's login name, terminal, login time and host

    who –q    ;Display the name of all users and total no. of users logged in


33. w

: information about current logged user and what they are doing


34. users

: Display the all current users name in a single line 


35. last

: it display the list of user who logged the system 


Use:

    last   ; If no options provided the last command displays a list of all users   logged in (and out) since /var/log/wtmp file was created

    last user_name      ;Will display the activities of a particular user only


36. free

: Used to check available physical memory and swap memory 


Use:

    free   ; Command used to check used and free memory space in KB

    free –m/g ;Space will be shown in MB or GB

    free  -s 5   ; Will update the status in every 5 seconds.


37. lshw

: Used to check hardware information 


Use:

    lshw   ; Generates detail reports about various hardware of system

    lshw –class memory  ;Details memory in the system

    lshw –class processor ; Details of processor in the system

    lshw –short –class disk   ; Details about the hard drives (network) 


38. lscpu

: Display information about CPU architecture


Use:

lscpu   ; Give the detailed information about the CPU


39. cat /proc/cpuinfo

: Similar information like lscpu


40. dmidecode

: Is a tool for dumping System Management BIOS (SMBIOS) table content in a human-readable format


Use:

    dmidecode   ; Gives all the hardware details

    dmidecode –t system   ; Gives the manufacturer, model no. etc details

    dmidecode –t bios ; Gives the bios information of system (/memory)


41. uptime

: Gives the time how long system is running


Use:

    uptime -p   ; Gives the duration of the system running 


42. reboot

: Will shutdown and restart the machine instantly


43. shutdown

: Can be used to shut down or restart the machine


Use:

    shutdown –h now    ; System will be shut down instantly

    shutdown –h +5 “message” ; System will be shut down after 5 minute

    shutdown –r +5    ; System will be restart after 5 minutes




Category-4:  Bash Environment Related Commands


44. date

: Will show the current date, time and of time zone


Use:

    date          ; Will show day, date, current time and timezone

    date –d “1990-12-31” ; Details of any specific date

    timedatectl      ; Will show details of local and universal time and timezone

    timedatectl set-time ‘2018-12-27 07:30:10’ ; to set specific date and time

    timedatectl set-time ‘Asia/Kolkata’    ; Setting time by time zone



45. cal

: Will display the calendar of current month in terminal 


Use:

    cal                      ; Will show calendar of current month in terminal

    cal  08 1947      ; To display a calendar of particular month and year

    cal –y 2019            ; Will show calendar of all month of a particular year


46. env

: Used to print all the current environment variables and it’s value


47. whoami

: prints the username of the current user


48. uname

: It provides kernel versions and other details


Use:

    uname          ; Without any option, will print kernel name only

    uname -a       ; Get all the information like, kernel name, version,   architecture, host name, current date and time.

 

49. hostname

: To know the hostname 

    hostname         ;It will display the hostname

    cat /etc/hostname   ;Inside the hostname file hostname is stored and  we can read and edit.

    vi /etc/hostname ;to change a new hostname edit the name here   and reboot the machine

50. echo $BASH_VERSION

: To know the BASH version. For more variables value run env command 



Your suggestions are most welcome in the comment section. If you wish to get this article and upcoming articles of this blog in your email, follow this blog.  

Thank you!

08 November

IO Interface Analysis: Constraints for IO pins on block level

We all know that all the input and output pins of a block must be constrained in order to enable the PnR tool to optimize those interface paths. How to constrain an input or output pin will be discussed in this article. We will also discuss what are the actual meanings of these constraints and how these constraints affect the timing analysis.


In the above figure, there are two timing paths shown, one is from CIN to FF1 and other is from FF2 to COUT. The path from CIN to FF1 is called input to register (In2Reg) path whereas the path from FF2 to COUT is called register to output (Reg2Out) path. Any timing paths which are related to an input and output pins is called Interface timing path.

Input Interface:




If we consider a block-level PnR implementation, the input to register path might be a part of the register to register path as shown in the above figure. Register FF11 is outside of the block but a part of the path from CIN to FF1 is inside the block. So in order to meet the timing of register to register path FF11 to FF1, we can divide this path into two parts. 



First part is the delay between the clock pin of FF11 to the input pin of block CIN and the second part is the delay from CIN pin to the D pin of FF1 as shown in the above figure. the first part is called input delay of the CIN pin. Since this path is out of the block so there is no timing information if this path can not be calculated by the tool. So we need to provide the delay of this part of the path as an input delay of pin CIN in SDC file. based on this input delay value PnR tool will estimate the timing margin from CIN to D pin of FF1 and optimize the path. On the block level, we need to close the timing from CIN to FF1 only that is Input to register path. 

For Example, 

    let's say the clock period is 1ns.

    And for setup analysis, the data required time for the path FF11 to FF1 is 850ps. 

    Suppose the maximum delay of the path from the clock pin of FF11 to CIN  is 550ps.

     Then on block-level, for setup analysis, we have to close the remaining path that is from CIN to FF1 at 850 - 550 = 300ps.

Input delay path has also two parts, one is clock to q dealy of FF11 and other is a combinational delay from q to CIN. This path will have max and min delay, which will be used separately in the setup and hold analysis. So when we apply input delay we apply two delays, max input delay and min input delay. The command for applying this delay in the SDC file is as follow.

Setting Input Delay:

create_clock -name RLCK -period 1 [get_ports RCLK]

set_input_delay -max 0.55 -clock RCLK [get_ports CIN]

set_input_delay -min 0.45 -clock RCLK [get_ports CIN]

The above set of SDC commands will set the maximum input delay of 550 ps and minimum input delay 450 ps to CIN input pin. We can understand this in a more simple way that data will be launched from the CIN pin after the input delay. So more input delay means lesser time available to reach the data to capture flop FF1. A similar logic is applicable for hold analysis too. 


Output Interface:





In block level, the register to output path from FF2 to COUT is a part of the complete path from FF2 to FF22 as shown in the above figure. Flip flop FF22 and the path from COUT to the FF22 is outside the block and this path can be supposed here a virtual path.



The path from FF2 to FF22 might be thought as two parts as shown in the above figure. part-1 is from FF2 to COUT which is inside the block and part-2 from COUT to FF22 which is outside the block and virtual here. Delay of part-2 path is called the output delay of the COUT pin. This delay is the combinational delay before the register FF22 and outside the block. This part will have a maximum and minimum delay which we need to specify while specifying the output delay for pin COUT.

For Example, 

    let's say the clock period is 1ns.

    And for setup analysis, the data required time for the path FF2 to FF22 is 800ps. 

    Suppose the max delay of the path-2  from COUT  to FF222 is 250ps.

     Then on block-level, for setup analysis, we have to close the remaining path from FF2 to COUT at 800 - 250 = 550ps.


In SDC file we specify maximum and minimum output delay, which is used separately for setup and hold analysis. The output delay is the delay from the output pin to the next register.  

Setting Output Delay:

create_clock -name RLCK -period 1 [get_ports RCLK]

set_output_delay -max 0.25 -clock RCLK [get_ports COUT]

set_output_delay -min 0.20 -clock RCLK [get_ports COUT]


The above set of SDC commands will set the maximum output delay of 250 ps and minimum input delay 200 ps to COUT output pin. We can imagine this like there is a virtual flop outside the block and the delay from COUT pin to that virtual flop is output delay of COUT pin. Here output delay has explained with reference to setup analysis but a similar concept is applicable for the hold analysis too. 


Thanks!

27 October

Module Constraint Types : Guide, Fence and Region

Sometimes we need to place a particular group of standard cells or modules in a particular area (box). PnR tools allow us to do that. If I talk particularly about Cadence Innovus APR tool, It has three types of regions called Guide, Fence and Region through which we can provide guidance to the placement tool. Let's explore what actually these three placement constraints do and what are the differences.

Guide: 

Guide

  • The guide is assigned with certain cells in the design
  • The guide allows to assigned cell sit outside the box
  • It also allows the other cells to sit inside the box
  • It is a soft constraint.

Innovus command:

createGuide obj_name box


Example: 

createGuide adder9 100.000 200.000 110.000 210.000

This is will create a guide for the module adder9 to the box (100 200 110 210)



Fence: 



  • The fence is assigned with certain cells in the design.
  • A fence does not allow the assigned cell to sit outside the box defined.
  • A fence does not allow the other cells to sit inside the box also. So the area is exclusively reserved for the assigned cells.
  • It is a hard constraint

Innovus command:

createFence obj_name box

Example: 

createFence SH12 200 400 220 440

This is will create a fence for the module SH12 to the box (200 400 220 440)

Region: 



  • The region is assigned with certain cells in the design.
  • A region does not allow the assigned cell to sit outside the box defined.
  • It may cause congestion in the area assigned if not chosen the area wisely.
  • The only difference between the region and fence is that it allows the other cells to sit inside the box. 
  • It is a hard constraint

Innovus command:

createRegion obj_name box

Example: 

createRegion SH7 200 400 220 440

This is will create a module guide in floorplan view with the status region for SH7 module to the box (200 400 220 440)

Delete module guide :

  • The delete the Guide / Fence / Region for the module use unplaceGuide command.

Example: 

unplaceGuide SH7 

This will delete the module guide for the SH7 module