README.md 3.9 KB
Newer Older
1
# [CASPER Tutorials](http://casper-tutorials.readthedocs.io/en/latest/) [![Documentation Status](https://readthedocs.org/projects/casper-tutorials/badge/?version=latest)](https://casper-tutorials.readthedocs.io/en/latest/?badge=latest) #
's avatar
committed
2

Jack Hickish's avatar
Jack Hickish committed
3
These tutorials serve as an introduction to CASPER's [Toolflow](https://github.com/casper-astro/mlib_devel), [Software](https://github.com/casper-astro/casperfpga), and [Hardware](https://github.com/casper-astro/casper-hardware).
's avatar
committed
4

Jack Hickish's avatar
Jack Hickish committed
5 6
# Downloading

7
You can download these libraries by cloning this repository and initializing a `mlib_devel` library version appropriate for your hardware platform.
Jack Hickish's avatar
Jack Hickish committed
8

Jack's avatar
Jack committed
9
```bash
10
# Clone this repository from github
Jack Hickish's avatar
Jack Hickish committed
11
git clone https://github.com/casper-astro/tutorials_devel
12

13
# Go into the repository directory
Jack Hickish's avatar
Jack Hickish committed
14
cd tutorials_devel
15

16 17
# Download libraries for your chosen platform.
# <platform> should be one of: "roach2", "snap", "skarab", "red_pitaya"
Jack's avatar
Jack committed
18 19 20 21
# For example, to download the libraries for the SNAP board, you should run:
#
# ./activate_platform snap
#
22
./activate_platform <platform>
Jack Hickish's avatar
Jack Hickish committed
23 24
```

25 26 27 28 29 30
# Installing Dependencies
## ROACH
For ROACH, you need Python 2.7 and python-pip. If you don't have these, you can probably install them with:

```bash
apt install python2.7
31
apt install python-pip
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
``` 

Once you have these, you can install all the dependencies you need with the following commands, run from the root directory of your repository (i.e., the `mlib_devel` directory):

```bash
# Install casperfpga dependencies
cd casperfpga
pip install -r requirements.txt

# Go back to the root of the repository
cd ..

# Install the requirements for your chosen platform
cd <your_platform_of_choice>/mlib_devel
pip install -r requirements.txt
```

## For non-ROACH platforms
For platforms newer than ROACH, you need Python 3 and python3-pip. If you don't have these, you can probably install them with:

```bash
apt install python3
54
apt install python3-pip
55
``` 
56
We thoroughly recommend using a [virtual environment](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#installing-virtualenv) to separate the version of Python and its libraries the toolflow uses from the rest of your system. 
57

58 59 60 61 62 63 64
To create a Python 3 virtual environment:

```bash
# change directory to where you want the virtual environment to live
cd /home/user/work
# install virtualenv using pip3
# create a Python 3 virtual environment
Jonathon Kocz's avatar
Jonathon Kocz committed
65
python3 -m casper_venv
66 67 68 69 70 71 72
# to activate the virtual environment:
source casper_venv/bin/activate
# to deactivate the virtual environment:
deactivate
```

Once you have these, you can install all the dependencies you need within your virtual environment with the following commands, run from the root directory of your repository (i.e., the `mlib_devel` directory):
73 74

```bash
75 76 77
# Activate your virtual environment
source /home/user/work/casper_venv/bin/activate

78 79 80
# Install casperfpga dependencies
cd casperfpga
pip3 install -r requirements.txt
Jonathon Kocz's avatar
Jonathon Kocz committed
81
pip3 install .
82 83 84 85 86 87 88 89 90 91 92
# Go back to the root of the repository
cd ..

# Install the requirements for your chosen platform
cd <your_platform_of_choice>/mlib_devel
pip3 install -r requirements.txt
```


# Local Configuration

Jack's avatar
Jack committed
93 94 95 96 97 98 99 100
You will need a `startsg.local` script in your chosen platform directory (eg. `snap/startsg.local` for the SNAP board) before you can start the toolflow. See [The Toolflow Documentation](https://casper-toolflow.readthedocs.io/en/latest/src/Configuring-the-Toolflow.html#specifying-local-details) for details about what this script should contain.

Once you've downloaded the appropriate libraries, you can move to your chosen platform's directory and start the toolflow --

```bash
# Enter the directory for your chosen platform.
# Eg. for SNAP:
cd snap/
101

Jack's avatar
Jack committed
102 103 104 105
# Start the toolflow's MATLAB frontend
./startsg your.startsg.local.file
```

Jack Hickish's avatar
Jack Hickish committed
106 107
# Documentation
Documentation for these tutorials can be found [here](https://casper-tutorials.readthedocs.io/)