Spring 2016 :: CSE 502 - Computer Architecture

Directions for Logging in to SBRocks

For this course, we have set up the SBRocks cluster of CEWIT with all the tools you need for your assignments. To get started, do "ssh -Y sbrocks.cewit.stonybrook.edu" using your CS Unix ID and password. If unable to log in, email rt@cs.stonybrook.edu to ask for help (this is particularly true for ECE students, who will need to explicitly request accounts). Once logged in, run "ssh-keygen” to create a key pair – leave the passphrase empty.

SBRocks is a cluster of machines and sbrocks.cewit.stonybrook.edu is the cluster head. You should never run your simulations or compilations on the cluster head. Instead, you should choose one of the compute nodes of the cluster for your work. To do this, pick a random number A between 0 and 4, and another random number B between 0 and 34. Do "ssh -Y compute-A-B" to log in to your randomly chosen compute node. If your numbers didn’t work, pick two new random numbers and try again.

Once logged in to a compute node, execute the following command to set up your environment properly to be able to use course tools:

  • if using csh as your shell: do "source /home/facfs1/nhonarmand/cse502/cse502-cshrc"
  • if using bash as your shell: do "source /home/facfs1/nhonarmand/cse502/cse502-bashrc"
Note: You can check your shell using "echo $SHELL".
Note: Put the above commands in your .csh_profile or .bash_profile so that they are executed automatically upon your logging in.


SystemVerilog

Hardware designers usually use a Hardware Description Language (HDL) to describe their designs in such a way that is amenable to automatic translation to hardware using the so called "Synthesis Tools". HDLs are used for many tasks in a hardware design flow, including hardware description, testing and verification. In this course you will use an HDL for describing your design, and perhaps writing some test cases.

You will implement your designs in a subset of the SystemVerilog HDL. Although it is a hardware description language, SystemVerilog has many features that make it resemble high-level programming languages such as C or C++. Many of such advanced features, however, are primarily intended for testing and verification, and not hardware description. In this course, we will use a subset of the language that is called the "synthesizable" subset for describing our processors. A synthesizable subset is what a synthesis tool can automatically translate to hardware.

Do not panic if you have not used an HDL before! We will teach and discuss SystemVerilog and its synthesizable subset (which is frankly very simple) in enough detail in the class. We will also provide a SystemVerilog-to-C++ translator (called Verilator) to translate your SystemVerilog code to C++ code that can be compiled and run to simulate your design. We will provide the necessary testing infrastructure that you will compile together with Verilator's output to create a fully functional simulator for your design.


Homework 1

The goal of this homework is to get you started on SystemVerilog and writing test cases. To get the code, do "git clone /home/facfs1/nhonarmand/cse502/cse502-hw1.git". Please carefully read the README file for an overview of what you need to do for this homework.

You should work on this homework individually and not as a group. Each student should submit a separate solution.

Homework 2

The goal of this homework is to implement a direct-mapped cache that you can use in your course project later. To get the code, do "git clone /home/facfs1/nhonarmand/cse502/cse502-hw2.git". Please carefully read the README file for an overview of what you need to do for this homework.

You should work on this homework individually and not as a group. Each student should submit a separate solution.


Project

Overview

In this course, you will design and implement a SPARCv8-compatible processor. At the minimum, your processor will include a 5-stage pipeline (similar to the one covered in the class), multiple functional units with varying latencies, and direct mapped instruction and data caches. For more points, you can add other features (see below) to your processor. The grading scheme is as follows:

  • 5-Stage pipeline + direct-mapped caches (40 pts)
  • 5-Stage pipeline + set-associative caches (45 pts)
  • Above + super-scalar pipeline (60 pts)
  • All of the above + out-of-order execution (80 pts)
  • Multi-cycle divider and pipelined multiplier on top of any of the above (5 extra pts).
  • Branch prediction and speculative execution on top of any of the above (10 extra pts)
  • SMT on top of any of the above (10 extra pts)
  • Successful synthesis to FPGA on top of any of the above (10 extra pts)

I will provide the code for the multi-cycle divider and pipelined multiplier as part of the project sekelton code. Please read the code and comments carefully to make sure you know how to use them.
  • A pipelined multiplier accepts a new multiplication operation every cycle but generates the result after multiple cycles (just like a normal pipeline)
  • A multi-cycle divider accepts a new operation when the "start" signal is given and takes "n" cycles to finish it. After that, it can accept another operation.

Getting the Skeleton Code

Do "git clone /home/facfs1/nhonarmand/cse502/cse502-proj.git" to clone the skeleton code for the project. You should implement your processor by modifying the existing SystemVerilog files and adding new ones. "top.sv" is the top-level SystemVerilog file and "Core.sv" is your processor core. You may also need to modify "system.cpp" to emulate some OS features (e.g., support for register window overflow/underflow). Read the README file for more information.

Project Report

In addition to submitting your code (using "make submit"), you should also submit a short report (ideally, no more than 3 pages). It should provide a high-level overview of your processor pipeline, the implemented features and details of each pipeline stage—in particular,

  • General flavor of your processor: scalar or super-scalar, out-of-order or in-order, etc.
  • Instruction and data cache details
  • How your caches connect to the main memory (e.g., how you arbitrate between them)
  • Functional units implementations
  • Memory unit implementation
  • How you handle data and control flow dependencies
  • How you implement register window overflow and underflow situations
A well-organized and comprehensive report can substantially improve your project grade. It can help me and the TA identify important aspects of your design that we might overlook otherwise.

You should email your reports to me and the TA by the project deadline.

Target Instruction Set

Your processor should implement the user-mode (non-privileged) subset of SPARCv8 instructions. You can ignore the ISA subset related to the "Floating Point" instructions, "Alternate Address Spaces", "Ancillary State Registers" and the "Co-Processor" as well as any instruction that is marked as "privileged" in the SPARCv8 manual. Specifically, your processor needs to implement all the instructions (and the requisite architectural state) described in the following sections of the manual:

  1. Load/store instructions: B.1, B.4, B.7, B.8
  2. Arithmetic/logical/shift instructions: B.11, B.12, B.13, B.14, B.15, B.16, B.17, B.18, B.19
  3. Control transfer instructions: B.21, B.24, B.25, B.27
  4. Misc. instructions: B.9, B10, B20, B28 (only RDY), B29 (only WRY), B.30 (treat as NOP), B.31, B.32 (treat as NOP unless you have caches)

Traps and Interrupts

Your processor need not deal with external interrupts. It should treat all "exceptions" (i.e., traps caused by instructions) as precise—no deferred interrupts. Your implementation should correctly check for and generate all the exceptions described in the semantics of your implemented instructions.

Virtual Memory and MMU

Your processor need not include any virtual memory support. Hence, you don't need to implement an MMU and can ignore the issues related to the Address Space Identifiers (ASI).


Project Resources

SPARC Instruction Set

SystemVerilog Documents

Verilator

Waveform Viewers

  • GTKWave: Open-source, multi-platform waveform viewer (also installed on SBRocks)
  • SynaptiCAD WaveViewer: A more powerful and free waveform viewer for both Windows and Linux. Because they contain other tools, some of which are not free, the installation files are rather large.