executed pygen, we now have cpu instructions yay, made some changes to pygen
This commit is contained in:
55
pygen.ipynb
55
pygen.ipynb
@@ -23,43 +23,52 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Repo root : /home/arturobalam/Documents/7thQuarter/Estancia_2/internship-repo/ArturoBalam-Internship2-repo/spider-runtime-folder/spider-runtime\n",
|
||||
"CPU.hpp : /home/arturobalam/Documents/7thQuarter/Estancia_2/internship-repo/ArturoBalam-Internship2-repo/spider-runtime-folder/spider-runtime/src/spider/runtime/cpu/CPU.hpp\n",
|
||||
"XLSX : /home/arturobalam/Documents/7thQuarter/Estancia_2/internship-repo/ArturoBalam-Internship2-repo/spider-runtime-folder/spider-runtime/Spider_Instructions.xlsx\n",
|
||||
"Output dir: /home/arturobalam/Documents/7thQuarter/Estancia_2/internship-repo/ArturoBalam-Internship2-repo/spider-runtime-folder/spider-runtime/pygen_out\n"
|
||||
"Repo root : ./ -> (True)\n",
|
||||
"CPU.hpp : .//src//spider/runtime/cpu/CPU.hpp -> (True)\n",
|
||||
"XLSX : .//docs//Spider Instructions.xlsx -> (True)\n",
|
||||
"Output dir: .//autogen/ -> (True)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# setup directories\n",
|
||||
"\n",
|
||||
"import os\n",
|
||||
"\n",
|
||||
"# Root of the Spider runtime repo — adjust this path to match your machine (folder where spider-runtime lives).\n",
|
||||
"REPO_ROOT = os.path.abspath('/home/arturobalam/Documents/7thQuarter/Estancia_2/internship-repo/ArturoBalam-Internship2-repo/spider-runtime-folder/spider-runtime')\n",
|
||||
"# [CHANGE]\n",
|
||||
"# Since we're running on a local environment (i hope)\n",
|
||||
"# we can just signal a relative directory.\n",
|
||||
"REPO_ROOT = './'\n",
|
||||
"DOCS_ROOT = f'{REPO_ROOT}/docs/'\n",
|
||||
"SRC_ROOT = f'{REPO_ROOT}/src/'\n",
|
||||
"\n",
|
||||
"# Where CPU.hpp lives — this is the file we will inject generated code into.\n",
|
||||
"CPU_HPP_PATH = os.path.join(REPO_ROOT, 'src', 'spider', 'runtime', 'cpu', 'CPU.hpp')\n",
|
||||
"CPU_HPP_PATH = f'{SRC_ROOT}/spider/runtime/cpu/CPU.hpp'\n",
|
||||
"\n",
|
||||
"# Where the Excel instruction sheet lives. Allocate the .xlsx file in the project's root folder.\n",
|
||||
"XLSX_PATH = os.path.join(REPO_ROOT, 'Spider_Instructions.xlsx')\n",
|
||||
"# NOTE: The file I uploaded has a space instead of underscore!\n",
|
||||
"XLSX_PATH = f'{DOCS_ROOT}/Spider Instructions.xlsx'\n",
|
||||
"\n",
|
||||
"# Output folder for any standalone generated files.\n",
|
||||
"OUT_DIR = os.path.join(REPO_ROOT, 'pygen_out')\n",
|
||||
"OUT_DIR = f'{REPO_ROOT}/autogen/'\n",
|
||||
"\n",
|
||||
"# Create the output directory if it does not exist yet.\n",
|
||||
"# exist_ok=True means no error if it already exists.\n",
|
||||
"os.makedirs(OUT_DIR, exist_ok=True)\n",
|
||||
"\n",
|
||||
"print(f'Repo root : {REPO_ROOT}')\n",
|
||||
"print(f'CPU.hpp : {CPU_HPP_PATH}')\n",
|
||||
"print(f'XLSX : {XLSX_PATH}')\n",
|
||||
"print(f'Output dir: {OUT_DIR}')\n"
|
||||
"def dir_exists(path:str):\n",
|
||||
" return os.path.exists(path) and os.path.isdir(path)\n",
|
||||
"def file_exists(path:str):\n",
|
||||
" return os.path.exists(path) and os.path.isfile(path)\n",
|
||||
"\n",
|
||||
"print(f'Repo root : {REPO_ROOT } -> ({ dir_exists(REPO_ROOT )})')\n",
|
||||
"print(f'CPU.hpp : {CPU_HPP_PATH} -> ({file_exists(CPU_HPP_PATH)})')\n",
|
||||
"print(f'XLSX : {XLSX_PATH } -> ({file_exists(XLSX_PATH )})')\n",
|
||||
"print(f'Output dir: {OUT_DIR } -> ({ dir_exists(OUT_DIR )})')\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 5,
|
||||
"id": "b33de8ac",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -135,7 +144,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 6,
|
||||
"id": "58645013",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -154,8 +163,8 @@
|
||||
"Bit Wise 14\n",
|
||||
"Boolean 12\n",
|
||||
"Branch 12\n",
|
||||
"Floating Point 10\n",
|
||||
"Casts 10\n",
|
||||
"Floating Point 10\n",
|
||||
"Memory 9\n",
|
||||
"Trigonometric 7\n",
|
||||
"Exponential 6\n",
|
||||
@@ -271,7 +280,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": 7,
|
||||
"id": "452bc76c",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -279,7 +288,7 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Masks written to: /home/arturobalam/Documents/7thQuarter/Estancia_2/internship-repo/ArturoBalam-Internship2-repo/spider-runtime-folder/spider-runtime/pygen_out/InstructionMasks.hpp\n",
|
||||
"Masks written to: .//autogen/InstructionMasks.hpp\n",
|
||||
"Lines generated : 268\n"
|
||||
]
|
||||
}
|
||||
@@ -345,7 +354,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": 8,
|
||||
"id": "5aaebef0",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -367,7 +376,7 @@
|
||||
" void SPDR();\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"CPU.hpp updated successfully at: /home/arturobalam/Documents/7thQuarter/Estancia_2/internship-repo/ArturoBalam-Internship2-repo/spider-runtime-folder/spider-runtime/src/spider/runtime/cpu/CPU.hpp\n",
|
||||
"CPU.hpp updated successfully at: .//src//spider/runtime/cpu/CPU.hpp\n",
|
||||
"Total lines in updated file: 674\n"
|
||||
]
|
||||
}
|
||||
@@ -440,7 +449,7 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "spider-rntm-env",
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
@@ -454,7 +463,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.12.3"
|
||||
"version": "3.13.7"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
Reference in New Issue
Block a user