skip to primary navigationskip to content

Course pages 2021–22

ECAD and Architecture Practical Classes

Exercises 1: SystemVerilog web tutor and tools setup



Scheduling

You should expect to complete Exercise 1a in the first week. You should also aim to complete setting up your tools environment and files checkout in the first week.



Exercise 1a: Introduction to SystemVerilog via web tutor

Please login to our SystemVerilog web tutor to learn more about the SystemVerilog language and complete the exercises.



Tools setup

Please follow the setup instructions for configuring tools on your computer. It may take some time to download and configure the necessary items.

Git repository setup

For the lab we'll be using the chime autoticker as used by IA Object Oriented Programming and IB Further Java. You are likely already familiar with checking out a chime repository, but if not follow the steps below. We recommend doing this inside your VM/Docker/MCS environment, apart from Windows on Docker (see notes in the Docker setup).

Shortcut: if you are already familiar, here's the link to the chime task. Clone the git repository from that task and it will provide the files you need for the labs.

SSH keys for chime

First, we need to create an SSH key to allow us to pull and push code to chime. Open a terminal and type:

ssh-keygen -t rsa

You can accept the default location. It is good security practice to add a passphrase to the key, which you will be asked for every time you wish to use it.

SSH Agent is a way for your system to remember the key for a short while if you use it a lot - your system keyring may already support that.

Once you have answered the prompts, your public key will be saved in the .ssh hidden folder in your home directory - on the VM the key is in /home/ecad/.ssh/id_rsa.pub Open this file in a text editor - in the VM you could use geany /home/ecad/.ssh/id_rsa.pub. You should see the file has one very long line, starting ssh-rsa AAAA.

Next, open a browser and go to chime.cl.cam.ac.uk. Click on 'SSH keys' and then 'Register new key'.

Going back to your text editor, select and copy the whole line beginning ssh-rsa AAAA, including the portion off the edge of the screen. Paste it into the 'SSH key' box on the webpage - the paste should end username@hostname, in the VM ecad@ecad-VirtualBox. Click 'Add new key'. chime should now show the key listed.

Cloning the initial git repository

Now chime knows your SSH key you can clone the git repository. First, go to the the ECAD task on Chime.

Keep the repository name ecad_labs and click 'Start task'.

You should be taken to a page which gives the command to clone with SSH. For example:

git clone [Javascript required]:abc21/ecad_labs

Copy this command into your terminal (including the 'git clone'). You should see:

git clone [Javascript required]:abc21/ecad_labs
Cloning into 'ecad_labs'...
The authenticity of host 'chime.cl.cam.ac.uk (128.232.98.124)' can't be established.
RSA key fingerprint is SHA256:wlf1tj3n5/huXE21qW/7swIbXAst0u7+FsMPtEOMA6k.
Are you sure you want to continue connecting (yes/no)? 

Type 'yes' (you'll only need to do this the first time)

Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'chime.cl.cam.ac.uk,128.232.98.124' (RSA) to the list of known hosts.
remote: Counting objects: 94, done
remote: Finding sources: 100% (94/94)
remote: Getting sizes: 100% (93/93)
remote: Compressing objects: 100% (750946/750946)
remote: Total 94 (delta 18), reused 0 (delta 0)
Receiving objects: 100% (94/94), 310.73 KiB | 0 bytes/s, done.
Resolving deltas: 100% (18/18), done.
Checking connectivity... done.
ecad@ecad-VirtualBox:~$

Now look in the ecad_labs folder. You should see a number of directories for different exercises - you are now ready to begin.

Saving your work using git

Since the files are in a git repository, you can use git to save your work on the chime server. You will need to do this to run the autoticker against your code. There are many guides on using git, so here is only a brief outline.

In the terminal, cd into the ecad_labs folder. The first time you use git you'll need to set your name and email address:

$ git config --global user.name "Your Real Name"
$ git config --global user.email [Javascript required]

(you can use any email address you like - it will become part of the commits you make to the repository and not easy to change later. With the --global flag it will also be used for other git projects on your machine.)

Git has three stages of recording a commit:

  • git add tells git to keep track of new files, or to add the listed files to the next commit. For example: git add example.txt.
  • git commit takes the added files and records the changes in a commit, including a message and your name/email. For example: git commit. You might use instead git commit -a which looks for changes in all the files previously added, and records all those it finds in a commit.
  • git pushtakes the commits you made locally and synchronises them with the server (specifically a branch named 'origin')

When using git commit, it will ask for a commit message by starting your default editor. You may wish to use git commit -a -m "A line describing what I changed" to avoid starting the editor each time. If you want you can change the editor: export EDITOR=nano or export EDITOR=vim or some other editor.

You can also use git status to inspect which files git expects to include in the next commit.

A typical workflow for the labs might be:

(edit ex5_riscv/assembly/src/div.s, a file already from the repository)

git commit -a -m "Fixed bug in my division code"
git push