From d0409f599b78081c9e457b52494c4ebed142f5ad Mon Sep 17 00:00:00 2001 From: Richard Patel Date: Wed, 25 Aug 2021 03:37:02 +0200 Subject: [PATCH] cleanup, remove stale codegen defs --- codegen/.gitignore | 2 - codegen/gen_masks.py | 38 -------- codegen/patterns.txt | 222 ------------------------------------------ disasm/Cargo.toml | 4 +- disasm/src/lib.rs | 7 +- disasm/src/prelude.rs | 3 - 6 files changed, 8 insertions(+), 268 deletions(-) delete mode 100644 codegen/.gitignore delete mode 100644 codegen/gen_masks.py delete mode 100644 codegen/patterns.txt delete mode 100644 disasm/src/prelude.rs diff --git a/codegen/.gitignore b/codegen/.gitignore deleted file mode 100644 index f4e465b..0000000 --- a/codegen/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -masks.txt -__pycache__ diff --git a/codegen/gen_masks.py b/codegen/gen_masks.py deleted file mode 100644 index 5ffa043..0000000 --- a/codegen/gen_masks.py +++ /dev/null @@ -1,38 +0,0 @@ -import sys - - -def apply_pattern(pattern, mask, bits): - start, stop, value = map(int, pattern.split(",")) - bit_count = stop - start + 1 - shift = 31 - stop - mask |= ((1 << bit_count) - 1) << shift - bits |= value << shift - return mask, bits - - -def dump_mask(line): - parts = line.split(" ") - opcode = parts[0] - patterns = parts[1:] - assert len(patterns) > 0 - mask, bits = 0, 0 - for pattern in patterns: - mask, bits = apply_pattern(pattern, mask, bits) - print(f' "{opcode}" & {hex(mask)} == {hex(bits)};') - - -def main(): - with open("patterns.txt", "r") as patterns, open( - "../disasm/src/isa.rs", "w" - ) as isa_file: - sys.stdout = isa_file - print("use ppc750cl_macros::isa;") - print() - print("isa! {") - for line in patterns.readlines(): - dump_mask(line) - print("}") - - -if __name__ == "__main__": - main() diff --git a/codegen/patterns.txt b/codegen/patterns.txt deleted file mode 100644 index 07b5e3e..0000000 --- a/codegen/patterns.txt +++ /dev/null @@ -1,222 +0,0 @@ -add 0,5,31 21,30,266 -addc 0,5,31 21,30,21 -adde 0,5,31 21,30,138 -addi 0,5,14 -addic 0,5,12 -addic. 0,5,13 -addis 0,5,15 -addme 0,5,31 16,20,0 22,30,234 -addze 0,5,31 16,20,0 22,30,202 -and 0,5,31 21,30,28 -andc 0,5,31 21,30,60 -andi. 0,5,28 -andis. 0,5,29 -b 0,5,18 -bc 0,5,16 -bcctr 0,5,19 16,20,0 21,31,528 -bclr 0,5,19 16,20,0 21,30,16 -cmp 0,5,31 9,9,0 21,31,0 -cmpi 0,5,11 9,9,0 -cmpl 0,5,31 9,9,0 21,30,32 31,31,0 -cmpli 0,5,10 9,9,0 -cntlzw 0,5,31 16,20,0 21,30,26 -crand 0,5,19 21,30,257 31,31,0 -crandc 0,5,19 21,30,129 31,31,0 -creqv 0,5,19 21,30,289 31,31,0 -crnand 0,5,19 21,30,225 31,31,0 -crnor 0,5,19 21,30,33 31,31,0 -cror 0,5,19 21,30,449 31,31,0 -crorc 0,5,19 21,30,417 31,31,0 -crxor 0,5,19 21,30,193 31,31,0 -dcbf 0,5,31 6,10,0 21,30,86 31,31,0 -dcbi 0,5,31 6,10,0 21,30,470 31,31,0 -dcbst 0,5,31 6,10,0 21,30,54 31,31,0 -dcbt 0,5,31 6,10,0 21,30,278 31,31,0 -dcbtst 0,5,31 6,10,0 21,30,246 31,31,0 -dcbz 0,5,31 6,10,0 21,30,1014 31,31,0 -dcbz_l 0,5,4 6,10,0 21,30,1014 31,31,0 -divw 0,5,31 22,30,491 -divwu 0,5,31 22,30,459 -eciwx 0,5,31 22,30,310 31,31,0 -ecowx 0,5,31 22,30,438 31,31,0 -eieio 0,5,31 6,20,0 21,30,854 31,31,0 -eqv 0,5,31 22,30,284 -extsb 0,5,31 16,20,0 21,30,954 -extsh 0,5,31 16,20,0 21,30,922 -fabs 0,5,63 11,15,0 21,30,922 -fadd 0,5,63 21,25,0 26,30,21 -fadds 0,5,59 21,25,0 26,30,21 -fcmpo 0,5,63 9,10,0 21,30,32 31,31,0 -fcmpu 0,5,63 9,10,0 21,30,0 31,31,0 -fctiw 0,5,63 11,15,0 21,30,14 -fctiwz 0,5,63 11,15,0 21,30,15 -fdiv 0,5,63 21,25,0 26,30,18 -fdivs 0,5,59 21,25,0 26,30,18 -fmadd 0,5,63 26,30,29 -fmadds 0,5,59 26,30,29 -fmr 0,5,63 11,15,0 21,30,72 -fmsub 0,5,63 26,30,28 -fmsubs 0,5,59 26,30,28 -fmul 0,5,63 16,20,0 26,30,25 -fmuls 0,5,59 16,20,0 26,30,25 -fnabs 0,5,63 11,15,0 21,30,136 -fneg 0,5,63 11,15,0 21,30,40 -fnmadd 0,5,63 26,30,31 -fnmadds 0,5,59 26,30,31 -fnmsub 0,5,63 26,30,30 -fnmsubs 0,5,59 26,30,30 -fres 0,5,59 11,15,0 21,25,0 26,30,24 -frsp 0,5,63 11,15,0 21,30,12 -frsqrte 0,5,63 11,15,0 21,25,0 26,30,26 -fsel 0,5,63 26,30,23 -fsub 0,5,63 21,25,0 26,30,20 -fsubs 0,5,59 21,25,0 26,30,20 -icbi 0,5,31 6,10,0 21,30,982 31,31,0 -isync 0,5,19 6,20,0 21,30,150 31,31,0 -lbz 0,5,34 -lbzu 0,5,35 -lbzux 0,5,31 21,30,119 31,31,0 -lbzx 0,5,31 21,30,87 31,31,0 -lfd 0,5,50 -lfdu 0,5,51 -lfdux 0,5,31 21,30,631 31,31,0 -lfdx 0,5,31 21,30,559 31,31,0 -lfs 0,5,48 -lfsu 0,5,49 -lfsux 0,5,31 21,30,567 31,31,0 -lfsx 0,5,31 21,30,535 31,31,0 -lha 0,5,42 -lhau 0,5,43 -lhaux 0,5,31 21,30,375 31,31,0 -lhax 0,5,31 21,30,343 31,31,0 -lhbrx 0,5,31 21,30,790 31,31,0 -lhz 0,5,40 -lhzu 0,5,41 -lhzux 0,5,31 21,30,311 31,31,0 -lhzx 0,5,31 21,30,279 31,31,0 -lmw 0,5,46 -lswi 0,5,31 21,30,597 31,31,0 -lswx 0,5,31 21,30,533 31,31,0 -lwarx 0,5,31 21,30,20 31,31,0 -lwbrx 0,5,31 21,30,534 31,31,0 -lwz 0,5,32 -lwzu 0,5,33 -lwzux 0,5,31 21,30,55 31,31,0 -lwzx 0,5,31 21,30,23 31,31,0 -mcrf 0,5,19 10,11,0 20,31,0 -mcrfs 0,5,63 10,11,0 16,24,0 25,30,64 31,31,0 -mcrxr 0,5,31 10,11,0 16,24,0 25,30,512 31,31,0 -mfcr 0,5,31 11,20,0 21,30,19 31,31,0 -mffs 0,5,31 11,20,0 21,30,583 -mfmsr 0,5,31 11,20,0 21,30,83 31,31,0 -mfspr 0,5,31 21,30,339 31,31,0 -mfsr 0,5,31 11,11,0 16,20,0 21,30,595 31,31,0 -mfsrin 0,5,31 11,15,0 21,30,659 31,31,0 -mftb 0,5,31 21,30,371 31,31,0 -mtcrf 0,5,31 11,11,0 20,20,0 21,30,144 31,31,0 -mtfsb0 0,5,63 11,20,0 21,30,70 -mtfsb1 0,5,63 11,20,0 21,30,38 -mtfsf 0,5,63 6,6,0 15,15,0 21,30,711 -mtfsfi 0,5,63 9,15,0 20,20,0 21,30,134 -mtmsr 0,5,31 11,20,0 21,30,146 31,31,0 -mtspr 0,5,31 21,30,467 31,31,0 -mtsr 0,5,31 11,11,0 16,20,0 21,30,210 31,31,0 -mtsrin 0,5,31 11,15,0 21,30,242 31,31,0 -mulhw 0,5,31 21,21,0 22,30,75 -mulhwu 0,5,31 21,21,0 22,30,11 -mulli 0,5,7 -mullw 0,5,31 22,30,235 -nand 0,5,31 21,30,476 -neg 0,5,31 16,20,0 21,30,104 -nor 0,5,31 21,30,124 -or 0,5,31 21,30,444 -orc 0,5,31 21,30,412 -ori 0,5,24 -oris 0,5,25 -psq_l 0,5,56 -psq_lu 0,5,57 -psq_lux 0,5,4 25,30,38 31,31,0 -psq_lx 0,5,4 25,30,6 31,31,0 -psq_st 0,5,60 -psq_stu 0,5,61 -psq_stux 0,5,4 25,30,39 31,31,0 -psq_stx 0,5,4 25,30,7 31,31,0 -ps_abs 0,5,4 11,15,0 21,30,264 -ps_add 0,5,4 21,25,0 26,30,21 -ps_cmpo0 0,5,4 9,10,0 21,30,32 31,31,0 -ps_cmpo1 0,5,4 9,10,0 21,30,96 31,31,0 -ps_cmpu0 0,5,4 9,10,0 21,30,0 31,31,0 -ps_cmpu1 0,5,4 9,10,0 21,30,64 31,31,0 -ps_div 0,5,4 21,25,0 26,30,18 -ps_madd 0,5,4 26,30,29 -ps_madds0 0,5,4 26,30,14 -ps_madds1 0,5,4 26,30,15 -ps_merge00 0,5,4 21,30,528 -ps_merge01 0,5,4 21,30,560 -ps_merge10 0,5,4 21,30,592 -ps_merge11 0,5,4 21,30,624 -ps_mr 0,5,4 11,15,0 21,30,72 -ps_msub 0,5,4 26,30,28 -ps_mul 0,5,4 16,20,0 26,30,25 -ps_muls0 0,5,4 16,20,0 26,30,12 -ps_muls1 0,5,4 16,20,0 26,30,13 -ps_nabs 0,5,4 11,15,0 21,30,136 -ps_neg 0,5,4 11,15,0 21,30,40 -ps_nmadd 0,5,4 26,30,31 -ps_nmsub 0,5,4 26,30,30 -ps_res 0,5,4 11,15,0 21,25,0 26,30,24 -ps_rsqrte 0,5,4 11,15,0 21,25,0 26,30,26 -ps_sel 0,5,4 26,30,23 -ps_sub 0,5,4 21,25,0 26,30,20 -ps_sum0 0,5,4 26,30,10 -ps_sum1 0,5,4 26,30,11 -rfi 0,5,19 6,20,0 31,31,0 -rlwimi 0,5,20 -rlwinm 0,5,21 -rlwnm 0,5,23 -sc 0,5,17 6,29,0 30,30,1 31,31,0 -slw 0,5,31 21,30,24 -sraw 0,5,31 21,30,792 -srawi 0,5,31 21,30,824 -srw 0,5,31 21,30,536 -stb 0,5,38 -stbu 0,5,39 -stbux 0,5,31 22,30,247 31,31,0 -stbx 0,5,31 22,30,215 31,31,0 -stfd 0,5,54 -stfdu 0,5,55 -stfdux 0,5,31 21,30,759 31,31,0 -stfdx 0,5,31 21,30,727 31,31,0 -stfiwx 0,5,31 21,30,983 31,31,0 -stfs 0,5,52 -stfsu 0,5,53 -stfsux 0,5,31 21,30,695 31,31,0 -stfsx 0,5,31 21,30,663 31,31,0 -sth 0,5,44 -sthbrx 0,5,31 21,30,918 31,31,0 -sthu 0,5,45 -sthux 0,5,31 21,30,439 31,31,0 -sthx 0,5,31 21,30,407 31,31,0 -stmw 0,5,47 -stswi 0,5,31 21,30,725 31,31,0 -stswx 0,5,31 21,30,661 31,31,0 -stw 0,5,36 -stwbrx 0,5,31 21,30,662 31,31,0 -stwcx. 0,5,31 21,30,150 31,31,1 -stwu 0,5,37 -stwux 0,5,31 21,30,183 31,31,0 -stwx 0,5,31 21,30,151 31,31,0 -subf 0,5,31 22,30,40 -subfc 0,5,31 22,30,8 -subfe 0,5,31 22,30,136 -subfic 0,5,8 -subfme 0,5,31 16,20,0 22,30,232 -subfze 0,5,31 16,20,0 22,30,200 -sync 0,5,31 6,20,0 21,30,598 31,31,0 -tlbie 0,5,31 6,15,0 21,30,306 31,31,0 -tlbsync 0,5,31 6,20,0 21,30,566 31,31,0 -tw 0,5,31 21,30,4 31,31,0 -twi 0,5,3 -xor 0,5,31 21,30,316 -xori 0,5,26 -xoris 0,5,27 diff --git a/disasm/Cargo.toml b/disasm/Cargo.toml index 3a0355b..7ad009f 100644 --- a/disasm/Cargo.toml +++ b/disasm/Cargo.toml @@ -9,6 +9,6 @@ keywords = ["powerpc", "wii", "gamecube"] repository = "https://github.com/terorie/ppc750cl" [dependencies] -num-traits = "0.2.14" +num-traits = "0.2" ppc750cl-macros = { path = "../macros", version = "0.1.1" } -serde = "1.0.129" +serde = "1.0" diff --git a/disasm/src/lib.rs b/disasm/src/lib.rs index 361ad5d..ac3cc62 100644 --- a/disasm/src/lib.rs +++ b/disasm/src/lib.rs @@ -1,6 +1,11 @@ //pub mod formatter; mod iter; -pub mod prelude; + +pub mod prelude { + pub use crate::Field::*; + pub use crate::Ins; + pub use crate::Opcode::*; +} use ppc750cl_macros::{fields, ins_impl, opcodes}; diff --git a/disasm/src/prelude.rs b/disasm/src/prelude.rs deleted file mode 100644 index b932b49..0000000 --- a/disasm/src/prelude.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub use crate::Field::*; -pub use crate::Ins; -pub use crate::Opcode::*;