I recommend to visit the this YouTube channel with 125 videos, and this website Why should we learn Per?
Perl is scripting language. A scripting language or script language is a programming language that supports the writing of scripts, programs written for a software environment that automate the execution of tasks which could alternatively be executed one-by-one by a human operator. Environments that can be automated through scripting include software applications, web pages within a web browser, the shells of operating systems (OS), and several general purpose and domain-specific languages such as those for embedded systems.
Part 1: Hello World!
First two lines of our programs
#!/usr/bin/perl print “Content-type: text/html\n\n”;
The last line of our Perl
exit;
Part 2: Variables
creating a variable x: $x = 1;
creating list variable x,y,z: ($x,$y,$z)=(1,2,3);
Variables can be numbers or strings
Part 3: Arrays
Creating an array x: @x = (1,2,3,4,5) @y = (“Ali”, “Alan”, “Sydney”, “Cisco”);
To get an element in an array: @x[index];
Counting elements of an array: $total = $@x +1;
By mentioning a new index we can add new element to our array
Push: Adding an element to the end of an array: push(@array, “Saberi”);
Pop: removing an element from the end of an array: pop(@array);
Shift: removing a element from left hand side: shift(@array);
Unshift: To add an element to the left hand side: unshift(@array, “string”);
Merge: To concatenate to arrays@Cisco = (@Ali, @Alan);
Reverse: @Alireverse = reverse(@Ali);
Sort: Able to sort Numerically and Alphabetically:@sorted = sort (@numbers);
Array tips: hundred ones @Ali = (1) x 100; Hundred hello @Ali =(“Hello”) x 100; Quick string arrays: @array = qw(Ali Alan Cisco Sydney);
Part 4) loop statements
Looping arrays: foreach $index (@array){};
Condition: If(condition1){do some thing} elsif(condition2 ){do something} else{} – or in the opposite unless(){}….else{}
While loop: while (condition){do some thing;}
Until loop: it is reverse of while loop:; until the condition happens. until(condition){}
Map function: to manipulate with elements of array for example multiply them by two, or upper case them @array2 = map { e.g $_=$_*2}(@array)
Grep function: to filter the elements of an array @array2 = grep {S_>5} @array
Part 5)
Operators and Precedence::
- + – * / ++ — %
part 6) Hash-basics
Hash is some thing like array that can hold a lot of data, but the difference is that we can not reference data by index in hash like arrays. To create a hash, we use percentage(%) sign: Here every lement is asssotaed with a name So. loopoing through a hash is different with looing through an array. Also items are in a different order than we put then un hash. There are three methods on introducing hashes
- %Hash(); and then in the program $Hash{Name} = John; $Hash{Age} =25 ; $Hash{City} = Montreal;
- %Hash(){‘Name’ ,’Ali’, ‘Age’, ’25′, ’City’, ‘Montreal’};
- %Hash qw{Name Ali age 25 City Montral};
Access to hash elements: print “$Hash{Age}\n”
Looping hashes: key, value, each
- each: while (($key,$value)=each(%hash)){do some thing};
- keys: foreach $key (keys %Hash){}
- values: foreach $value (values %Hash){}
Hash functions
- exists: this function checks the existence of a key,value : if exists($Hash{Name})…
- defined: this function determines if a key is defined by a value or not if defined ($Hash{City})…
- delete: this function delete a hash item delete($Hash{City});
- reverse: this function makes keys and value reversed reverse $Hash;
- sort: We can sort keys and value ; sort keys %Hash; or sort values %Hash;
- merge: %Hash3 = (%Hash2,%Hash1);
Will be continued….
This topic is also known as timing analysis.
There three type of testing approaches in digital designs:
1-We design, without considering a part for test inside the design, and after it we apply a test pattern to cover a large portion of the faults
2- Design for testablility. such as BIST (Built-In-Self-Test) normally come up with design i FPGA boards
3- Fault tolerant design: In this type of design, we consider a good margin to tolerate errors
Fault sources:
1- In design process: It can happen in two parts; specifications and implementation
2-Device defects
3-Manufacturing process: It happens in material
Fault types:
1- Dynamic: is more related to timing
2- Static: is more related to wiring faults, two wire close to each other and etc.
Test Models: (very simple fault model: Stuck-at faults)
1 – Stuck-at-0 (s-a-0)
2 – Stuck-at-1 (s-a-1)
Combinational Circuits- Test pattern generation
We have Fault vectors (F), and test vectors (T)
Fault Simulation: Given a test vector, by simulating the circuit with the fault, identify all the faults covered by the test vector, It the output is different this test vector can detect that fault
Test Generation: Given a fault, identify all the test vectors which can cover that fault.
Limitations: 1-We expect one fault to occur[max] 2- Fault other than Stuck-at-fault are expected to show up as stuck-at-faults at some other location 3- these approaches are valid only for combinational circuits
Typical Circuit Enhancement:
1- Insertion of test points: We increase number of outputs
2-Pin amplification: We multiplex the function of the pin
3-Test modes:
4- Scan chains: We can test all pins from a pin
Will be continued ….
You can ignore this post as, I have never asked, or heard from my gangs who got interview at Cisco hardware team, that any questions related to MATLAB were asked there.
I personally had a tutoring sessions with my students at McGIll, and I decided to review MATLAB here for you, as you are an engineer and having knowledge of MATLAB is a MUST for you.
Desktop calculations:
1-At the end of each command line putting ; will not echo the input
2- Arithmetic: + – * / \(left and right divisions, note that MATLAB has two operation for division) ^ :
Then 6/3 is 2 and 3\6 is 2, too.
3- Last line editing: by pressing Up/Down buttons; you can recall the last line
4- A few built-in functions: sin(x), cos(x), tan(x), sqrt(x), exp(x), log(x), log10(x), acos(x), asin(x), atan(x), atan2(x,y)
5- Naming constants and variables: MATLAB is Case-sensitive. Therefore, Pi, Pi, PI; pi are different
7- Format: 5 digits display is default, but 15 digits display can be achieved by command: format long, for scientific nation command is format short e.
8- Cleaning the screen: clc
One-dimensional arrays
1-Define a row and column matrix: space and comma are equal [1 2 3] = [1,2,3]
2-Indexing for a matrix(x,y)
3- Size of a matrix: size(Matrix), Length of vector: length(Matrix)
4- Clearing variables: clear
5- Add/subtract to matrix A+B. A-B, array multiplication A.*B, array division A./B. Array power A.^n
6- Defining equally distance elements, A=[1:1:10];
7-Simple plots: plot(x,y,’color’), grid on/off, xlabel(‘’), ylabel(‘’), figure, hold on/off, hist(Y,X)
Matrices
1- Defining a matrix: A=[1 2 3;4 5 6]
2- Juxtaposition and sub matrix C= [A B], C=[A;B], C=A(:,1), A(:,1), A(1:2,1:2’]
3- Elementary operations with matrices A+B, A-B, A.*B and A*B, A./B
4-ones(m,n), zeros(m,n),
Complex numbers
1-imaginary unit is i or j but j is preferred professionally, since, ‘i’ is as current unit in electrical engineering , note that there is no need to write * before i,j
2- real part: real(Z), imaginary part: imag(Z), magnitude abs(Z), angle by angle(Z)
3- Arrays of complex numbers
System of linear equations: AX=B
1- Determinant: det(A)
2- Crammer’s rule: X=[det(D1);det(D2);det(D3)]/det(A), D1=A, D1(:,1)=B, D2=A, D2(:,2)=B, …..
3- Matrix inversion inv(A)
4-Solving systems of linear equations in MATLAB
Polynomials
1-Polynomial representation: by its coefficients
2- Getting roots: roots(coeff)
3- Multiplication is achieved by convolving conv(c1,c2)
4-Division is achieved by deconvolving deconv(c1,c2)
Programming in MATLAB
1- Programming a function: function y=Alan(x1, x2)
2- Repetitive control structure- FOR LOOPS: e.g.
for K=1:1:10
P(1,k) =sqrt(k);
End
3- Conditional control structure:
If condition
Expression
Else if condition
Expression
Expression
Else
Expression
end
4- Repetitive control structure- WHILE LOOP
External files and programs:
1-Saving data: save filename.mat variable / save(filename, variables)
2- Loading data X=load(filename.)
Differential and integral
1- Calculating differential: diff(x)/interval : consider that length of diff(x) is less that length of x
2- Calculating Integral: sum(x)*interval
Best
Ali
post no 12
ps:
I found this video channel for you. unfortunately, it has no voice.
pps:
More tutorials:
Introduction to MATLAB by D.F. Griffiths
I am uploading a series of videos on my YouTube channel , but it’s matter of time. Please subscribe. and get the latest updates
Meanwhile, I introduce the following:
- Testbench.in : System Verilog and VMM tutorial with a lots of example
- Asicguru.com : Another nice SV tutorial site
- Doulos SV Tutorial : Not that much extensive, but still good
- Another decent tutorial from Project-Veripage
- SV Tutorial from ASIC-World. It is not yet complete, but once it is complete, then it will be another great site to learn SV.
I am uploading a series of videos on my YouTube channel , but it’s matter of time. Please subscribe. and get the latest updates.






