Skip to content

Commit 0a65971

Browse files
authored
Upstream sg13g2 changes (#47)
* reduced cache ports to 1RW * porting * async reset * update * update * back to default config * explicity set non-reset regs to undefined * back to sync reset * remove sg13g2 specific code * comment for easily switching between sync/async reset * update model headers * Split CacheLineManager from LSU * no competitive CT reads * basic prefetch infrastructure * prefetch improvements * prefetch fixes * reduce shift register size * per-cacheline replacement idx counter
1 parent f9d8151 commit 0a65971

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+4109
-1667
lines changed

Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ SRC_FILES = \
6565
src/IFetchPipeline.sv \
6666
src/CSR.sv \
6767
src/TrapHandler.sv \
68-
src/CacheInterface.sv \
69-
src/MemoryInterface.sv \
7068
src/Peripherals.sv \
7169
src/PageWalker.sv \
7270
src/LoadSelector.sv \
@@ -92,6 +90,15 @@ SRC_FILES = \
9290
src/ResultFlagsSplit.sv \
9391
src/InstrAligner.sv \
9492
src/RFReadMux.sv \
93+
src/CacheArbiter.sv \
94+
src/MemRTL1RW.sv \
95+
src/ExternalBus.sv \
96+
src/ExternalBusMem.sv \
97+
src/CacheLineManager.sv \
98+
src/DataPrefetch.sv \
99+
src/PrefetchPatternDetector.sv \
100+
src/PrefetchIssuer.sv \
101+
src/PrefetchExecutor.sv \
95102
hardfloat/addRecFN.v \
96103
hardfloat/compareRecFN.v \
97104
hardfloat/fNToRecFN.v \

sim/Inst.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ struct Inst
1414
uint32_t memAddr;
1515
uint32_t memData;
1616
uint32_t predTarget;
17-
uint8_t fetchID;
18-
uint8_t sqn;
17+
uint16_t fetchID;
18+
uint16_t sqn;
1919
uint8_t fu;
2020
uint8_t rd;
2121
uint16_t tag;

sim/model_headers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include "VTop_RegFile__W50_S20_N1_NB1.h"
77
#include "VTop_ExternalAXISim.h"
88
#include "VTop_RenameTable__ND5.h"
9-
#include "VTop_MemRTL__W54_N40_WB15.h"
109
#include "VTop_ROB.h"
1110
#include "VTop_Top.h"
1211
#include "VTop_IFetchPipeline.h"
@@ -17,6 +16,7 @@
1716
#include "VTop_IF_Cache.h"
1817
#include "VTop__Dpi.h"
1918
#include "VTop_IF_MMIO.h"
19+
#include "VTop_MemRTL1RW__W54_N40_WB15.h"
2020
#include "VTop_BranchPredictor__N3.h"
2121
#include "VTop_RegFile__NB5_A1.h"
2222
#include "VTop_ReturnStack.h"

sim/models/BranchHistory.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class BranchHistory : public Model
2222
auto core = top->Top->soc->core;
2323
auto bpFile = core->ifetch->bp->bpFile->mem;
2424

25-
BPBackup backup{sc_bv<BPBackup::_size>{(char*)bpFile[fetchID].data()}};
25+
BPBackup backup{sc_bv<BPBackup::_size>{(char*)&bpFile[fetchID]}};
2626

2727
if (backup.pred && backup.isRegularBranch && fetchOffs > backup.predOffs)
2828
return (backup.history << 1) | backup.predTaken;
@@ -34,9 +34,12 @@ class BranchHistory : public Model
3434

3535
bool compare_history (const Inst& i)
3636
{
37-
auto fetchOffset = (((i.pc & 15) >> 1) + (((i.inst & 3) == 3) ? 1 : 0)) & 7;
37+
constexpr uint64_t bhist_mask = BPBackup::history_w == 64 ? (-1) : ((1UL << BPBackup::history_w) - 1);
38+
constexpr uint64_t fetchoffs_mask = (1UL << BPBackup::predOffs_w) - 1;
39+
40+
auto fetchOffset = (((i.pc) >> 1) + (((i.inst & 3) == 3) ? 1 : 0)) & fetchoffs_mask;
3841
auto coreHist = ReadBrHistory(i.fetchID, fetchOffset);
39-
return coreHist == bhist;
42+
return (coreHist & bhist_mask) == (bhist & bhist_mask);
4043
}
4144

4245
std::pair<bool, bool> is_branch_taken (uint32_t instSIM)

0 commit comments

Comments
 (0)