OpenFPGA/jupyter_example.ipynb

192 lines
4.1 KiB
Plaintext
Raw Normal View History

2018-06-27 12:54:00 -05:00
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"*Getting Started with Jupyter and FPGA-SPICE on Linux\n",
"1. Install Anaconda: https://conda.io/docs/user-guide/install/linux.html \n",
"2. Run anaconda-navigator: `~/anaconda-navigator`\n",
"3. Launch jupyter notebook from anaconda navigator\n",
"\n",
"In the jupyter interface, navigate to the location of a notebook and view it."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2018-06-29 14:24:18 -05:00
"The repository contains a submodule, so you need to get it as well:"
2018-06-29 12:16:13 -05:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2018-06-29 14:24:18 -05:00
"Build the VPR tool with the FPGA-SPICE functionality:"
2018-06-29 12:16:13 -05:00
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2018-06-29 14:24:18 -05:00
"Wait for make to finish with a return code of 0.\n"
2018-06-29 12:16:13 -05:00
]
},
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
2018-06-29 14:24:18 -05:00
"import os\n",
2018-06-29 12:16:13 -05:00
"# move to the directory with the Makefile\n",
"os.chdir(\"./tangxifan-eda-tools/branches/vpr7_rram/vpr/\")\n",
"# run make\n",
"print (\"Wait for make to finish with a return code of 0.\")\n",
"os.system(\"make\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To run FPGA-SPICE, define its location:"
]
},
{
"cell_type": "code",
2018-06-29 14:24:18 -05:00
"execution_count": 3,
2018-06-29 12:16:13 -05:00
"metadata": {},
2018-06-27 12:54:00 -05:00
"outputs": [],
"source": [
2018-06-28 13:47:59 -05:00
"# set this to the location of the vpr executable file\n",
2018-06-29 12:16:13 -05:00
"fpga_spice = \"~/OpenFPGA/tangxifan-eda-tools/branches/vpr7_rram/vpr/vpr\""
2018-06-27 12:54:00 -05:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Define an architecture file and a circuit file:"
]
},
{
"cell_type": "code",
2018-06-29 14:24:18 -05:00
"execution_count": 20,
2018-06-27 12:54:00 -05:00
"metadata": {},
"outputs": [],
"source": [
2018-06-29 12:16:13 -05:00
"arch = \"~/OpenFPGA/tangxifan-eda-tools/branches/vpr7_rram/libarchfpga/arch/sample_arch.xml\"\n",
2018-06-29 14:24:18 -05:00
"circuit = \"~/OpenFPGA/tangxifan-eda-tools/trunk/MPACK1.5_FLOW/BENCHMARKS/test_case1/add16_new.blif\""
2018-06-27 12:54:00 -05:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Run vpr:"
]
},
{
"cell_type": "code",
2018-06-29 14:24:18 -05:00
"execution_count": 21,
2018-06-27 12:54:00 -05:00
"metadata": {},
2018-06-29 14:24:18 -05:00
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
2018-06-27 12:54:00 -05:00
"source": [
2018-06-29 12:16:13 -05:00
"\n",
2018-06-27 12:54:00 -05:00
"command_line = fpga_spice + \" \" + arch + \" \" + circuit\n",
"os.system(command_line)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This will bring up a display of how the circuit is being placed on the FPGA. Press the `Proceed` button to step to the final placement, press `Proceed` again to step to the routing. Press the `Exit` button to exit the display.\n",
"\n",
"To run VPR without the display, use the command `-nodisp`"
]
},
{
"cell_type": "code",
2018-06-29 14:24:18 -05:00
"execution_count": 22,
2018-06-27 12:54:00 -05:00
"metadata": {},
"outputs": [],
"source": [
"command_line_nodisp = command_line + \" -nodisp\"\n"
]
},
{
"cell_type": "code",
2018-06-29 14:24:18 -05:00
"execution_count": 23,
2018-06-27 12:54:00 -05:00
"metadata": {},
2018-06-29 14:24:18 -05:00
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
2018-06-27 12:54:00 -05:00
"source": [
"os.system(command_line_nodisp)"
]
2018-06-29 14:24:18 -05:00
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
2018-06-27 12:54:00 -05:00
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}