Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
cdff47fcaThis file is pinned to the selected release. Download the original to open it in your design tool.
{
"cells": [
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import matplotlib\n",
"import matplotlib.pyplot as plt\n",
"import seaborn as sns\n",
"import logging as log\n",
"import sys\n",
"%matplotlib inline"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [],
"source": [
"def logging_setup(logging):\n",
" # Color for warning and error mesages\n",
" logging.addLevelName(\n",
" logging.WARNING,\n",
" \"\\033[1;33m%s\\033[1;0m\" % logging.getLevelName(logging.WARNING))\n",
" logging.addLevelName(\n",
" logging.ERROR,\n",
" \"\\033[1;31m%s\\033[1;0m\" % logging.getLevelName(logging.ERROR))\n",
"\n",
" logging.basicConfig(\n",
" format='%(levelname)s: %(message)s',\n",
" stream=sys.stderr,\n",
" level=logging.INFO)\n",
"logging_setup(log)"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/Users/rachitnigam/git/filament/scripts\n"
]
}
],
"source": [
"import json\n",
"import os\n",
"\n",
"print(os.getcwd())\n",
"DIR = \"../aetherling/resource-cmp\"\n",
"aetherling = json.load(open(DIR + \"/chisel-conv-16.json\"))\n",
"aetherling['name'] = 'aetherling'\n",
"filament = json.load(open(DIR + \"/fil-con.json\"))\n",
"filament['name'] = 'filament'\n",
"fil_reticle = json.load(open(DIR + \"/fil-reticle-conv.json\"))\n",
"fil_reticle['name'] = 'filament-reticle'\n"
]
},
{
"cell_type": "code",
"execution_count": 70,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>lut</th>\n",
" <th>dsp</th>\n",
" <th>registers</th>\n",
" <th>muxes</th>\n",
" <th>clb_registers</th>\n",
" <th>carry8</th>\n",
" <th>f7_muxes</th>\n",
" <th>f8_muxes</th>\n",
" <th>f9_muxes</th>\n",
" <th>clb</th>\n",
" <th>...</th>\n",
" <th>worst_slack</th>\n",
" <th>period</th>\n",
" <th>frequency</th>\n",
" <th>cell_lut1</th>\n",
" <th>cell_lut2</th>\n",
" <th>cell_lut3</th>\n",
" <th>cell_lut4</th>\n",
" <th>cell_lut5</th>\n",
" <th>cell_lut6</th>\n",
" <th>cell_fdre</th>\n",
" </tr>\n",
" <tr>\n",
" <th>name</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>aetherling</th>\n",
" <td>106</td>\n",
" <td>10</td>\n",
" <td>78</td>\n",
" <td>2</td>\n",
" <td>236</td>\n",
" <td>8</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>350</td>\n",
" <td>...</td>\n",
" <td>0.160</td>\n",
" <td>1.5</td>\n",
" <td>666.667</td>\n",
" <td>5</td>\n",
" <td>72</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>-1</td>\n",
" <td>236</td>\n",
" </tr>\n",
" <tr>\n",
" <th>filament</th>\n",
" <td>128</td>\n",
" <td>9</td>\n",
" <td>11</td>\n",
" <td>0</td>\n",
" <td>88</td>\n",
" <td>16</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>232</td>\n",
" <td>...</td>\n",
" <td>0.045</td>\n",
" <td>1.2</td>\n",
" <td>833.333</td>\n",
" <td>-1</td>\n",
" <td>128</td>\n",
" <td>-1</td>\n",
" <td>-1</td>\n",
" <td>-1</td>\n",
" <td>-1</td>\n",
" <td>88</td>\n",
" </tr>\n",
" <tr>\n",
" <th>filament-reticle</th>\n",
" <td>14</td>\n",
" <td>9</td>\n",
" <td>20</td>\n",
" <td>0</td>\n",
" <td>160</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>174</td>\n",
" <td>...</td>\n",
" <td>0.076</td>\n",
" <td>1.6</td>\n",
" <td>625.000</td>\n",
" <td>-1</td>\n",
" <td>3</td>\n",
" <td>3</td>\n",
" <td>-1</td>\n",
" <td>6</td>\n",
" <td>6</td>\n",
" <td>160</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>3 rows × 21 columns</p>\n",
"</div>"
],
"text/plain": [
" lut dsp registers muxes clb_registers carry8 f7_muxes \\\n",
"name \n",
"aetherling 106 10 78 2 236 8 0 \n",
"filament 128 9 11 0 88 16 0 \n",
"filament-reticle 14 9 20 0 160 0 0 \n",
"\n",
" f8_muxes f9_muxes clb ... worst_slack period \\\n",
"name ... \n",
"aetherling 0 0 350 ... 0.160 1.5 \n",
"filament 0 0 232 ... 0.045 1.2 \n",
"filament-reticle 0 0 174 ... 0.076 1.6 \n",
"\n",
" frequency cell_lut1 cell_lut2 cell_lut3 cell_lut4 \\\n",
"name \n",
"aetherling 666.667 5 72 2 1 \n",
"filament 833.333 -1 128 -1 -1 \n",
"filament-reticle 625.000 -1 3 3 -1 \n",
"\n",
" cell_lut5 cell_lut6 cell_fdre \n",
"name \n",
"aetherling 1 -1 236 \n",
"filament -1 -1 88 \n",
"filament-reticle 6 6 160 \n",
"\n",
"[3 rows x 21 columns]"
]
},
"execution_count": 70,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def merge_jsons(*jsons):\n",
" dfs = [pd.json_normalize(j) for j in jsons]\n",
" return pd.concat(dfs)\n",
"\n",
"all_data = merge_jsons(aetherling, filament, fil_reticle).set_index('name')\n",
"all_data"
]
},
{
"cell_type": "code",
"execution_count": 79,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\u001b[1;33mWARNING\u001b[1;0m: aetherling has slack 0.16 which is more than the minimum 0.1\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>LUTs</th>\n",
" <th>DSPs</th>\n",
" <th>Registers</th>\n",
" <th>Muxes</th>\n",
" <th>CLB Registers</th>\n",
" <th>Frequency (MHz)</th>\n",
" <th>Worst Slack (ns)</th>\n",
" </tr>\n",
" <tr>\n",
" <th>name</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>aetherling</th>\n",
" <td>106</td>\n",
" <td>10</td>\n",
" <td>78</td>\n",
" <td>2</td>\n",
" <td>236</td>\n",
" <td>666.67</td>\n",
" <td>0.16</td>\n",
" </tr>\n",
" <tr>\n",
" <th>filament</th>\n",
" <td>128</td>\n",
" <td>9</td>\n",
" <td>11</td>\n",
" <td>0</td>\n",
" <td>88</td>\n",
" <td>833.33</td>\n",
" <td>0.04</td>\n",
" </tr>\n",
" <tr>\n",
" <th>filament-reticle</th>\n",
" <td>14</td>\n",
" <td>9</td>\n",
" <td>20</td>\n",
" <td>0</td>\n",
" <td>160</td>\n",
" <td>625.00</td>\n",
" <td>0.08</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" LUTs DSPs Registers Muxes CLB Registers \\\n",
"name \n",
"aetherling 106 10 78 2 236 \n",
"filament 128 9 11 0 88 \n",
"filament-reticle 14 9 20 0 160 \n",
"\n",
" Frequency (MHz) Worst Slack (ns) \n",
"name \n",
"aetherling 666.67 0.16 \n",
"filament 833.33 0.04 \n",
"filament-reticle 625.00 0.08 "
]
},
"execution_count": 79,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"FIELDS = ['lut', 'dsp', 'registers', 'muxes', 'clb_registers', 'frequency', 'worst_slack']\n",
"MIN_SLACK = 0.1\n",
"# Remove all the rows that only contain zero values\n",
"def cleanup(df):\n",
" # Error if any design didn't meet timing\n",
" for (name, meets) in df['meet_timing'].items():\n",
" if meets == 0:\n",
" log.error(f\"{name} did not meet timing\")\n",
"\n",
" # If the slack is less than the minimum\n",
" for (name, slack) in df['worst_slack'].items():\n",
" if slack > MIN_SLACK:\n",
" log.warning(f\"{name} has slack {slack} which is more than the minimum {MIN_SLACK}\")\n",
"\n",
" # Make all columns print 2 decimal places\n",
" pd.options.display.float_format = '{:,.2f}'.format\n",
"\n",
" df = df[FIELDS]\n",
"\n",
" # Remap names of columns\n",
" df = df.rename(columns={\n",
" 'lut': 'LUTs',\n",
" 'dsp': 'DSPs',\n",
" 'registers': 'Registers',\n",
" 'muxes': 'Muxes',\n",
" 'clb_registers': 'CLB Registers',\n",
" 'frequency': 'Frequency (MHz)',\n",
" 'worst_slack': 'Worst Slack (ns)',\n",
" })\n",
" \n",
" return df\n",
"\n",
"\n",
"cleanup(all_data)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.9.6 64-bit ('3.9.6')",
"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.9.6"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "69ded2587f59341d4c1550d7fff661a8d46f021b1d85686b3886bb2d4d3e8a96"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}