CS270 Tools

There are two set of tools unique to the CS270 class. They are:
  1. The LC3 tools (assembler and simulator) used for assembly language programming on the LC3 computer. The tools are located in the directory ~cs270/lc3tools. There are three tools you will use:
  2. The Logisim tool for digital logic simulation. The tool is located in the directory ~cs270/logisim. The tool is named logisim

Accessing the CS270 tools

When you need to run the tools, you may access them by giving the full path. For example, to run the LC3 assembler you would enter:

~cs270/lc3tools/lc3as

Similarly, to run the logisim simulator you would enter:

~cs270/logisim/logisim

Easier access to the CS270 tools

When you enter a command like java or gcc the shell you are running must find the actual executable to run. It does this by using the $PATH variable defined by your shell. The $PATH variable is list of directories to search for commands. The directories are searched in the order they occur in the $PATH variable.

By adding the paths to the CS270 tools to the $PATH variable, you will only need to enter the name of the command, not the full path. Where the $PATH variable is defined is a function of the shell you are using.

WARNING: do not add ~cs270/bin to your path. Since each course has its own copy of checkin, adding the course bin directory to $PATH may cause you to check an assignment in to the wrong place.

Determining what shell you use

To determine what shell you use, enter:

     finger yourLoginName

One of the fields printed will be the shell you use. Adding to the $PATH differs slightly for different shells. Below are instructions for tcsh (the current CS default shell) and bash.

Setting the $PATH for tcsh

Use your favorite editor to edit the file ~/.cshrc. You will find a line like:

set path = (/usr/ucb /bin /usr/bin /usr/local/bin /usr/local/gcc/bin)

Individual paths are separated by a space. You may add the tools paths to this line. However, you may find it convenient to define a new variable like this:

     set CS270 = (. ~cs270/lc3tools ~cs270/logisim)

and then append it to the original $PATH variable by adding a line after the original definition like:

     set path = ($path $CS270)

By adding . as part of $PATH, the shell will look in the curent directory. This is handy so that when you compile a C program, you may execute it by simply typing its name. Otherwise, you will need to prefice its name with ./

Setting the $PATH for bash

Use your favorite editor to edit the file ~/.bashrc. You will find a line like:

     set PATH="/usr/ucb:/bin:/usr/bin:/usr/local/bin:/usr/local/gcc/bin:/usr/bin/X11:/usr/X/bin"

Individual paths are separated by a colon. You may add the tools paths to this line. However, you may find it convenient to define a new variable like this:

     CS270=".:~cs270/lc3tools:~cs270/logisim"

and then append it to the original $PATH variable by adding a line after the original definition like:

     PATH="$PATH:$CS270"

By adding . as part of $PATH, the shell will look in the current directory. This is handy so that when you compile a C program, you may execute it by simply typing its name. Otherwise, you will need to preface its name with ./

Checking you change is successful

One you have completed the edit, save the file and exit the terminal. Then start a new terminal. You may now enter:

     echo $PATH

and you should see the CS270 directories listed at then end. Now you can access the tools by simply using their name.

Fritz Sieker - Jan 2012