Session 5: LINUX,
VIM, EDA
1. LINUX
2. VIM
. 3. EDA
1
LINUX ENVIRONMENT
Why Linux is widely used among semiconductor companies ?
2
LINUX ENVIRONMENT
Many semiconductor companies use Linux environments for
various reasons:
❑Open source
❑Customization
❑Stability and Reliability
❑Cost efficiency
❑Security
❑Ecosystem
3
COMMON LINUX COMMANDS
Command Description Example
ls List a directory content ls <dir_name>
ls
pwd Shows the current working path pwd
cd Change the current working directory cd <dir_name> : go to <dir_name>
cd .. : go to upper 1 level
cd - : go back to directory before entering current directory
mkdir Creates a new directory mkdir <dir_name>
tree Display the hierarchy of current location tree : display full hierarchy of current location
tree –L 2: display hierarchy of 2 level from current location
rm Remove file or directory rm –rf <dir_name/file_name>
cp Copy file or directory cp –rf <dir_name/file_name> <new_file/new_location>
mv Move file or directory mv <dir_name/file_name> <new_file/new_location>
touch Create a new empty file touch <file_name>
cat Print the content of file to Linux terminal, cat <file_name>
or concatenate files together cat <file_1> <file_2> … <file_n>
4
LINUX ENVIRONMENT
Common Linux Commands
Lab1: create working directory
1. Login to ICTC, enter your provided ID and password
2. Open Terminal
3. At your home directory, create a folder named “05_ss5_practice” and create below hierarchy under it:
|--05_ss5_practice
| |-- lab1
| |-- lab2
| |-- lab3
4. Create an empty file, named “lab1.txt” under lab1
5. Change the file name from “lab1.txt” to “lab1_<your_name>”.txt, example lab1_duc.txt
6. Copy /ictc/student-data/share/teacher/05_ss5_practice/lab1/lab1.txt under your lab1 folder
7. Display the content of lab1.txt in your lab1 folder, it should appears the message “You PASSED this lab”.
Lab2: modify working directory
1. Copy lab3 under lab2 and change the directory name (of lab3 under lab2 folder) to lab2_subdir
2. Replace lab2_subdir directory by /ictc/student-data/share/teacher/05_ss5_practice/lab2/lab2_subdir
3. Check if there is a README file inside 00_linux/lab2/lab2_subdir. If it is existed, display the content of README.
it should appears the message “You PASSED this lab”.
5
OTHER LINUX COMMANDS FOR SELF-LEARNING
Command Description Example
grep Search a string within a file grep <string> <file_name>
du Check the size of the file or directory du –sh <file/dir_name>
clear Clear terminal clear
diff/vimdiff Check difference between files diff/vimdiff <file_1> <file_2> … <file_n>
find Find a file, directory find <location> -name <file_name> : find <file_name> in <location>
dind <location> -type d –name <dir_name> : find <dir_name> in
<location>
echo Print something to terminal echo “text”: print “text” to terminal
echo “file.txt”: print “file.txt” (the file name is file.txt) to terminal
date Print current date date
head Display the beginning of the file head –n 10 <file> : display first 10 lines of <file>
tail Display the end of the file tail –n 10 <file> display last 10 lines of <file>
6
LINUX ENVIRONMENT
VIM Editor
❑ Vim is a text editor for Unix. It is mainly because it can be managed entirely without menus or a mouse
with a keyboard
❑ Vim is a powerful text editor popular among developers. It's based on shortcuts, called the Vim
language, which can make coding and writing faster and more efficient.
❑ To open Vim, on Linux terminal you can use: vi <file_name>
❑ We have 2 common modes usually used in Vim:
➢ Insert mode: for typing text
▪ To switch Insert mode, use can type “i” and “insert” on keyboard, so you can start editing the
file.
▪ To exit this mode, use “Esc” on keyboard (back to command mode)
➢ Command mode: You can execute commands like undo, redo, find and replace, save, quit, etc. This
mode is default mode when starting VIM.
7
LINUX ENVIRONMENT
VIM Editor – Common commands
Type of command Command Description
Delete command x or “delete” on keyboard To delete the character
dd To delete the current line
Copy, Paster command yy Copy current line
P Paste the line and place it below the cursor
Save and exit file :w Save the file
:w <file_name> Save the file to another file with name is “file_name”
:wq Save and quit
:q! Exit but not save
Search and replace /text Forward search with text keyword
?text Backward search with text keyword
n Find the previous match string
N (Shift + n) Find next match string
Undo and redo u Undo the last command
ctrl + r Redo 8
LINUX ENVIRONMENT
VIM Editor: Self-Learning
Type of command Command Description
Others :vs Vertically split widows
To change to other split windows, do either below:
1.set mouse=a then move the mouse to other window
2.ctrl+w → left arrow button to go to left, right arrow button to go to right window
:sp Horizontally split window
To change to other split windows, do either below:
1.set mouse=a then move the mouse to other window
2.ctrl+w → upward arrow button to go up, downward arrow button to go to bottom
window
gg Go to first line of the file
GG Go to final line of the file
:set nu Display line number
:%s/text1/text2/g Replace string text1 by text2
9
LINUX ENVIRONMENT
Working directory
Lab3
Step 1: Make directory tree as below under lab3, all the files are empty
|--lab3
| |--rtl //design dir
| | |-- top.v //design file
| |--sim //simulation dir
| | |-- rtl.f //rtl list
| | |-- tb.f //testbench list
| | |-- compile.f //compile list
| | |-- Makefile //run script
| |--tb //testbench dir
| | |-- test_bench.v //testbench file
10
LINUX ENVIRONMENT
Working directory
Step 2: Open top.v and type exactly as below
module top (
input wire a,
input wire b,
output wire z
);
assign z = a ^ b;
endmodule
11
LINUX ENVIRONMENT
Working directory
Step 3: Open rtl.f tb.f compile.f and type exactly as below:
rtl.f tb.f compile.f
../rtl/top.v ../tb/test_bench.v -f rtl.f
-f tb.f
12
LINUX ENVIRONMENT
Working directory
Step 4:
▪ Copy Makefile from share/teacher/05_ss5_practice/lab3/sim/Makefile
and replace your Makefile.
▪ Copy folder tb from share/teacher/05_ss5_practice/lab3/tb and replace
your tb folder
13
LINUX ENVIRONMENT
Working directory
Basic environment is like below:
|--rtl //design dir
| |-- top.v //design file
|--sim //simulation dir
| |-- rtl.f //rtl list
| |-- tb.f //testbench list
| |-- compile.f //compile list
| |-- Makefile //run script
|--tb //testbench dir
| |-- test_bench.v //testbench file
% cd sim
% make build //compile the design and tb
14
LINUX ENVIRONMENT
Working directory
Basic environment is like below:
|--rtl //design dir
| |-- top.v //design file
|--sim //simulation dir
| |-- rtl.f //rtl list
| |-- tb.f //testbench list
| |-- compile.f //compile list
| |-- Makefile //run script
|--tb //testbench dir
| |-- test_bench.v //testbench file
% make run //run simulation
15
LINUX ENVIRONMENT
Working directory
Basic environment is like below:
|--rtl //design dir
| |-- top.v //design file
|--sim //simulation dir
| |-- rtl.f //rtl list
| |-- tb.f //testbench list
| |-- compile.f //compile list
| |-- Makefile //run script
|--tb //testbench dir
| |-- test_bench.v //testbench file
% make wave //open waveform
16
LINUX ENVIRONMENT
Working directory
Choose Layout → NoDesign to see the Choose signal → right click → Radix to
hierarchy in same window change signals’ display value
17
LINUX ENVIRONMENT
Working directory
Testbench schematic view
Choose hierarchy → right click → Add to
→ Schematic → Full to see the schematic
Double click to dut to see the dut schematic
18
LINUX ENVIRONMENT
Working directory
Press Ctrl and use scroll button on your mouse to zoom-in and zoom-out
Or Use (+) and (-) on your control panel
Can double click on the waveform signal for tracing value in the design
19
SESSION 5
SUMMARY
SUMMARY:
❑ CPU: acts as brain of the computer.
❑ MCU: often used for general purpose, includes: CPU, BUS, Memory, peripherals.
❑ SOC: often used for specific applications, structure same as MCU but more complex.
❑ Linux operating system is widely used in semiconductor industry.
❑ Vim is powerful Linux text editor.
❑ Makefile is one kind of Linux scripting, can be used to do multiple user tasks.
20
HOMEWORK
Homework1:
❑ Step 1: create homework folder under your 05_ss5_practice dir
❑ Step 2: Copy share/teacher/05_ss5_practice/homework/vimtutor.txt to your
homework directory
❑ Step 3: Finish all the lessions in the vimtutor.txt, marked “==>DONE” at the
end of all the Lession. Teacher will check the completion.
21
HOMEWORK
Homework2 (*):
❑ Investigate the Makefile and add following requirement
▪ When type “make help”, it will output
▪ When type “make clean”, it will remove all the file generated by the
simulation.
▪ When type “make all”, it will build and run the simulation
Keep the new Makefile under your lab3/sim directory
22