Wednesday, 28 October 2015

linux  grep  command with logical OR/AND operation


->OR  Operation
grep -nrl --color 'TOM \| DICK \|  HARRY' --include="*.txt"  *
grep -nrl --color 'sav2_base_test\|run_phase\|main_phase' --include="*.txt" * | wc -l                                    
This command lists TXT file names containing any of these keywords TOM , DICK or HARRY anywhere in file.

->AND Operation
grep -l  TOM * --include="*.txt" | xargs grep -l DICK | xargs grep -l HARRY 
grep -l  TOM * --include="*.txt" | xargs grep -l DICK | xargs grep -l HARRY | wc -l

This command lists TXT file names containing all of these keywords TOM , DICK or HARRY anywhere in file.


-->Find particular keyword and replace by other keyword in all files of given directory
find . -type f -exec sed -i 's/TOM/TOMMY/g' {} +
 
This command replaces all keywords TOM by TOMMY in all files of current directory.
For more info visit.
http://unix.stackexchange.com/questions/112023/how-can-i-replace-a-string-in-a-files 

Wednesday, 26 August 2015

System Verilog Queue Example

module queues;
byte qu [$] ;

initial
  begin
    qu.push_front(1);
    qu.push_front(2);
    qu.push_front(3);
    qu.push_back(4);
    qu.push_back(5);

    foreach(qu[i])begin
      $display(i,qu[i]);
    end

    qu.delete(3);                                          //Delete element at index 3

    $display(" %d ",qu.pop_front() );       // pop_front operation removes first element
    $display(" %d ",qu.size() );

    foreach(qu[i])begin
      $display(i,qu[i]);
    end

    $display(" %d ",qu.pop_back() );    // pop_back operation removes last element

    foreach(qu[i])begin
      $display(i,qu[i]);
    end

  $display(" %d ",qu.size() );
  end
endmodule

OUTPUT:

0 3
1 2
2 1
3 4
4 5

3
//pop front

0 2
1 1
2 5

5 //pop back

0 2
1 1

2

Monday, 22 June 2015

System Verilog Process

How to disable particular process of fork...join,executing multiple processes in parallel.


class a;
  int v;

  task t1();
    for(int i=0;i<10;i++) begin
      #1 v=i;
      $display("I value=%0d",v);
    end
  endtask:t1
 
   task t2();
     for(int i=10;i<20;i++)begin
       #1 v=i;
       $display("I value=%0d",v);
     end 
  endtask :t2
 
  task t3();
    process job_id[2];                                 //Process Identifier
    fork
       begin:t1p
         job_id[0] = process::self();
         t1();
       end 
       begin:t2p
         job_id[1] = process::self();
         t2();
       end 
       begin:t3p
         int j;
         forever begin
           @(v)begin
           $display($time,"forever",j);
           j++;
             if(v==14)begin
               job_id[0].kill();                         //Kill process executing task t1();
             $display("Entered");
             //disable t1p;
             break;
          end
         end
          
         end
       end 
    join
  endtask :t3     
 
endclass:a


module test();
  a a1;
  initial
    begin
      a1=new();
      a1.t3();     
    end
endmodule

Note:-Why can't simple disable ...fork statement can be used....?????

Wednesday, 22 April 2015

Linux Grep Command


grep "literal_string" filename
 
grep "string" FILE_PATTERN
 
grep -i "string" FILE
 
grep "REGEX" filename
 
grep -iw "is" demo_file
 
grep -A <N> "string" FILENAME
 
grep -B <N> "string" FILENAME
 
grep -C 2 "Example" demo_text 

export GREP_OPTIONS='--color=auto' GREP_COLOR='100;8'
grep this demo_file
 
grep -r "DJ" * 

grep -v "go" demo_text
 
grep -v -e "pattern" -e "pattern"
 
grep -c "pattern" filename
 
grep -v -c this demo_file
 
grep -l this demo_*
 
grep -o "is.*line" demo_file
 
grep -o -b "pattern" file
 
grep -n "go" demo_text 

Friday, 30 May 2014

Skew,Global Skew,Local Skew,Useful Skew

Skew
• The difference in the arrival of clock signal at the clock pin of different flops.
• Three types of skews are defined: Local skew and Global skew and Useful skew.

Local skew
 The difference in the arrival of clock signal at the clock pin of related flops.

Global skew
The difference in the arrival of clock signal at the clock pin of non related flops.

Useful skew
If clock is skewed intentionally to improve setup slack then it is known as useful skew.

Useful skew is a concept of delaying the capturing flip-flop clock path, this approach helps in meeting setup requirement with in the launch and capture timing path. But the hold-requirement has to be met for the design.

Skew can be positive or negative.
 When data and clock are routed in same direction then it is Positive skew.
 When data and clock are routed in opposite then it is negative skew.


ASIC FLOW vs PHYSICAL DESIGN FLOW


ASIC flow is completely from scratch to end flow i.e. It includes market research, Architecture specification ,RTL coding  and Logic synthesis and other many more phases.


On otherhand  Physical Design flow in simple terms is Netlist to GDS II(Graphic Database System) flow.
Below figure will help you to understand the difference clearly.