| { |
| "cells": [ |
| { |
| "cell_type": "code", |
| "execution_count": null, |
| "metadata": { |
| "collapsed": false |
| }, |
| "outputs": [], |
| "source": [ |
| "%matplotlib inline\n", |
| "import numpy as np\n", |
| "import matplotlib.pyplot as plt\n", |
| "import subprocess, re\n", |
| "\n", |
| "gitrev = subprocess.getoutput(\"git rev-parse --short HEAD\")\n", |
| "\n", |
| "data_a = np.zeros((10, 2))\n", |
| "data_n = np.zeros((10, 2))\n", |
| "\n", |
| "for i in range(10):\n", |
| " try:\n", |
| " with open(\"report_a%d.txt\" % i, \"r\") as f:\n", |
| " for line in f:\n", |
| " if line.startswith(\"Total path delay:\"):\n", |
| " data_a[i, 0] = float(line.split()[3])\n", |
| " except:\n", |
| " data_a[i, 0] = 1.0\n", |
| " \n", |
| " try:\n", |
| " with open(\"report_n%d.txt\" % i, \"r\") as f:\n", |
| " for line in f:\n", |
| " if line.startswith(\"Total path delay:\"):\n", |
| " data_n[i, 0] = float(line.split()[3])\n", |
| " except:\n", |
| " data_n[i, 0] = 1.0\n", |
| " \n", |
| " with open(\"hx8kdemo_a%d.log\" % i, \"r\") as f:\n", |
| " for line in f:\n", |
| " match = re.match(r\"real\\s+(\\d+)m(\\d+)\", line)\n", |
| " if match:\n", |
| " data_a[i, 1] = float(match.group(1)) + float(match.group(2))/60\n", |
| " \n", |
| " with open(\"hx8kdemo_n%d.log\" % i, \"r\") as f:\n", |
| " for line in f:\n", |
| " match = re.match(r\"real\\s+(\\d+)m(\\d+)\", line)\n", |
| " if match:\n", |
| " data_n[i, 1] = float(match.group(1)) + float(match.group(2))/60\n", |
| "\n", |
| "plt.figure(figsize=(9,3))\n", |
| "plt.title(\"nextpnr -- ice40/benchmark/ -- %s\" % gitrev)\n", |
| "plt.bar(np.arange(10), data_a[:, 0], color='blue')\n", |
| "plt.bar(15+np.arange(10), data_n[:, 0], color='red')\n", |
| "plt.ylabel('Longest path (ns)')\n", |
| "plt.xticks([5, 20], [\"arachne-pnr\", \"nextpnr\"])\n", |
| "plt.xlim(-2, 27)\n", |
| "plt.show()\n", |
| "\n", |
| "plt.figure(figsize=(9,3))\n", |
| "plt.title(\"nextpnr -- ice40/benchmark/ -- %s\" % gitrev)\n", |
| "plt.bar(np.arange(10), data_a[:, 1], color='blue')\n", |
| "plt.bar(15+np.arange(10), data_n[:, 1], color='red')\n", |
| "plt.ylabel('Runtime (minutes)')\n", |
| "plt.xticks([5, 20], [\"arachne-pnr\", \"nextpnr\"])\n", |
| "plt.xlim(-2, 27)\n", |
| "plt.show()" |
| ] |
| } |
| ], |
| "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.5.2" |
| } |
| }, |
| "nbformat": 4, |
| "nbformat_minor": 1 |
| } |