diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..128769766 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +# editor backup files +*~ + +# log files +**/logs +*.log + +# Jupyter / iPython +.ipynb_checkpoints/ +__pycache__/ +*.py[cod] +*$py.class + diff --git a/jupyter_example.ipynb b/jupyter_example.ipynb new file mode 100644 index 000000000..18bcdec31 --- /dev/null +++ b/jupyter_example.ipynb @@ -0,0 +1,138 @@ +{ + "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": [ + "To run FPGA-SPICE, define its location:" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "# set this to the location of the vpr executable file\n", + "fpga_spice = \"~/tangxifan-eda-tools/branches/vpr7_rram/vpr/vpr\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Define an architecture file and a circuit file:" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "arch = \"~/tangxifan-eda-tools/branches/vpr7_rram/libarchfpga/arch/sample_arch.xml\"\n", + "circuit = \"~/tangxifan-eda-tools/branches/vpr7_rram/vpr/Circuits/s298_K6_N10_ace.blif\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Run vpr:" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import os\n", + "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", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "command_line_nodisp = command_line + \" -nodisp\"\n" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "os.system(command_line_nodisp)" + ] + } + ], + "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 +}