ppc2arm 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ppc2arm-1.0.0/LICENSE +21 -0
- ppc2arm-1.0.0/PKG-INFO +504 -0
- ppc2arm-1.0.0/README.md +481 -0
- ppc2arm-1.0.0/pyproject.toml +42 -0
- ppc2arm-1.0.0/setup.cfg +4 -0
- ppc2arm-1.0.0/src/ppc2arm/__init__.py +3 -0
- ppc2arm-1.0.0/src/ppc2arm/__main__.py +4 -0
- ppc2arm-1.0.0/src/ppc2arm/cli.py +443 -0
- ppc2arm-1.0.0/src/ppc2arm/core/__init__.py +0 -0
- ppc2arm-1.0.0/src/ppc2arm/core/engine.py +333 -0
- ppc2arm-1.0.0/src/ppc2arm/core/fuzzy.py +102 -0
- ppc2arm-1.0.0/src/ppc2arm/core/registry.py +119 -0
- ppc2arm-1.0.0/src/ppc2arm/data/__init__.py +0 -0
- ppc2arm-1.0.0/src/ppc2arm/data/arm_instructions.py +1229 -0
- ppc2arm-1.0.0/src/ppc2arm/data/isa_schema.py +77 -0
- ppc2arm-1.0.0/src/ppc2arm/data/isa_trivia.py +797 -0
- ppc2arm-1.0.0/src/ppc2arm/data/mappings.py +903 -0
- ppc2arm-1.0.0/src/ppc2arm/data/ppc_instructions.py +2607 -0
- ppc2arm-1.0.0/src/ppc2arm/gui/__init__.py +0 -0
- ppc2arm-1.0.0/src/ppc2arm/gui/app.py +344 -0
- ppc2arm-1.0.0/src/ppc2arm/gui/easter_eggs.py +300 -0
- ppc2arm-1.0.0/src/ppc2arm/gui/isa_museum.py +471 -0
- ppc2arm-1.0.0/src/ppc2arm/gui/main_panel.py +144 -0
- ppc2arm-1.0.0/src/ppc2arm/gui/mode_bar.py +148 -0
- ppc2arm-1.0.0/src/ppc2arm/gui/result_panel.py +207 -0
- ppc2arm-1.0.0/src/ppc2arm/gui/theme.py +150 -0
- ppc2arm-1.0.0/src/ppc2arm/gui/widgets/__init__.py +0 -0
- ppc2arm-1.0.0/src/ppc2arm/gui/widgets/about_dialog.py +99 -0
- ppc2arm-1.0.0/src/ppc2arm/gui/widgets/searchable_list.py +119 -0
- ppc2arm-1.0.0/src/ppc2arm/gui/widgets/ticker_bar.py +131 -0
- ppc2arm-1.0.0/src/ppc2arm.egg-info/PKG-INFO +504 -0
- ppc2arm-1.0.0/src/ppc2arm.egg-info/SOURCES.txt +34 -0
- ppc2arm-1.0.0/src/ppc2arm.egg-info/dependency_links.txt +1 -0
- ppc2arm-1.0.0/src/ppc2arm.egg-info/entry_points.txt +2 -0
- ppc2arm-1.0.0/src/ppc2arm.egg-info/requires.txt +3 -0
- ppc2arm-1.0.0/src/ppc2arm.egg-info/top_level.txt +1 -0
ppc2arm-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 IBM Bob & Daneyand
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
ppc2arm-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ppc2arm
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: PowerPC <-> ARM / AArch64 instruction picker: CLI, REPL and retro ISA-museum GUI
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/007Style/PPC2ARM
|
|
7
|
+
Project-URL: Source, https://github.com/007Style/PPC2ARM
|
|
8
|
+
Project-URL: Issues, https://github.com/007Style/PPC2ARM/issues
|
|
9
|
+
Keywords: powerpc,ppc,arm,isa,assembly,instruction-set,reference,cli
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Operating System :: MacOS
|
|
13
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
14
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
15
|
+
Classifier: Topic :: Software Development :: Disassemblers
|
|
16
|
+
Classifier: Topic :: Software Development :: Documentation
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Provides-Extra: gui
|
|
21
|
+
Requires-Dist: wxPython>=4.2; extra == "gui"
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# PPC2ARM — PowerPC ↔ ARM/AArch64 Instruction Picker
|
|
25
|
+
|
|
26
|
+
### *From the minds of IBM Bob & Daneyand*
|
|
27
|
+
|
|
28
|
+
[](https://github.com/007Style/PPC2ARM/releases/latest)
|
|
29
|
+
[](https://github.com/007Style/PPC2ARM/releases/latest)
|
|
30
|
+
[](LICENSE)
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
██████╗ ██████╗ ██████╗██████╗ █████╗ ██████╗ ███╗ ███╗
|
|
34
|
+
██╔══██╗██╔══██╗██╔════╝╚════██╗██╔══██╗██╔══██╗████╗ ████║
|
|
35
|
+
██████╔╝██████╔╝██║ █████╔╝███████║██████╔╝██╔████╔██║
|
|
36
|
+
██╔═══╝ ██╔═══╝ ██║ ██╔═══╝ ██╔══██║██╔══██╗██║╚██╔╝██║
|
|
37
|
+
██║ ██║ ╚██████╗███████╗██║ ██║██║ ██║██║ ╚═╝ ██║
|
|
38
|
+
╚═╝ ╚═╝ ╚═════╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝
|
|
39
|
+
|
|
40
|
+
PowerPC ↔ ARM / AArch64 ISA Translation Station
|
|
41
|
+
Retro Museum Edition • v1.0.0
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
> *"Any sufficiently successful ISA is indistinguishable from a mistake that won."*
|
|
45
|
+
> — PPC2ARM Fortune Cookie
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## What Is This Thing?
|
|
50
|
+
|
|
51
|
+
PPC2ARM is a **fully self-contained Python tool** that answers the age-old question every systems programmer eventually screams at their monitor:
|
|
52
|
+
|
|
53
|
+
> *"OK so `lwz` loads a word on PowerPC — what in the HECK is the ARM equivalent?!"*
|
|
54
|
+
|
|
55
|
+
The answer, dear friend, is `LDR`. And PPC2ARM will tell you that, along with the syntax, the semantics, a confidence rating, and a detailed note explaining exactly where the two architectures diverge — because they always diverge somewhere, and that somewhere will absolutely ruin your Tuesday if you don't know about it.
|
|
56
|
+
|
|
57
|
+
This tool maps **PowerPC** (PPC32, PPC64, AltiVec/VMX) instructions to their **ARM / AArch64** equivalents, and vice-versa. When no direct analogue exists — and sometimes it really doesn't — the tool suggests the closest approximation and stamps it clearly with a `[SUGGESTION]` badge so you don't accidentally assume that `VPERM` and `TBL` are the same instruction. (They're close. They're not the same. Endianness is involved. We're sorry.)
|
|
58
|
+
|
|
59
|
+
All instruction data is **embedded directly in Python source files**. No internet connection. No database. No cloud. No subscriptions. No telemetry. No AI-generated hallucinations about fictional mnemonics. Just cold, hard, manually-researched ISA facts, lovingly compiled and cross-referenced from the actual architecture manuals.
|
|
60
|
+
|
|
61
|
+
Oh, and there's a **retro phosphor-green wxPython GUI** with an ISA Museum, a scrolling trivia ticker, and a Konami code easter egg. Because why not.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## The Origin Story
|
|
66
|
+
|
|
67
|
+
Once upon a time, a developer was porting PowerPC assembly to AArch64. They opened seventeen browser tabs, three PDF copies of the ARM Architecture Reference Manual, two copies of the IBM POWER ISA spec, and one very strong coffee.
|
|
68
|
+
|
|
69
|
+
Four hours later, they had translated twelve instructions and developed a nervous tic every time they saw the word "endianness."
|
|
70
|
+
|
|
71
|
+
PPC2ARM was built so that never happens to anyone again.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Features
|
|
76
|
+
|
|
77
|
+
### 🔍 Bidirectional Instruction Lookup
|
|
78
|
+
Look up any PowerPC mnemonic and get its ARM/AArch64 analogue. Or go the other way — look up an ARM mnemonic and find out what PPC instruction it corresponds to. Both directions. All day. No fuss.
|
|
79
|
+
|
|
80
|
+
### 🎯 Four Confidence Levels
|
|
81
|
+
Not all analogues are created equal. PPC2ARM is honest about this:
|
|
82
|
+
|
|
83
|
+
| Badge | Meaning |
|
|
84
|
+
|-------|---------|
|
|
85
|
+
| `[DIRECT]` | Near-identical semantics. Safe 1-to-1 substitution. You're golden. |
|
|
86
|
+
| `[CLOSE]` | Same intent, minor differences in flag behavior, register model, or operand order. Read the notes. |
|
|
87
|
+
| `[SUGGESTION]` | Closest we've got. Programmer must verify. Endianness may be involved. Good luck. |
|
|
88
|
+
| `[NO MATCH]` | Nothing reasonable exists. We're telling you this so you don't waste three hours looking. |
|
|
89
|
+
|
|
90
|
+
### 🤖 Fuzzy Search
|
|
91
|
+
Typo in your mnemonic? Type `lwzz` instead of `lwz`? PPC2ARM's Levenshtein-powered fuzzy matcher will gently suggest what you probably meant, ranked by similarity score. No judgment.
|
|
92
|
+
|
|
93
|
+
### 📖 Comprehensive ISA Coverage
|
|
94
|
+
|
|
95
|
+
**PowerPC side:**
|
|
96
|
+
- PPC32 integer arithmetic — `add`, `subf`, `mullw`, `divw`, `neg`, all the dot-forms, all the overflow forms, the whole family
|
|
97
|
+
- PPC64 extensions — `ld`, `std`, `mulld`, `divd`, `extsw`, `cntlzd`, and friends
|
|
98
|
+
- Load/store with update forms — `lwzu`, `stwu`, `ldu`, `stdu` (the ARM equivalents involve pre/post-index addressing and we explain exactly how)
|
|
99
|
+
- Condition register instructions — `mfcr`, `mtcr`, `crand`, `cror`, `crxor`
|
|
100
|
+
- AltiVec/VMX — `vaddubm` through `vrsqrtefp`, vector permute, splat, merge, compare, and more
|
|
101
|
+
- Floating point — `fadd`, `fsub`, `fmul`, `fdiv`, `fmadd`, `fnmadd`, `fabs`, `fsqrt`, `fctiw`, `fcfid`, all of it
|
|
102
|
+
- System/privileged — `sc`, `mtspr`, `mfspr`, `mflr`, `mtlr`, `rfi`, `tlbie`, `isync`, `sync`, `lwsync`, `icbi`, `dcbf`
|
|
103
|
+
- Branch family — `b`, `bl`, `blr`, `bctr`, `bc`, `beq`, `bne`, `blt`, `bgt`, `bdz`, `bdnz`
|
|
104
|
+
|
|
105
|
+
**ARM / AArch64 side:**
|
|
106
|
+
- Base integer — `ADD`/`ADDS`/`SUB`/`SUBS`/`ADC`/`SBC`, `MUL`/`MADD`/`MSUB`, `SMULL`/`UMULL`/`SMULH`/`UMULH`, `SDIV`/`UDIV`
|
|
107
|
+
- Logic — `AND`/`ANDS`/`ORR`/`ORN`/`EOR`/`EON`/`BIC`/`BICS`/`MVN`/`TST`
|
|
108
|
+
- Move — `MOV`/`MOVZ`/`MOVK`/`MOVN`
|
|
109
|
+
- Shifts — `LSL`/`LSR`/`ASR`/`ROR`/`EXTR`/`UBFM`/`SBFM`/`BFM`
|
|
110
|
+
- Bit ops — `CLZ`/`CLS`/`RBIT`/`REV`/`REV16`/`REV32`
|
|
111
|
+
- Sign/zero extend — `SXTB`/`SXTH`/`SXTW`/`UXTB`/`UXTH`
|
|
112
|
+
- Compare & select — `CMP`/`CMN`/`CSEL`/`CSINC`/`CSET`/`CINC`
|
|
113
|
+
- Address — `ADR`/`ADRP`
|
|
114
|
+
- Load/store — `LDR`/`LDRB`/`LDRSB`/`LDRH`/`LDRSH`/`LDRSW`/`STR`/`STRB`/`STRH`/`LDP`/`STP`, pre/post-index forms
|
|
115
|
+
- Exclusives & atomics — `LDXR`/`STXR`, LSE atomics (`LDADD`/`STADD`/`CAS`) for ARMv8.1-A
|
|
116
|
+
- Branch — `B`/`BL`/`BR`/`BLR`/`RET`/`B.cond`/`CBZ`/`CBNZ`/`TBZ`/`TBNZ`
|
|
117
|
+
- System — `SVC`/`HVC`/`SMC`/`ERET`/`MRS`/`MSR`/`ISB`/`DSB`/`DMB`/`NOP`/`WFE`/`WFI`/`TLBI`/`DC`/`IC`
|
|
118
|
+
- FP scalar — `FADD`/`FSUB`/`FMUL`/`FDIV`/`FMADD`/`FMSUB`/`FNMADD`/`FABS`/`FNEG`/`FSQRT`/`FCVTZS`/`SCVTF`/`FCMP`/`FCVT`/`FMOV`
|
|
119
|
+
- NEON/ASIMD — `ADD`/`SUB`/`MUL` (vec), `AND`/`ORR`/`EOR` (vec), `BSL`/`BIF`/`BIT`, `FADD`/`FMUL`/`FMLA`/`FMLS` (vec), `ADDV`, `ZIP1`/`ZIP2`/`UZP1`, `TBL`/`TBX`, `DUP`/`INS`, `LD1`/`ST1`/`LD2`/`ST2`, `CMGE`/`CMEQ`, `FRECPE`/`FRSQRTE`
|
|
120
|
+
- SVE — `ADD`/`LD1W`/`ST1W`/`WHILELT`/`PTRUE`/`FMAD`
|
|
121
|
+
|
|
122
|
+
### 🗺️ Detailed Porting Notes
|
|
123
|
+
Every single mapping entry comes with a human-written note explaining the architectural differences. Register model differences. Flag behavior differences. Operand order gotchas (`subf` is `rD = rB - rA` — note the reversed operand order!). Endianness implications for vector operations. Update-form addressing idioms. These notes are the thing that would have saved you three hours.
|
|
124
|
+
|
|
125
|
+
### 🏛️ ISA Museum (GUI)
|
|
126
|
+
A browsable, interactive reference of historical CPU architectures — because context matters, history is fascinating, and sometimes you just want to know why Alpha has no byte load instructions. The Museum covers:
|
|
127
|
+
|
|
128
|
+
- **ARM / AArch64** — from Acorn's BBC Micro lab to Apple Silicon dominating the laptop market
|
|
129
|
+
- **PowerPC / POWER** — from the AIM alliance to IBM POWER10 running your cloud
|
|
130
|
+
- **SPARC** — register windows, Sun workstations, Oracle, the end
|
|
131
|
+
- **Alpha AXP** — the fastest CPU of its era, killed by corporate acquisition
|
|
132
|
+
- **MIPS** — the textbook RISC, the SGI workstations, the Nintendo 64
|
|
133
|
+
- **PA-RISC** — HP's precision architecture and its nullification delay slots
|
|
134
|
+
- **Itanium (IA-64)** — the most expensively engineered commercial failure in CPU history
|
|
135
|
+
- **Motorola 68000** — the original Mac, the Amiga, the Atari ST, and ColdFire still shipping today
|
|
136
|
+
- **VAX** — the CISC pinnacle that accidentally invented the RISC movement
|
|
137
|
+
- **RISC-V** — the open challenger, rising fast
|
|
138
|
+
|
|
139
|
+
Each architecture gets a full museum placard: vendor, birth year, death year (if applicable), bit width, endianness, register count, description, and a "Famous For" section. Plus a Random Fact button. Plus a side-by-side comparison panel.
|
|
140
|
+
|
|
141
|
+
### 📜 75+ Historical ISA Facts
|
|
142
|
+
Trivia items covering history, design decisions, compiler implications, benchmarks, and delightful quirks. Did you know:
|
|
143
|
+
|
|
144
|
+
- The original ARM chip ran on a BBC Micro's power supply because the Acorn lab couldn't afford a better one, and the low power consumption was an *accident*?
|
|
145
|
+
- SPARC has no multiply or divide in the base ISA — early chips needed a firmware trap to do multiplication?
|
|
146
|
+
- The VAX 11/780 was literally defined as "1 MIPS" and became the industry baseline unit of compute?
|
|
147
|
+
- Alpha has no byte load instructions — you have to extract bytes with special ZAP instructions?
|
|
148
|
+
- Itanium's IA-32 compatibility mode ran x86 code 5-10× slower than a contemporary Pentium 4?
|
|
149
|
+
|
|
150
|
+
The ticker bar at the bottom of the GUI scrolls through these facts continuously. Right-click it to filter by ISA.
|
|
151
|
+
|
|
152
|
+
### 💬 24 Compiler & ISA Quotes
|
|
153
|
+
From the luminaries who built these machines:
|
|
154
|
+
- David Patterson and John Hennessy on RISC
|
|
155
|
+
- Sophie Wilson and Steve Furber on accidentally inventing the world's most-used CPU
|
|
156
|
+
- Jim Keller on the architectural tragedy of x86
|
|
157
|
+
- Fred Brooks on software engineering
|
|
158
|
+
- Dave Cutler on operating systems
|
|
159
|
+
- And several anonymous observations from the trenches that are uncomfortably accurate
|
|
160
|
+
|
|
161
|
+
### 🎮 Easter Eggs
|
|
162
|
+
Because life is short and assembly is hard:
|
|
163
|
+
|
|
164
|
+
- **Konami Code** (↑↑↓↓←→←→BA) — Unlocks the ISA Graveyard, complete with silicon tombstones for Alpha, PA-RISC, Itanium, desktop MIPS, and VAX
|
|
165
|
+
- **Click the title 7 times** — Discovers what happens when architectures retire
|
|
166
|
+
- **Right-click the status bar** — Random compiler quote
|
|
167
|
+
- **Right-click the ticker** — Filter trivia by ISA
|
|
168
|
+
- **The About dialog** has a hidden click zone — find it
|
|
169
|
+
- **Help menu** gets a secret "Show Compiler Quotes" item after the Konami code
|
|
170
|
+
- **Extras menu** — ISA Timeline, Instruction Count Stats, Benchmark Trivia
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Download
|
|
175
|
+
|
|
176
|
+
> **[⬇ Download PPC2ARM v1.0.0 for macOS (Apple Silicon)](https://github.com/007Style/PPC2ARM/releases/latest)**
|
|
177
|
+
|
|
178
|
+
| Platform | File | Size |
|
|
179
|
+
|----------|------|------|
|
|
180
|
+
| macOS (Apple Silicon / arm64) | [`PPC2ARM-1.0.0-macos-arm64.zip`](https://github.com/007Style/PPC2ARM/releases/download/v1.0.0/PPC2ARM-1.0.0-macos-arm64.zip) | ~41 MB |
|
|
181
|
+
|
|
182
|
+
**To install the macOS app:**
|
|
183
|
+
1. Download `PPC2ARM-1.0.0-macos-arm64.zip` from the link above
|
|
184
|
+
2. Unzip it (double-click or `unzip PPC2ARM-1.0.0-macos-arm64.zip`)
|
|
185
|
+
3. Drag `PPC2ARM.app` to your `/Applications` folder
|
|
186
|
+
4. **First launch:** Right-click → Open (bypasses the Gatekeeper "unidentified developer" warning — the app is unsigned but safe)
|
|
187
|
+
5. Double-click to open normally from then on
|
|
188
|
+
|
|
189
|
+
No Python installation required. No dependencies. It just runs.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Install with pipx (recommended)
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
pipx install ppc2arm
|
|
197
|
+
ppc2arm --from ppc --instr lwz # single lookup
|
|
198
|
+
ppc2arm # interactive REPL
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
The CLI and REPL have no dependencies. For the retro ISA-museum GUI, add wxPython to the same
|
|
202
|
+
isolated environment, then launch it:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
pipx inject ppc2arm wxPython
|
|
206
|
+
ppc2arm --gui
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Upgrade with `pipx upgrade ppc2arm`; remove with `pipx uninstall ppc2arm`. If the command is not found,
|
|
210
|
+
run `pipx ensurepath` and open a new terminal.
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Requirements (running from source)
|
|
215
|
+
|
|
216
|
+
- **Python 3.10+**
|
|
217
|
+
- **wxPython >= 4.2** (GUI only — CLI and REPL work without it)
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
pip install wxPython
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
The CLI and REPL have **zero external dependencies**. Pure stdlib Python.
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Installation (from source)
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
git clone https://github.com/007Style/PPC2ARM.git
|
|
231
|
+
cd PPC2ARM
|
|
232
|
+
pip install -e . # CLI/REPL only
|
|
233
|
+
pip install -e '.[gui]' # plus the wxPython GUI
|
|
234
|
+
ppc2arm --help
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
That's it. There's no build step, no compiled extension, no C code, no Rust. Just Python files.
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Usage
|
|
242
|
+
|
|
243
|
+
### Single-Shot CLI Lookup
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
# PPC → ARM
|
|
247
|
+
ppc2arm --from ppc --instr lwz
|
|
248
|
+
ppc2arm --from ppc --instr add
|
|
249
|
+
ppc2arm --from ppc --instr fmadd --mode 64
|
|
250
|
+
ppc2arm --from ppc --instr vaddubm
|
|
251
|
+
ppc2arm --from ppc --instr blr
|
|
252
|
+
ppc2arm --from ppc --instr sc
|
|
253
|
+
ppc2arm --from ppc --instr bdnz
|
|
254
|
+
|
|
255
|
+
# ARM → PPC
|
|
256
|
+
ppc2arm --from arm --instr LDR
|
|
257
|
+
ppc2arm --from arm --instr FMADD
|
|
258
|
+
ppc2arm --from arm --instr ZIP1
|
|
259
|
+
ppc2arm --from arm --instr SVC
|
|
260
|
+
ppc2arm --from arm --instr CAS
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Example output for `--from ppc --instr fmadd --mode 64`:
|
|
264
|
+
```
|
|
265
|
+
FMADD [DIRECT]
|
|
266
|
+
Floating-Point Multiply-Add
|
|
267
|
+
Syntax : frD, frA, frC, frB
|
|
268
|
+
Computes frA*frC+frB in double-precision and places result in frD.
|
|
269
|
+
|
|
270
|
+
→ ARM analogues:
|
|
271
|
+
FMADD Floating-point Fused Multiply-Add (scalar)
|
|
272
|
+
Syntax: Sd/Dd, Sn/Dn, Sm/Dm, Sa/Da
|
|
273
|
+
Computes Sn*Sm + Sa in a single fused operation.
|
|
274
|
+
|
|
275
|
+
ℹ FP fused multiply-add double; AArch64 FMADD Dd,Dn,Dm,Da — exact equivalent.
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Example output for `--from ppc --instr bdnz` (a suggestion):
|
|
279
|
+
```
|
|
280
|
+
BDNZ [SUGGESTION]
|
|
281
|
+
|
|
282
|
+
→ ARM analogues:
|
|
283
|
+
CBNZ Compare and Branch if Non-Zero
|
|
284
|
+
SUBS Subtract, setting flags
|
|
285
|
+
|
|
286
|
+
⚠ Branch if CTR not zero after decrement; SUBS Xn,Xn,#1 + CBNZ.
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Interactive REPL
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
ppc2arm # no args drops you into REPL
|
|
293
|
+
ppc2arm --repl # explicit flag
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
The REPL greets you with a random compiler quote and a prompt that shows your current direction and mode:
|
|
297
|
+
|
|
298
|
+
```
|
|
299
|
+
PPC2ARM — ISA Translation Station PowerPC ↔ ARM/AArch64 v1.0.0
|
|
300
|
+
|
|
301
|
+
Direction: PPC → ARM Mode: 32-bit
|
|
302
|
+
Type 'help' for commands, 'quit' to exit.
|
|
303
|
+
|
|
304
|
+
"Low power was not a goal for the original ARM. It was an accident." — Sophie Wilson
|
|
305
|
+
|
|
306
|
+
ppc2arm[ppc/32]>
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
Full command reference:
|
|
310
|
+
|
|
311
|
+
```
|
|
312
|
+
ppc2arm[ppc/32]> lookup lwz # translate lwz PPC→ARM
|
|
313
|
+
ppc2arm[ppc/32]> search vector # full-text search in PPC instruction set
|
|
314
|
+
ppc2arm[ppc/32]> set dir arm # switch to ARM→PPC direction
|
|
315
|
+
ppc2arm[arm/32]> lookup LDR # translate LDR ARM→PPC
|
|
316
|
+
ppc2arm[arm/32]> set mode 64 # switch to 64-bit mode
|
|
317
|
+
ppc2arm[arm/64]> lookup SMULH # 64-bit ARM multiply high
|
|
318
|
+
ppc2arm[arm/64]> list categories # see all instruction categories
|
|
319
|
+
ppc2arm[arm/64]> info arm # full ARM ISA museum placard
|
|
320
|
+
ppc2arm[arm/64]> info ppc # full PPC museum placard
|
|
321
|
+
ppc2arm[arm/64]> info alpha # Alpha AXP — RIP 2004
|
|
322
|
+
ppc2arm[arm/64]> random fact # random fact from any ISA
|
|
323
|
+
ppc2arm[arm/64]> random fact arm # random fact about ARM specifically
|
|
324
|
+
ppc2arm[arm/64]> help # full command reference
|
|
325
|
+
ppc2arm[arm/64]> quit # or just Ctrl+D
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
You can also just type a mnemonic directly without `lookup`:
|
|
329
|
+
```
|
|
330
|
+
ppc2arm[ppc/32]> vaddubm
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### GUI
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
ppc2arm --gui
|
|
337
|
+
ppc2arm --gui --mode 64
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
The GUI opens the **ISA Translation Station** window with:
|
|
341
|
+
- **Lookup tab** — searchable instruction list on the left, full detail panel on the right
|
|
342
|
+
- **ISA Museum tab** — browse all 11 ISA profiles with timeline graphics and random facts
|
|
343
|
+
- **History Log tab** — every lookup you've done this session, timestamped
|
|
344
|
+
- **Mode bar** — toggle PPC→ARM / ARM→PPC direction and 32/64-bit mode
|
|
345
|
+
- **Ticker bar** — scrolling ISA trivia at the bottom (right-click to filter)
|
|
346
|
+
- **Status bar** — instruction counts and last operation (right-click for a quote)
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## Architecture
|
|
351
|
+
|
|
352
|
+
```
|
|
353
|
+
PPC2ARM/ # all packages below live in src/ppc2arm/
|
|
354
|
+
├── src/ppc2arm/cli.py # CLI entry point (single-shot, REPL) & GUI launcher
|
|
355
|
+
├── pyproject.toml # packaging; wxPython is the optional [gui] extra
|
|
356
|
+
├── README.md # You are here
|
|
357
|
+
│
|
|
358
|
+
├── core/
|
|
359
|
+
│ ├── __init__.py
|
|
360
|
+
│ ├── engine.py # InstructionEngine — lookup, search, categories,
|
|
361
|
+
│ │ # ISA profiles, random facts, compiler quotes
|
|
362
|
+
│ ├── registry.py # ISARegistry — pluggable ISA tables, version/
|
|
363
|
+
│ │ # capability filtering, mode compatibility
|
|
364
|
+
│ └── fuzzy.py # Levenshtein fuzzy matcher — no external deps,
|
|
365
|
+
│ # prefix/substring/edit-distance scoring
|
|
366
|
+
│
|
|
367
|
+
├── data/
|
|
368
|
+
│ ├── __init__.py
|
|
369
|
+
│ ├── isa_schema.py # Dataclasses: Instruction, MappingEntry,
|
|
370
|
+
│ │ # ISACapability; well-known capability constants
|
|
371
|
+
│ │ # (ARMv8.0-A → ARMv9.2-A, NEON, SVE, SME,
|
|
372
|
+
│ │ # PowerISA-2.07 → PowerISA-3.1)
|
|
373
|
+
│ ├── ppc_instructions.py # 423 PPC mnemonics: PPC32, PPC64, AltiVec/VMX,
|
|
374
|
+
│ │ # all dot-forms, overflow forms, update forms
|
|
375
|
+
│ ├── arm_instructions.py # 164 ARM mnemonics: AArch64 base, FP scalar,
|
|
376
|
+
│ │ # NEON/ASIMD, SVE, SVE2, LSE atomics
|
|
377
|
+
│ ├── mappings.py # 256 PPC_TO_ARM entries + auto-generated
|
|
378
|
+
│ │ # ARM_TO_PPC reverse table; full porting notes
|
|
379
|
+
│ └── isa_trivia.py # 75 ISA facts, 11 profiles, 24 quotes,
|
|
380
|
+
│ # Konami unlock text, hidden messages
|
|
381
|
+
│
|
|
382
|
+
└── gui/
|
|
383
|
+
├── __init__.py
|
|
384
|
+
├── app.py # PPC2ARMApp (wx.App) + MainFrame + HistoryPanel
|
|
385
|
+
├── theme.py # Retro phosphor-green colour palette, fonts,
|
|
386
|
+
│ # apply_theme(), confidence_colour()
|
|
387
|
+
├── mode_bar.py # Direction toggle (PPC↔ARM) + mode selector (32/64)
|
|
388
|
+
│ # emits EVT_DIRECTION_CHANGED, EVT_MODE_CHANGED
|
|
389
|
+
├── main_panel.py # SplitterWindow: SearchableList + ResultPanel
|
|
390
|
+
├── result_panel.py # RichTextCtrl-based instruction detail renderer
|
|
391
|
+
├── isa_museum.py # ISAMuseumPanel + ISATimelineDialog
|
|
392
|
+
├── easter_eggs.py # EasterEggManager: Konami code, title clicks,
|
|
393
|
+
│ # graveyard dialog, secret menu items
|
|
394
|
+
└── widgets/
|
|
395
|
+
├── __init__.py
|
|
396
|
+
├── searchable_list.py # SearchCtrl + ListCtrl with live filtering
|
|
397
|
+
├── ticker_bar.py # wx.Timer-driven scrolling trivia ticker
|
|
398
|
+
└── about_dialog.py # About dialog + hidden Easter egg click zone
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
## The Mapping Table — A Philosophical Note
|
|
404
|
+
|
|
405
|
+
Instruction set mapping is not a pure function. Two mnemonics from different ISAs can have the same *name*, similar *syntax*, identical *behavior in the common case*, and still behave differently at the edges in ways that will destroy your program if you're not careful.
|
|
406
|
+
|
|
407
|
+
A few examples of things PPC2ARM tracks so you don't have to discover them the hard way:
|
|
408
|
+
|
|
409
|
+
**`subf` is not `SUB`** — PowerPC's `subf rD,rA,rB` computes `rD = rB - rA`. Note the reversed operands. ARM's `SUB Xd,Xn,Xm` computes `Xd = Xn - Xm`. If you translate naively without swapping operands, you will get the wrong sign. Confidence: `close`.
|
|
410
|
+
|
|
411
|
+
**`lwzu` is not a simple `LDR`** — The PPC update-form `lwzu rD,d(rA)` loads from memory AND writes the updated address back into rA. ARM's post-index `LDR Wt,[Xn],#imm` and pre-index `LDR Wt,[Xn,#imm]!` cover this idiom, but the encoding and assembly syntax are different. Confidence: `close`.
|
|
412
|
+
|
|
413
|
+
**`vaddubm` is `ADD Vd.16B`** — This one actually maps directly. PPC AltiVec adds sixteen unsigned bytes modulo 256; AArch64 NEON does exactly the same thing. Confidence: `direct`. (Enjoy it. These are rare.)
|
|
414
|
+
|
|
415
|
+
**`vperm` is not `TBL`** — Both are byte-shuffle instructions that use a separate index vector. But PPC AltiVec `vperm` is big-endian by design (element 0 is at the high byte), while AArch64 `TBL` is little-endian. If you're doing vector permutations and your results look reversed, this is why. Confidence: `close`, with a note.
|
|
416
|
+
|
|
417
|
+
**`bdnz` has no ARM equivalent** — PowerPC has a dedicated Count Register (CTR) and `bdnz` decrements it and branches if non-zero, in a single instruction. ARM has no CTR. You need `SUBS Xn,Xn,#1` followed by `CBNZ Xn,label`. Two instructions. Confidence: `suggestion`.
|
|
418
|
+
|
|
419
|
+
This is the level of detail throughout the entire mapping table.
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
## Data Sources
|
|
424
|
+
|
|
425
|
+
Every instruction definition and mapping was researched against the official architecture documentation:
|
|
426
|
+
|
|
427
|
+
| Source | Document |
|
|
428
|
+
|--------|----------|
|
|
429
|
+
| IBM POWER ISA v3.1 | IBM OpenPOWER Foundation (public PDF) |
|
|
430
|
+
| IBM POWER ISA v2.07 | IBM OpenPOWER Foundation (public PDF) |
|
|
431
|
+
| Arm Architecture Reference Manual (ARMv8, for A-profile) | developer.arm.com |
|
|
432
|
+
| Arm Architecture Reference Manual Supplement — SVE | developer.arm.com |
|
|
433
|
+
| Arm Neon Intrinsics Reference | developer.arm.com |
|
|
434
|
+
| Arm A64 Instruction Set Architecture | developer.arm.com |
|
|
435
|
+
| SPARC v8/v9 Architecture Manual | SPARC International / IEEE Std 1754 |
|
|
436
|
+
| Alpha Architecture Reference Manual | Digital Equipment Corporation |
|
|
437
|
+
| MIPS32/64 Architecture Reference Manual | MIPS Technologies |
|
|
438
|
+
| PA-RISC 2.0 Architecture Reference Manual | Hewlett-Packard |
|
|
439
|
+
| IA-64 Application Developer's Architecture Guide | Intel Corporation |
|
|
440
|
+
| M68000 Family Programmer's Reference Manual | Motorola |
|
|
441
|
+
| VAX Architecture Reference Manual | Digital Equipment Corporation |
|
|
442
|
+
|
|
443
|
+
---
|
|
444
|
+
|
|
445
|
+
## Non-Goals
|
|
446
|
+
|
|
447
|
+
To keep the scope honest, PPC2ARM intentionally does NOT:
|
|
448
|
+
|
|
449
|
+
- Assemble or disassemble actual machine code bytes
|
|
450
|
+
- Decode binary instruction encodings
|
|
451
|
+
- Emulate PowerPC or ARM execution
|
|
452
|
+
- Cover every POWER10 / AMX / AVX-512 / SME2 extension in depth
|
|
453
|
+
- Make network calls, phone home, or collect telemetry
|
|
454
|
+
- Package as a macOS .app bundle or .dmg (just run the Python script)
|
|
455
|
+
- Replace reading the actual architecture manuals (seriously, read them)
|
|
456
|
+
|
|
457
|
+
---
|
|
458
|
+
|
|
459
|
+
## A Love Letter to the ISAs That Didn't Make It
|
|
460
|
+
|
|
461
|
+
This tool was built partly out of genuine respect for the architectures that lost the market wars but won the engineering argument. Alpha was faster than everything. PA-RISC had nullification. Itanium had predication on literally every instruction. VAX had MATCHC — a single instruction that finds a substring in memory.
|
|
462
|
+
|
|
463
|
+
They lost to x86 not because they were worse, but because compatibility, economics, and timing matter more than elegance.
|
|
464
|
+
|
|
465
|
+
ARM won not because it was the most powerful, but because it was cheap to license, simple to implement, and drew almost no power. Sophie Wilson and Steve Furber designed it in eighteen months with a team of twelve. The chip ran off a BBC Micro's leftover power supply. The low power consumption was, famously, an accident.
|
|
466
|
+
|
|
467
|
+
That chip now runs in over 250 billion devices.
|
|
468
|
+
|
|
469
|
+
Architecture is humbling.
|
|
470
|
+
|
|
471
|
+
---
|
|
472
|
+
|
|
473
|
+
## Acknowledgments
|
|
474
|
+
|
|
475
|
+
Built with:
|
|
476
|
+
- **Python 3.10+** — the language that outlasted every framework war
|
|
477
|
+
- **wxPython 4.2** — the GUI toolkit that refuses to die, and we love it for that
|
|
478
|
+
- **IBM POWER ISA specification** — thank you IBM for making it public
|
|
479
|
+
- **Arm Architecture Reference Manual** — available free at developer.arm.com
|
|
480
|
+
- **The entire history of computer architecture** — standing on the shoulders of giants
|
|
481
|
+
|
|
482
|
+
*From the minds of IBM Bob & Daneyand — two entities who spent way too long thinking about instruction sets so you don't have to.*
|
|
483
|
+
|
|
484
|
+
---
|
|
485
|
+
|
|
486
|
+
## License
|
|
487
|
+
|
|
488
|
+
MIT — see [LICENSE](LICENSE). Do whatever you want with it. Port it to RISC-V. We dare you.
|
|
489
|
+
|
|
490
|
+
```
|
|
491
|
+
† Alpha AXP (1992–2004) "Fastest ever. Gone too soon."
|
|
492
|
+
† PA-RISC (1986–2008) "Precision was its middle name."
|
|
493
|
+
† Itanium (2001–2021) "Explicitly parallel in failure."
|
|
494
|
+
† MIPS (desktop)(1985–2002) "Textbook perfect, market lost."
|
|
495
|
+
† VAX (1977–2000) "CISC pinnacle. RISC casualty."
|
|
496
|
+
|
|
497
|
+
♥ ARM still alive (in your pocket right now)
|
|
498
|
+
♥ PowerPC/POWER still alive (in your cloud, your car, your console)
|
|
499
|
+
♥ RISC-V rising fast (open, free, unstoppable)
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
---
|
|
503
|
+
|
|
504
|
+
> *From the minds of IBM Bob & Daneyand*
|