{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Downloading Overlays\n",
    "\n",
    "This notebook demonstrates how to download an FPGA overlay and examine programmable logic state.  \n",
    "\n",
    "## 1. Instantiating an overlay\n",
    "To instantiate an overlay, a bitstream file name is passed to the Overlay class.\n",
    "\n",
    "The bitstream file does not need a full path if it resides in the pynq package, but a full path can be used for any bitstream located on the Linux file system.  Two examples of overlay instantiation are shown below.\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# Using base.bit located in pynq package\n",
    "from pynq import Overlay\n",
    "ol = Overlay(\"base.bit\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "In the second case, users can use absolute file path to instantiate the overlay."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# Using the same bitstream, but with full path\n",
    "from pynq import Overlay\n",
    "ol = Overlay(\"/home/xilinx/pynq/bitstream/base.bit\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now we can check the download timestamp for this overlay"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'2016/8/24 16:51:57 +582744'"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ol.download()\n",
    "ol.bitstream.timestamp"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2. Examining the PL state\n",
    "\n",
    "While there can be multiple overlay instances in Python, there is only one bitstream that is currently loaded onto the programmable logic (PL). \n",
    "\n",
    "This bitstream state is held in the singleton class, PL, and is available for user queries."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'/home/xilinx/pynq/bitstream/base.bit'"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pynq import PL\n",
    "PL.bitfile_name"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'2016/8/24 16:51:57 +582744'"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "PL.timestamp"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Users can verify whether an overlay instance is currently loaded using the Overlay is_loaded() method"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ol.is_loaded()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3. Overlay downloading overhead\n",
    "\n",
    "Finally, using Python, we can see the bitstream download time over 50 downloads.  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYEAAAEKCAYAAAD0Luk/AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGLtJREFUeJzt3XuQnFWdxvHvEyMotyRckpgEQgjKAl6A0pBd3KVBQV01\nYV0rAlOQiFLuqoh3EtYww0ZXoHCBctXVRSEiFwO7SNxCSCgYlF25KQibhICEQAhkEAjBBFRifvvH\ne2bSGbpnprtnuic5z6dqKm+/l3NOn+55n37PeXuiiMDMzPI0otUNMDOz1nEImJllzCFgZpYxh4CZ\nWcYcAmZmGXMImJllzCGQOUnfkfRPrW7HUJD0mKRjh6DcdklXpOV9Jb0oSYNdT5W6/0/S3zSpr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K2W9Jv03rg7rau5L4ZNCPiLZFxG8dzLzQVuiYiDgFuBeU1vVWtsBj4fEYcC\nfwl8Kr0XsuuPiPgjcExEHA68FThW0lFk2BdlzgSWlz3OtS+2AKWIODwipqV1NffFsAkBMv8iWUTc\nAazvtXomsDAtLwROaGqjWiQi1kXE/Wl5I7ACmES+/fFSWtyZ4nd2PZn2haRJwN8Cl5atzrIvAPHq\nc3jNfTGcQsBfJHu1sRHRBcWJERjb4vY0naT9gcOAO4FxOfZHGv64D1gHdEbEcjLtC+Ai4EtA+WRm\nrn0RwFJJ90j6eFpXc1809e4ga1hWs/iSdgOuA86MiI0Vvj+SRX9ExBbgcEl7ADdLKvHq577D94Wk\n9wNdEXF/6oNqdvi+SI6KiKcl7QMskbSSOt4Xw+lKYC2wX9njSWldzrokjQOQNB54psXtaRpJIykC\n4IqIuCGtzrY/ACLiReBG4O3k2RdHATMkrQKuppgfuQJYl2FfEBFPp39/B/yEYki95vfFcAqBe4AD\nJU2WtBNwIrC4xW1qNqWfbouBOWl5NnBD7wN2YD8AlkfEJWXrsusPSXt33+Eh6fXAccB9ZNgXEXF2\nROwXEQdQnB9ujYhTgJ+SWV9I2iVdKSNpV+B44EHqeF8Mq+8JSHovcAlbv0h2Xoub1DSSrgJKwF5A\nF9BOke7XAvsCjwOzIuKFVrWxWdLdLz+neFNH+jmb4hvmi8ioPyS9hWKCr3sS8IqIuFDSnmTWF+Uk\nHQ18ISJm5NgXkqYA11P8bowEroyI8+rpi2EVAmZm1lzDaTjIzMyazCFgZpYxh4CZWcYcAmZmGXMI\nmJllzCFgZpYxh4CZWcYcAmZmGft/caViwKgb/pcAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x34a1ea50>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import time\n",
    "import matplotlib.pyplot as plt\n",
    "from pynq import Overlay\n",
    "\n",
    "ol1 = Overlay(\"base.bit\")\n",
    "length = 50\n",
    "log1 = []\n",
    "for i in range(length):\n",
    "    start = time.time()\n",
    "    ol1.download()\n",
    "    end = time.time()\n",
    "    # Record milliseconds\n",
    "    log1.append((end-start)*1000)\n",
    "\n",
    "# Draw the figure\n",
    "%matplotlib inline\n",
    "plt.plot(range(length), log1, 'ro')\n",
    "plt.title('Bitstream loading time (ms)')\n",
    "plt.axis([0, length, 0, 1000])\n",
    "plt.show()\n",
    "\n",
    "del ol1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "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.4.3+"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
