Added all instructions as empty instructions. Compiles on WIN + MSYS2, UCRT64
This commit is contained in:
58
pygen.ipynb
58
pygen.ipynb
@@ -144,7 +144,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 4,
|
||||
"id": "58645013",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -283,7 +283,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": 5,
|
||||
"id": "452bc76c",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -357,7 +357,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": 6,
|
||||
"id": "5aaebef0",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -451,7 +451,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": 7,
|
||||
"id": "instrmap_gen",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -615,6 +615,54 @@
|
||||
"print(f' Switch cases : {switch_count}')\n",
|
||||
"print(f' Line endings : LF-only verified')\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"id": "9f190f4c",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# ---------- GENERATE INSTR_XX FILES ----------\n",
|
||||
"INSTR_DIR = f'{SRC_ROOT}/spider/runtime/instr'\n",
|
||||
"\n",
|
||||
"# Generate the files\n",
|
||||
"# Each file goes from 00 to 1F (0-31), 32 instr / file\n",
|
||||
"for x0 in range(0, TABLE_SIZE, 32):\n",
|
||||
" x1 = x0 + 31\n",
|
||||
" fname = f'{INSTR_DIR}/Instr_{x0:03X}-{x1:03X}.cpp'\n",
|
||||
"\n",
|
||||
" # TODO: Check if there are missing instructions\n",
|
||||
" if file_exists(fname):\n",
|
||||
" continue\n",
|
||||
"\n",
|
||||
" # CREATE FILE FROM SCRATCH\n",
|
||||
" L = []\n",
|
||||
" L.append('/**')\n",
|
||||
" L.append(' * @brief AUTO-GENERATED by pygen.ipynb BUT editable by hand!')\n",
|
||||
" L.append(' *')\n",
|
||||
" L.append(' */')\n",
|
||||
" L.append('') # [CHANGE] Use absolute path to make paths more explicit\n",
|
||||
" L.append('#include <spider/runtime/cpu/CPU.hpp>')\n",
|
||||
" L.append('')\n",
|
||||
" L.append('namespace spider {')\n",
|
||||
" L.append('')\n",
|
||||
"\n",
|
||||
" for opc in range(x0, x1 + 1):\n",
|
||||
" mnem = opcode_to_mnem.get(opc)\n",
|
||||
" if mnem is None: continue\n",
|
||||
"\n",
|
||||
" L.append(f' void CPU::{mnem}() {{')\n",
|
||||
" L.append(f' // TODO: Implement {mnem}')\n",
|
||||
" L.append(f' }}')\n",
|
||||
" L.append('')\n",
|
||||
"\n",
|
||||
" L.append('}')\n",
|
||||
" L.append('')\n",
|
||||
"\n",
|
||||
" with open(fname, 'wb') as f:\n",
|
||||
" f.write('\\n'.join(L).encode('utf-8'))\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
@@ -633,7 +681,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.13.7"
|
||||
"version": "3.14.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
Reference in New Issue
Block a user