From 136417edd709f0e2d30931d222b658ff7dd9a5a8 Mon Sep 17 00:00:00 2001 From: bd Date: Fri, 28 Mar 2025 18:10:14 -0400 Subject: add get_instr_fields func to parse instruction fields from raw bits --- inc/definitions.h | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'inc/definitions.h') diff --git a/inc/definitions.h b/inc/definitions.h index ff2f7c6..c9367ff 100644 --- a/inc/definitions.h +++ b/inc/definitions.h @@ -11,6 +11,10 @@ * The total number of words in a line */ #define LINE_SIZE static_cast(pow(2, 2)) +/** + * Number of bits in a word + */ +#define WORD_SPEC 32 /** * The number of bits to specify a memory word @@ -28,7 +32,8 @@ * The total number of lines in l1 cache */ #define L1_CACHE_WORD_SPEC 7 -#define L1_CACHE_LINE_SPEC static_cast(L1_CACHE_WORD_SPEC - LINE_SPEC) +#define L1_CACHE_LINE_SPEC \ + static_cast(L1_CACHE_WORD_SPEC - LINE_SPEC) #define L1_CACHE_LINES static_cast(pow(2, L1_CACHE_LINE_SPEC)) /** @@ -46,6 +51,26 @@ */ #define GPR_NUM 16 +/** + * The number of bits to specify an instruction type + */ +#define TYPE_SIZE 2 + +/** + * The number of bits to specify a register + */ +#define REG_SIZE 5 + +/** + * The number of bits to specify an R-Type opcode. + */ +#define R_OPCODE_SIZE 5 + +/** + * The number of bits to specify an opcode. + */ +#define OPCODE_SIZE 4 + /** * Return the N least-significant bits from integer K using a bit mask * @param the integer to be parsed -- cgit v1.2.3 From b29311f0140c615c005f5d076adc921d98842ec6 Mon Sep 17 00:00:00 2001 From: bd Date: Sat, 29 Mar 2025 02:36:38 -0400 Subject: get_instr_fields return mnemonic rather than opcode and type --- inc/definitions.h | 5 +++++ src/cli/cli.cc | 3 +++ 2 files changed, 8 insertions(+) (limited to 'inc/definitions.h') diff --git a/inc/definitions.h b/inc/definitions.h index c9367ff..3238a8b 100644 --- a/inc/definitions.h +++ b/inc/definitions.h @@ -51,6 +51,11 @@ */ #define GPR_NUM 16 +/** + * The number of vector registers + */ +#define V_NUM 8 + /** * The number of bits to specify an instruction type */ diff --git a/src/cli/cli.cc b/src/cli/cli.cc index 022b266..58575cb 100644 --- a/src/cli/cli.cc +++ b/src/cli/cli.cc @@ -3,6 +3,7 @@ #include "definitions.h" #include "dram.h" #include "response.h" +#include "accessor.h" #include "utils.h" #include @@ -43,6 +44,7 @@ Cli::Cli() }; commands['r'] = [this](std::vector args) { + (void)args; reset(); return; }; @@ -61,6 +63,7 @@ Cli::Cli() }; commands['h'] = [this](std::vector args) { + (void)args; help(); return; }; -- cgit v1.2.3