When I was designing the instruction struct, I needed to figure out how
an instruction knows which argument position is a variable and a
constant. So the variable type is baked into the struct.
I also added a variable array for obvious reasons.
Signed-off-by: Ronald Caesar <github43132@proton.me>
The decoder API is now suitable to be made public. decoder.h is the sole
entry point for the decoder and it has been moved to `include/`
Signed-off-by: Ronald Caesar <github43132@proton.me>
Assign indices in generate_a64_table.py at the very end, right before
generation. This is much safer than maintaining a running counter during
parsing.
Signed-off-by: Ronald Caesar <github43132@proton.me>
Switch to hashing bits [32:21] instead of bits [27:20] and [7:4]. This
massively reduces the average amount of instructions in a bucket.
Signed-off-by: Ronald Caesar <github43132@proton.me>
512 instructions are being declared in every bucket.
Size per bucket:
512 x 8 bytes (ptr) = 4096 bytes
Total Table Size:
4096 buckets x 4096 bytes ≈ 16.7 MB
This will destroy the CPU cache performance.
To fix this we generate small seperate arrays for each bucket that
actually has content and point to them.
Signed-off-by: Ronald Caesar <github43132@proton.me>
generate_a64_table.py only generated instruction variants. For
example, the instruction ADD has forms. The default form with bit 31
set to 0, and its variant with bit 31 set to 1. The script ignored the
default form and added the varient.
Signed-off-by: Ronald Caesar <github43132@proton.me>
This program takes a 32-bit hexidecimal representing an ARM instruction
and prints its corresponding mnemonic. This program will be used in
tandem with a python fuzzing script to verify the decoder table
generated by tools/generate_a64_table.py.
Signed-off-by: Ronald Caesar <github43132@proton.me>
Apperantly -Wall does exactly what it says it does on Windows and enables
every single warning. This is why the build fails on Windows and not on
Linux or MacOS.
Signed-off-by: Ronald Caesar <github43132@proton.me>
This is just to test if the decoder even works. Ii will implement a
fuzzer to test the decoder against 10,000 randomly generated
instructions.
Signed-off-by: Ronald Caesar <github43132@proton.me>
- Added default values for input/output directories
- Improve error handling for missing cli arguments
Signed-off-by: Ronald Caesar <github43132@proton.me>
Adds a python script, tools/generate_a64_table.py, to parse ARM's
machine readable XML. The script generates a static C lookup table
containing instruction mnemonics, masks, and values.
Signed-off-by: Ronald Caesar <github43132@proton.me>