From ebeb29d1b87c533c1e80e86ceed9ddc40e4d2cb2 Mon Sep 17 00:00:00 2001 From: bd Date: Sun, 30 Mar 2025 19:42:34 -0400 Subject: Add tests for EX --- inc/id.h | 32 ++++++++++++++++---------------- inc/stage.h | 15 ++++++++++----- 2 files changed, 26 insertions(+), 21 deletions(-) (limited to 'inc') diff --git a/inc/id.h b/inc/id.h index 9911440..3ff5063 100644 --- a/inc/id.h +++ b/inc/id.h @@ -20,22 +20,6 @@ class ID : public Stage * not to be called from outside classes during standard execution. */ - /** - * Parse an instruction into a type, opcode, and fields. If the type is - * invalid, only the type field will be set. - * - * This method is marked public so it may be tested, and is not used outside - * of this class during normal execution. - * - * @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 mnemonic. - */ - void get_instr_fields( - signed int &s1, signed int &s2, signed int &s3, Mnemonic &m); /** * Facilitates register checkout and data hazard management. * It does this by checking that the register passed in is not currently @@ -66,6 +50,22 @@ class ID : public Stage * @param the resulting second field. * @param the resulting third field. */ + /** + * Parse an instruction into a type, opcode, and fields. If the type is + * invalid, only the type field will be set. + * + * This method is marked public so it may be tested, and is not used outside + * of this class during normal execution. + * + * @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 mnemonic. + */ + void get_instr_fields( + signed int &s1, signed int &s2, signed int &s3, Mnemonic &m); void decode_R_type(signed int &s1, signed int &s2, signed int &s3); void decode_I_type(signed int &s1, signed int &s2, signed int &s3); void decode_J_type(signed int &s1, signed int &s2); diff --git a/inc/stage.h b/inc/stage.h index 56a3589..d1b6ee1 100644 --- a/inc/stage.h +++ b/inc/stage.h @@ -40,6 +40,16 @@ class Stage */ virtual InstrDTO *advance(Response p); + /* The following methods are made public so that they may be tested, and are + * not to be called from outside classes during standard execution. + */ + + /** + * Gets the bit in the condition code register correspondng to `c`. + * @param the condition code to retrieve, + */ + bool get_condition(CC c); + protected: /** * The function expected to do the majority of the work. @@ -53,11 +63,6 @@ class Stage * @param the truthy value to set it to. */ void set_condition(CC c, bool v); - /** - * Gets the bit in the condition code register correspondng to `c`. - * @param the condition code to retrieve, - */ - bool get_condition(CC c); /** * Helper for `check_out`. * Returns true if r are not checked out, false otherwise. -- cgit v1.2.3