Below labs are focused on file and directory management and file editing. This is an important aspect of job. When someone is moving from Windows OS to Unix OS, most of the times their work starts with directory and file handling. Please follow instructions as below.

  1. File & Directory management
    Step#1
    Check current working directory using pwd command
    enter cd ~
    this command will take you to your home directory (ex: /home/VLSIGuru is my home directory)

Step#2:
If you are working on Cygwin
go to C drive using cd C:/
pwd //check current working directory
go to D drive using cd D:/
now come back to your home directory using cd ~ command

Step#3:
Create a folders as per below structure : mem_ctrl
create a directory mem_ctrl
mem_ctrl has 2 sub directories : design, verif
design has two sub directories : rtl and docs
rtl has a sub directory : verilog
verif has 5 sub directories : top, wb, ref, sim, mem

Step#4:
List all the directories using below command from your home path
find . -name “*” -type d
understand what above command does

Step#5 (how to move across directories)
go to various directories
how to go to ref directory: cd mem_ctrl/verif/ref
now go to rtl directory : cd ../../design/rtl
now go to docs directory : cd ../docs
now go to top directory
now go to home directory

Step#6 (Installing GVIM and enabling Syntax in GVIM)
Learn how to work with GVIM
Install GVIM from google
Enable Verilog and Systemverilog syntax (Do google)
update ~/.vimrc file with following content
set nocompatible
set hlsearch
set incsearch
set number
set showmode
set syntax=ON
set autoindent
set tabstop=4
syntax on
Now open any SV files, it should show the SV syntax highlighted

Step#7 (creating files)
create following files and enter following text in each file
verilog/mc_top.v
module mc_top;
endmodule
top/top.sv
module top;
mc_top mc_top_i();
endmodule
wb/wb_env.sv
class wb_env;
endclass
ref/mc_ref.sv
class mc_ref;
endclass
mem/sram.v
module sram();
endmodule

Step#8
take backup of mem_ctrl directory
cp -rf mem_ctrl mem_ctrl_backup

Step#9:
Moving directories
Move top directory to mem_ctrl/design/rtl
Move verilog directory to mem_ctrl/verif
Move docs to mem_ctrl/design/rtl
Move wb to mem_ctrl/design/rtl/verilog
Move ref to mem_ctrl/design
Move mem to mem_ctrl/design/rtl/docs
Move mem_ctrl/design/rtl to mem_ctrl/verif
Bring back all directories to original structure

Step#10
Moving files
move top.sv to wb directory
move mc_ref.sv to rtl directory
copy sram.sv to verif/top directory
copy wb_env.sv to verilog directory
bring back the directories to original structure
– remove the copied files
– move the files back to original directories

Step#11
Working with files
Open top/top.sv
type following code in mc_top.v
#########################################################
module top;
mem_env env;
// generate clk and rst
reg clk,rst;
// interface instation
mem_intf m_inst (clk,rst);//static
// dut instantion
mem mem1(
.clk(m_inst.clk),
.rst(m_inst.rst),
.wr_en(m_inst.wr_en),
.addr(m_inst.addr),
.wr_data(m_inst.wr_data),
.rd_data(m_inst.rd_data)
);
initial begin
mem_cfg::vif=m_inst;
end
// env instation and running process
initial begin
env=new();
env.run();
end

initial begin
clk=0;
forever #5 clk <= ~clk;
end
initial begin
rst=1;
repeat(2)@(posedge clk);
rst=0;
end
initial begin
#500 $finish();
end
endmodule
#########################################################

Step#12:
Split above file and open design/rtl/verilog/mc_top.sv
Open all the 5 files in same window
Use Ctrl+w, up/down arrows to move across the split windows
Copy the whole content of top.sv to mc_top.sv

Step#13:
open top.sv
learn what is the use of : and /
use :set nu => to set the number
use :set nonu => numbers are removed
again set the numbers
Do following without using up and down arrows
go to end of the file (:$)
go to 1st line of the file
go to 10th line of the file
go to last character of the 14th line
go to 3th word in 7th line
go down 5 lines from here(5 enter)

Step#14:
Line copy and pasting, Lane cutting and pasting
go to top.sv
– cut first line in top.sv, paste it in the end of the file
– cut the last line and paste it in top of the file
– cut 4th & 5th lines and paste them at line number 10(they will be 11th and 12th lines)
– copy 3rd line and paste it in 1st line
– copy 10th line and paste it in end of the file

Step#15:
Word copy and pasting, Word cutting and pasting
go to top.sv
– cut first word in the first line of top.sv, paste it in the end of the line in the end of the file
– cut last word in 4th line and paste it in 1st line as 2nd word

Course Registration