diff options
author | bd <bdunahu@operationnull.com> | 2025-03-28 18:10:14 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-03-28 18:10:14 -0400 |
commit | 9cd1f287f0c86b36788cd8ede812b847c584f711 (patch) | |
tree | 749bb48cd49f1e9e4fb7ca3dfa7001c27403231e /inc/utils.h | |
parent | 043c2566c112f0d913c52aa80c9fcc4da5fb11ae (diff) |
add get_instr_fields func to parse instruction fields from raw bits
Diffstat (limited to 'inc/utils.h')
-rw-r--r-- | inc/utils.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/inc/utils.h b/inc/utils.h index df8d374..7fed157 100644 --- a/inc/utils.h +++ b/inc/utils.h @@ -10,7 +10,25 @@ * @param the resulting index * @param the resulting offset */ -void get_bit_fields(int address, int *tag, int *index, int *offset); +void get_cache_fields(int address, int *tag, int *index, int *offset); + +/** + * Parse an instruction into a type, opcode, and fields. If the type is invalid, + * only the type field will be set. + * @param the resulting first field, which varies per type. To call this + * function properly, this field must contain the full instruction bytes on + * function entry. + * @param the resulting second field, which varies per type. + * @param the resulting third field, which varies per type. + * @param the resulting type. + * @param the resulting opcode. + */ +void get_instr_fields( + signed int &s1, + signed int &s2, + signed int &s3, + unsigned int &type, + unsigned int &opcode); /** * Formats a string using snprintf. |