diff options
author | Siddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com> | 2025-04-17 10:50:58 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-17 10:50:58 -0400 |
commit | 62b9e280d5d0222710e491dcd28fe26bea915dcd (patch) | |
tree | e1f68ac7a6e4dc481c19346e38ad20d113f13825 /inc | |
parent | b778ccc3e7c2f2ac3c4892a87f5269f342fd895f (diff) | |
parent | 430986b4b1ee1013db070991ce289176f48fa8e8 (diff) |
Merge pull request #52 from bdunahu/bdunahu
[WIP] Partial fixes for changes in DRAM/Cache, including uncovered bug
Diffstat (limited to 'inc')
-rw-r--r-- | inc/id.h | 4 | ||||
-rw-r--r-- | inc/instrDTO.h | 29 | ||||
-rw-r--r-- | inc/pipe_spec.h | 17 |
3 files changed, 33 insertions, 17 deletions
@@ -41,7 +41,6 @@ class ID : public Stage std::vector<int> stage_info() override; private: - void advance_helper() override; /** * Helper for `get_instr_fields` * Attempts to parse and dereference instruction arguments. Uses read and @@ -52,6 +51,7 @@ class ID : public Stage * @param the resulting second field. * @param the resulting third field. */ + void advance_helper() override; /** * Parse an instruction into a type, opcode, and fields. If the type is * invalid, only the type field will be set. @@ -67,7 +67,7 @@ class ID : public Stage * @param the resulting mnemonic. */ void get_instr_fields(signed int &s1, signed int &s2, signed int &s3, Mnemonic &m, Type &t); - void decode_R_type(signed int &s1, signed int &s2, signed int &s3); + void decode_R_type(signed int &s1, signed int &s2, signed int &s3, Mnemonic &m); void decode_I_type(signed int &s1, signed int &s2, signed int &s3, Mnemonic &m); void decode_J_type(signed int &s1, signed int &s2, signed int &s3); /** diff --git a/inc/instrDTO.h b/inc/instrDTO.h index b6dec06..755ab9f 100644 --- a/inc/instrDTO.h +++ b/inc/instrDTO.h @@ -15,19 +15,16 @@ class InstrDTO InstrDTO(); ~InstrDTO() = default; - /** - * @return hist entry for Accessor - */ - int get_time_of(Accessor); - /** - * @return id_cycle - */ int get_id_cycle(); /** * @return instr_bits */ signed int get_instr_bits(); /** + * @return checked_out + */ + signed int get_checked_out(); + /** * @return s1 */ signed int get_s1(); @@ -53,14 +50,14 @@ class InstrDTO unsigned int get_pc(); /** - * @param set hist key - */ - void set_time_of(Accessor, int); - /** * @param instr_bits */ void set_instr_bits(signed int); /** + * @param checked_out + */ + void set_checked_out(signed int); + /** * @param s1 */ void set_s1(signed int); @@ -88,14 +85,16 @@ class InstrDTO private: /** - * The clock cycle each stage finished an operation. - */ - std::unordered_map<Accessor, int> hist; - /** * The raw bits encoding the instruction. */ signed int instr_bits; /** + * The register, if any, this instruction has checked out. A checked out + * register cannot be checked out by another register. This prevents RAW + * conflicts. + */ + signed int checked_out; + /** * Slots in this instruction, for storing temporary registers, immediates, * or other. * Some instruction types may use these differently. diff --git a/inc/pipe_spec.h b/inc/pipe_spec.h index 772314e..d211b72 100644 --- a/inc/pipe_spec.h +++ b/inc/pipe_spec.h @@ -65,4 +65,21 @@ */ #define GET_MID_BITS(k, m, n) GET_LS_BITS((k) >> (m), ((n) - (m))) +/** + * Return the bits from integer K starting at N and ending at M using a bit + * mask, but sign-extends the result. This is required to parse immediates. + * @param the integer to be parsed + * @param the index of the starting bit to be parsed + * @param the index of the ending bit to be parsed + * @return a section of bits from K + */ +// clang-format off +#define GET_BITS_SIGN_EXTEND(k, m, n) \ + ({\ + int _f = GET_MID_BITS(k, m, n); \ + int _w = (n) - (m) - (1); \ + _f = (_f & (1 << (_w - 1))) ? (_f | (-1 << _w)) : _f; \ + }) +// clang-format on + #endif /* DEFINITIONS_H_INCLUDED */ |