aboutsummaryrefslogtreecommitdiffstats
path: root/ice40
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2018-07-30 13:57:14 +0200
committerClifford Wolf <clifford@clifford.at>2018-07-30 13:57:14 +0200
commit0db86b8619883c0cbaf36150c3622c9d78d82d12 (patch)
tree5b5a69b98b2c020baa09428f69003d23a95599cb /ice40
parent1cf9c678135799222746c9145179c05245815c42 (diff)
downloadnextpnr-0db86b8619883c0cbaf36150c3622c9d78d82d12.tar.gz
nextpnr-0db86b8619883c0cbaf36150c3622c9d78d82d12.tar.bz2
nextpnr-0db86b8619883c0cbaf36150c3622c9d78d82d12.zip
Improve ice40/benchmark
Signed-off-by: Clifford Wolf <clifford@clifford.at>
Diffstat (limited to 'ice40')
-rw-r--r--ice40/benchmark/Makefile6
-rw-r--r--ice40/benchmark/report.ipynb40
2 files changed, 35 insertions, 11 deletions
diff --git a/ice40/benchmark/Makefile b/ice40/benchmark/Makefile
index 5e16d9b0..5a276b18 100644
--- a/ice40/benchmark/Makefile
+++ b/ice40/benchmark/Makefile
@@ -1,3 +1,5 @@
+SHELL = /bin/bash
+
reports::
define mkreport
@@ -10,10 +12,10 @@ report_n$1.txt: hx8kdemo_n$1.asc
icetime -m -r report_n$1.txt -d hx8k hx8kdemo_n$1.asc
hx8kdemo_a$1.asc: hx8kdemo.blif
- arachne-pnr -d 8k -p hx8kdemo.pcf -o hx8kdemo_a$1.asc -s 1$1 hx8kdemo.blif > hx8kdemo_a$1.log 2>&1
+ { time arachne-pnr -d 8k -p hx8kdemo.pcf -o hx8kdemo_a$1.asc -s 1$1 hx8kdemo.blif; } > hx8kdemo_a$1.log 2>&1
hx8kdemo_n$1.asc: hx8kdemo.json
- ../../nextpnr-ice40 --asc hx8kdemo_n$1.asc --json hx8kdemo.json --pcf hx8kdemo.pcf --hx8k --seed 1$1 > hx8kdemo_n$1.log 2>&1
+ { time ../../nextpnr-ice40 --asc hx8kdemo_n$1.asc --json hx8kdemo.json --pcf hx8kdemo.pcf --hx8k --seed 1$1; } > hx8kdemo_n$1.log 2>&1
endef
$(foreach i,0 1 2 3 4 5 6 7 8 9,$(eval $(call mkreport,$(i))))
diff --git a/ice40/benchmark/report.ipynb b/ice40/benchmark/report.ipynb
index 3232f38c..b4e03283 100644
--- a/ice40/benchmark/report.ipynb
+++ b/ice40/benchmark/report.ipynb
@@ -11,36 +11,58 @@
"%matplotlib inline\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
- "import subprocess\n",
+ "import subprocess, re\n",
"\n",
"gitrev = subprocess.getoutput(\"git rev-parse --short HEAD\")\n",
"\n",
- "data_a = 1 + np.zeros(10)\n",
- "data_n = 1 + np.zeros(10)\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] = float(line.split()[3])\n",
+ " data_a[i, 0] = float(line.split()[3])\n",
" except:\n",
- " pass\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] = float(line.split()[3])\n",
+ " data_n[i, 0] = float(line.split()[3])\n",
" except:\n",
- " pass\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, color='blue')\n",
- "plt.bar(15+np.arange(10), data_n, color='red')\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()"
]
}