This introduction assumes that you have already subscribed (registered) for access to university centrally provided computers and that you already have a user id, something like "fb2a21" (Fred Bloggs mkII January 2021) and a password. Your user id is fixed and is the first part of your e-mail address, "fb2a21@soton.ac.uk". You should be able to use the same password for all computers that you use as part of your course.
Using your user id and password.
The NoMachine Enterprise Client program allows you to log in to a remote Unix machine and run programs as if you were using the machine directly.
In this lab you want to log in to a Unix machine named cadteaching8.ecs.soton.ac.uk which supports most of the CAD software that you will use.
You should be able to run the NoMachine Enterprise Client by typing NoMachine into the search box at the bottom of your Windows 11 desktop.
Add connection - Machine Address Name: [ CAD ] Host: [ cadteaching8.ecs.soton.ac.uk ] Port [ 4000 ] Protocol [ NX ] Add
After clicking Add, you should then double-click the newly created CAD * NX session which will bring up a login prompt into which to enter your user id and password.
You can ignore warnings about authentication checks - since this is the first time you've run NoMachine Client it will be unable to authenticate any remote host computer.
For this first session you will need to select "New Desktop" , "Create a new virtual desktop", "OK", "OK", "Change the remote display to match the window", "OK". For subsequent sessions you may wish to connect to an existing session instead of creating a new session.
If all goes well, you should end up with a screen looking something like the one below:
If you do not have any terminal windows visible, you should create one now using the drop down Applications menu in the top left of the screen:
Applications -> Terminalor
Applications -> MATE Terminal
Although most tools that you will use are graphical in nature, they will usually be invoked through the unix command prompt (by typing) rather than through the use of icons, menus and pointers (as with Microsoft Windows). This allows for proper use and understanding of directories, an area that is very poorly supported by Microsoft's philosophy.
Move the mouse cursor over a terminal window to activate it (the border colour of a window shows whether or not it is active):
This window activation policy is called Focus Follows Mouse. The alternative Click To Type policy is also supported by the Unix machine but is less useful for the Magic layout editor that you will be using as part of your CAD work.
The following walkthrough introduces a number of key unix commands by example.
Commands to be introduced: mkdir pwd cd ls
Note that another name for a directory is a folder.
cadteaching8<~>$ mkdir /home/<userid>/design
Like many unix command names, mkdir is an abbreviation, in this case for make directory. You should notice that this command is silent. If it works, it doesn't print anything to the screen. This turns out to be very useful when it comes to writing scripts with unix, where 100 commands may be run in sequence but only the ones that fail will print anything to the screen.
If you haven't got the expected cadteaching8<~>$ prompt, you should be able to get one by starting a new bash shell:
bash-4.1$ bash --login cadteaching8<~>$
cadteaching8<~>$ mkdir /home/<userid>/design/magic/test
This command fails and prints an error message because the parent directory, /home/<userid>/design/magic, doesn't yet exist.
cadteaching8<~>$ mkdir -p /home/<userid>/design/magic/test
Options in unix are indicated by "-". The -p option causes all non-existent parent directories to be made.
cadteaching8<~>$ mkdir design/cadence cadteaching8<~>$ mkdir -p design/verilog/test
Here the pathnames are relative to the current working directory.
cadteaching8<~>$ pwd
cadteaching8<~>$ cd design
cadteaching8<~/design>$ ls
cadteaching8<~/design>$ ls -l cadteaching8<~/design>$ ls -a cadteaching8<~/design>$ ls -a -lThe hidden items "." and ".." are listed when the -a option is included.
"." is a shorthand for the current working directory, while ".." is a shorthand for the parent directory. Thus "ls ." lists the current directory and is equivalent to "ls", while "ls .." lists the contents of the parent directory.
cadteaching8<~/design>$ ls -al ~/design
This command also introduces another shorthand; "~" is a shorthand for your home directory.
At the end of this section you should have created the hierarchy of directories shown below. This hierarchy will be used in subsequent labs.
Commands to be introduced: cp mv cat nedit print
cadteaching8<~/design>$ cp /opt/cad/bim/labs/begin/sverilogfile .
Remember that "." is shorthand for the current working directory.
cadteaching8<~/design>$ mv sverilogfile ~/design/verilog/test
cadteaching8<~/design>$ cd ~/design/verilog/test cadteaching8<~/design/verilog/test>$ cat sverilogfile
cadteaching8<~/design/verilog/test>$ configure_nedit;The command to open nedit is:
cadteaching8<~/design/verilog/test>$ nedit sverilogfile &
Note the & character at the end of the command. This causes the command to run in the background so that you can continue to use the terminal window while the nedit program is running. Moving the mouse cursor between windows allows you to type in one or other window. You can change the text in the nedit window, but you should probably quit nedit without saving any changes if you want the rest of the walkthrough to work.
A good text editor is vital for unix since the vast majority of unix files are text files - unix users like the idea that files should be readable by humans as well as by computers.
cadteaching8<~/design/verilog/test>$ xmverilog sverilogfile
The xmverilog simulator looks like other unix commands, taking one or more arguments (the names of the SystemVerilog source files) preceded by options (e.g. the quiet option -q):
cadteaching8<~/design/verilog/test>$ xmverilog -q sverilogfile
cadteaching8<~/design/verilog/test>$ mv sverilogfile example1.sv
cadteaching8<~/design/verilog/test>$ print -d <printername> example1.sv
Note here that the argument for print is example1.sv while the <printername> is the argument for the option -d.
In order to complete this task you need to know the name of a printer that is close to your desk.
The printers in the Zepler computing labs and other university computer labs used for teaching can be accessed as "mono" (black and white postscript) and "colour" (colour postscript). Print jobs are initially queued and must then be explicitly released by logging into any of the printer/copier machines in these labs.
If you have not previously printed using the university's managed print system, you will have to buy some print quota before you are able to print. You can get to the print quota page via the Applications menu in the top left of the screen:
Applications -> Web Pages -> Print Quota Page
While working with unix you are likely to come across alternative print commands, lp and lpr. The print command introduced above is actually a non-standard command supplied by the University's iSolutions team to interact with peculiarities of the campus printing system. The formats for these two print commands (where supported) would be:
lp -d <printername> <filename> lpr -P <printername> <filename>Note that different commands use different options (in this case -d and -P to specify the chosen printer).
cp /opt/cad/bim/labs/begin/sverilogfile ~/design/verilog/test/example1.sv
ls ~/desi<tab>v<tab>t<tab>
Where possible, the <tab> key performs "filename completion". This means that "~/desi<tab>v<tab>t<tab>" should become "~/design/verilog/test/".
Commands to be introduced: ln
With a symbolic link a file or directory may appear in more than one place in the directory hierarchy.
cadteaching8<~/design/verilog/test>$ cd ~
cadteaching8<~>$ ln -s design VLSI_Files
Note that the -s option tells the system to create a symbolic link rather than a hard link. Hard links cannot be used for directories and will not be discussed further in this introduction.
ls ~/design ls ~/VLSI_Files ls -l ~/VLSI_Files
Commands to be introduced: rm rmdir
rm <filename>
rmdir <dirname>
This will only work if the directory is empty.
rm -r <dirname>
Use these commands with caution. There is no undo for unix rm/rmdir.
In the following walkthrough, simple tools are invoked from the drop-down menus (Applications, Places, System):
or the desktop pop-up menu:
this pop-up menu is a context sensitive menu. Context sensitive menus are accessed using the right hand mouse button (also known as the MENU mouse button). The items found on the menu will depend on what is under the cursor (e.g. the desktop background pattern, the title bar of a window or a desktop icon) when the MENU button is pressed.
Use the Open Terminal option on the desktop pop-up menu to open a new terminal window (remember to use the right mouse button). Note that you have already seen how to open a terminal window from the Applications menu at the beginning of this walkthrough. Having the ability to open a terminal from the desktop pop-up menu saves you having to move the mouse over to the Applications menu.
As an example of the use of the Applications sub-menus you should open a new terminal window for a remote computer by selecting cadteaching7 from the Remote Login sub-menu:
Applications -> Remote Login -> cadteaching7
A new terminal window will open and you will be requested to enter your password.
You can type the same unix commands in this new window as you have already used. Since you have a single CAD home filestore, you will see the same files on the remote computer as you see locally (use the ls command to check that this is true).
There are a number of reasons for using this remote login facility:
Start the file manager from the Places menu:
Places -> Home Folder
A file manager window should open:
Note that the window may not look identical to the picture above (The file manager provides a number of view styles which can be selected via the view menu or via the the main toolbar. The style above "Icon View" but you may find that the the file manager starts in "List View").
Using the file manager, navigate to the file ~/design/verilog/test/example1.sv. You should be able to select the file and pop-up a menu with an option to Open with "Nedit" (remember to use the MENU button on the mouse for pop-up menus):
If all goes well the file will be opened in a new nedit window.
The ECS Web pages include course notes and lots of useful reference material. The information may be viewed using the Firefox Web browser.
The majority of your CAD laboratory notes (including this document) are published on the Web and can be found via the CAD Tools & Techniques home page:
Applications -> Web Pages -> CAD Notes Page
After a short delay you should find yourself looking at the CAD Tools & Techniques home page, its Web address or URL is https://secure.ecs.soton.ac.uk/notes/bim/notes/cad.
Use the Web Browser to find this page; An Introduction to Unix for CAD users.
All ECS communication is via e-mail. You are expected to check your e-mail regularly in order not to miss important messages. When communicating with university staff you should use your university e-mail account rather than any other account that you have access to.
The UoS Mail option on the Web Pages sub-menu takes you to the default mail client which is the university web mail service.
Open a suitable mail client and compose a mail message to another student who is working on these exercises. Check that you can read a message sent by another student.
Remember, your e-mail address is your user id followed by "@soton.ac.uk" (e.g. fb2a21@soton.ac.uk)
Do the following walkthrough if you have time.
Commands to be introduced: chmod
When working as part of a team you may need to allow other team members to access your files. When working individually it is important to ensure that no other student may access your work. The command to use in either case is "chmod". This command modifies the rwx (read, write and execute) permissions for a file or directory.
Copy and paste the following text into the text file:
<HTML> <HEAD> <TITLE> Page Title: My Home Page </TITLE> </HEAD> <BODY> <H1> My Home Page </H1> <P> Hello </P> <UL> <LI> <A href="public/file.html"> Public </A> <LI> <A href="private/file.html"> Private </A> </UL> </BODY> </HTML>
Note - when editing this file using "nedit", try selecting the Preferences -> Highlight Syntax option.
<HTML> <BODY> <H1> My Public Page </H1> <P> Hi </P> <UL> <LI> <A href="../home.html"> Home </A> </UL> </BODY> </HTML>
<HTML> <BODY> <H1> My Private Page </H1> <P> Bye </P> <UL> <LI> <A href="../home.html"> Home </A> </UL> </BODY> </HTML>
chmod -R go+rX ~/sandbox
and make sure that other users can get to the directory by giving them execute permission to its parent directory:
chmod go+x ~
chmod -R go-rx ~/sandbox/private
(Type "man ls" to find out how to decode the first 10 characters of the output from this command which has the format ".rwxrwxrwx")
In the following commands, substitute <other_userid> for the user id of the other student:
ls -l ~<other_userid>/sandbox cat ~<other_userid>/sandbox/home.html ls -l ~<other_userid>/private cat ~<other_userid>/private/file.html
Although these HTML pages are not on the Web, the Firefox web browser allows you to view the pages and follow links from one page to another (unfortunately getting permission for your own university web page takes too long to be done in this session) :
firefox ~/sandbox/home.html &
To view somedody else's page :
firefox ~<other_userid>/sandbox/home.html &
What happens when you try to access these locations and follow the "Public", "Private" and "Home" links?
Is it what you expected to happen?
chmod go-x ~
Note that instead of using "chmod" and direct access (as above), files may be transferred via e-mail. Unfortunately Windows mail tools such as "Outlook" have a habit of corrupting Unix CAD files! If you are working in a team, a simple and reliable way to send CAD files is via the university's SafeSend service. A better (but more complex) solution to sharing files as a team is the university's Git service.
Commands to be introduced: echo sleep if-then-else-fi
Copy and paste the following text into the text file:
echo Hello World sleep 5 echo bye
This simple script contains two simple echo commands which print their arguments to the screen separated by a sleep command which yields a 5 second delay.
cadteaching8<~>$ chmod +x ~/script/script1
cadteaching8<~>$ ~/script/script1
#! /bin/sh echo Checking directory structure for user: $1 if [ -d "/home/$1/design/cadence" ] then echo "Found Cadence directory" else echo "No Cadence directory" fi if [ -d "/home/$1/design/magic/test" ] then echo "Found Magic test directory" else echo "No Magic test directory" fi if [ -d "/home/$1/design/verilog/test" ] then echo "Found verilog test directory" else echo "No verilog test directory" fi if [ "$2" = "autocorrect" ] then echo "autocorrecting..." mkdir -p "/home/$1/design/cadence" mkdir -p "/home/$1/design/magic/test" mkdir -p "/home/$1/design/verilog/test" fi echo done
cadteaching8<~>$ chmod +x ~/script/script2
cadteaching8<~>$ echo $PATH
This script uses the powerful if-then-else-fi construct to optionally execute one command or another dependent on certain conditions.
The script also makes use of arguments. The first argument (named $1 within the script) is the user id. The second argument ($2) is optional and supports the auto-correction function of this script.
cadteaching8<~>$ rmdir ~/design/cadence cadteaching8<~>$ script2 <userid>
cadteaching8<~>$ script2 <userid> autocorrect cadteaching8<~>$ ls -ld ~/design/cadence
Scripts are a powerful way to save time where the same sequence of tasks is run again and again. As you become a more experienced user of unix for CAD work, you should write your own scripts as well as using scripts that are written for you.
Commands to be introduced: head tail wc grep sed
Unix includes a number of text processing commands that can be used directly or included in your scripts. Rather than discuss these in detail we will just show some examples here.
cadteaching8<~/doc>$ cat textfile cadteaching8<~/doc>$ head -5 textfile cadteaching8<~/doc>$ tail -5 textfile cadteaching8<~/doc>$ wc -l textfile cadteaching8<~/doc>$ grep file textfile cadteaching8<~/doc>$ sed -e 's/text/TEXT/g' textfile
cadteaching8<~/doc>$ cat -n textfile cadteaching8<~/doc>$ cat -n textfile | head -20 | tail -10 cadteaching8<~/doc>$ cat textfile | grep 'e.g.' cadteaching8<~/doc>$ cat textfile | grep 'e.g.' | sed -e 's/textfile/<filename>/g'
Commands used in this exercise:
Use the manual command to examine the on-line manual pages for these commands.
e.g. type "man ls" to find the manual page for the list command including the two options that you have already encountered and a host of other options that you may find useful.
By the time your next lab starts it is assumed that you will all be familiar with the concepts and tools described in this lab. It is expected that any lab work not completed within a scheduled lab session will be completed before the next lab session. (N.B. Since time is short for this lab it may not be possible for you to finish all the advanced unix section before the next lab - nevertheless you should ensure that this work is finished within one week of your lab session)
You will need a laboratory log book for your CAD tools & techniques work. The log book should be hard backed (not spiral bound) and A4 in size. You will need to bring your log book to every CAD lab session and you should also use it for every VLSI Systems Design assignment.
This is where you will record your work during the laboratory sessions so that you can refer back to it later. This is where you should do all design work for your assignments. There is no need to bring any loose blank paper to the lab sessions as you will not use it - all work, however rough, is to be done in the log book.
You should also bring Scissors and Glue to every lab session so that you can stick lab sheets and printed results into your log book.
For simple walkthrough labs such as this one, you may need to do little more than stick the lab sheet into your log book, date it and add comments and highlights where you feel it appropriate. If you have reached the end of the lab without finding anything worthy of comment, you probably haven't been following it well enough. For walkthrough labs it is not sufficient to have completed all the stages, it is also necessary to have understood what you have done, so that you can apply your knowledge in future.
Iain McNally
30-09-2024