Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve conflicts between PR #152 and branch master #211

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
13edff8
Add L1 Instruction Cache
Feb 8, 2024
431e74e
Connect up ICache to Fetch
Feb 11, 2024
b09fd6c
Fix rename and issue tests accounting for icache latency
Feb 12, 2024
4dee506
Fix LSU test accounting for extra ICache latency
Feb 12, 2024
9c77264
Fix L2Cache tests. Change L2+MSS to use credit instead of ack
Feb 12, 2024
7fd5471
Add fetch block size, and buffer size parameters to Fetch
Feb 16, 2024
58a9f4c
Merge branch 'master' into danbone/issue_143_icache
danbone Feb 16, 2024
063a6f3
Merge remote-tracking branch 'upstream/master' into danbone/issue_143…
Feb 20, 2024
50acbb1
update dcache comments on L2Cache credits
Feb 26, 2024
b020c81
Merge branch 'danbone/issue_143_icache' of https://github.com/danbone…
Feb 26, 2024
9b46b07
Resolve conflicts between branch 'master' and 'danbone/issue_143_icac…
dragon540 Sep 26, 2024
b5955c9
Merge branch 'shobhit/issue_143_icache' of github.com:dragon540/riscv…
dragon540 Sep 26, 2024
7e225d1
Removed extra files
dragon540 Oct 1, 2024
abd5f23
Fusing instructions only when enough instructions are sent from fetch
dragon540 Oct 15, 2024
1a56ca9
Replaced condition using hardcoded value with condition using attribu…
dragon540 Oct 18, 2024
caddbf3
Merge branch 'master' into shobhit/issue_143_icache
dragon540 Oct 19, 2024
515e160
updated EXPECTED files and ../core/Inst.hpp for whitespace between pi…
dragon540 Oct 19, 2024
e73e93a
Remove generated log files
dragon540 Oct 21, 2024
f0b0f05
Revert stflib to be consistent with upstream branch
dragon540 Oct 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ add_library(core
FusionDecode.cpp
Core.cpp
SimpleBranchPred.cpp
ICache.cpp
Fetch.cpp
Decode.cpp
VectorUopGenerator.cpp
Expand Down
9 changes: 7 additions & 2 deletions core/CPUFactories.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "sparta/simulation/ResourceFactory.hpp"
#include "Core.hpp"
#include "ICache.hpp"
#include "Fetch.hpp"
#include "Decode.hpp"
#include "VectorUopGenerator.hpp"
Expand Down Expand Up @@ -40,6 +41,10 @@ namespace olympia{
sparta::ResourceFactory<olympia::Core,
olympia::Core::CoreParameterSet> core_rf;

//! \brief Resource Factory to build an Instruction Cache Unit
sparta::ResourceFactory<olympia::ICache,
olympia::ICache::ICacheParameterSet> icache_rf;

//! \brief Resource Factory to build a Fetch Unit
sparta::ResourceFactory<olympia::Fetch,
olympia::Fetch::FetchParameterSet> fetch_rf;
Expand All @@ -61,7 +66,7 @@ namespace olympia{
//! \brief Resource Factory to build a Execute Unit
ExecuteFactory execute_rf;

//! \brief Resource Factory to build a MMU Unit
//! \brief Resource Factory to build a Data Cache Unit
sparta::ResourceFactory<olympia::DCache,
olympia::DCache::CacheParameterSet> dcache_rf;

Expand Down Expand Up @@ -104,7 +109,7 @@ namespace olympia{
// //! \brief Resource Factory to build a IssueQueue Unit
// sparta::ResourceFactory<olympia::IssueQueue,
// olympia::IssueQueue::IssueQueueParameterSet> issue_queue_rf;

//! \brief Set up the Mavis Decode functional unit
MavisFactory mavis_rf;
}; // struct CPUFactories
Expand Down
40 changes: 36 additions & 4 deletions core/CPUTopology.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ olympia::CoreTopologySimple::CoreTopologySimple(){
sparta::TreeNode::GROUP_IDX_NONE,
&factories->flushmanager_rf
},
{
"icache",
"cpu.core*",
"Instruction Cache Unit",
sparta::TreeNode::GROUP_NAME_NONE,
sparta::TreeNode::GROUP_IDX_NONE,
&factories->icache_rf
},
{
"fetch",
"cpu.core*",
Expand Down Expand Up @@ -160,6 +168,18 @@ olympia::CoreTopologySimple::CoreTopologySimple(){

//! Instantiating ports of this topology
port_connections = {
{
"cpu.core*.fetch.ports.out_fetch_icache_req",
"cpu.core*.icache.ports.in_fetch_req"
},
{
"cpu.core*.fetch.ports.in_icache_fetch_resp",
"cpu.core*.icache.ports.out_fetch_resp"
},
{
"cpu.core*.fetch.ports.in_icache_fetch_credits",
"cpu.core*.icache.ports.out_fetch_credit"
},
{
"cpu.core*.fetch.ports.out_fetch_queue_write",
"cpu.core*.decode.ports.in_fetch_queue_write"
Expand Down Expand Up @@ -221,20 +241,32 @@ olympia::CoreTopologySimple::CoreTopologySimple(){
"cpu.core*.l2cache.ports.in_dcache_l2cache_req"
},
{
"cpu.core*.dcache.ports.in_l2cache_ack",
"cpu.core*.l2cache.ports.out_l2cache_dcache_ack"
"cpu.core*.dcache.ports.in_l2cache_credits",
"cpu.core*.l2cache.ports.out_l2cache_dcache_credits"
},
{
"cpu.core*.dcache.ports.in_l2cache_resp",
"cpu.core*.l2cache.ports.out_l2cache_dcache_resp"
},
{
"cpu.core*.icache.ports.out_l2cache_req",
"cpu.core*.l2cache.ports.in_icache_l2cache_req"
},
{
"cpu.core*.icache.ports.in_l2cache_credits",
"cpu.core*.l2cache.ports.out_l2cache_icache_credits"
},
{
"cpu.core*.icache.ports.in_l2cache_resp",
"cpu.core*.l2cache.ports.out_l2cache_icache_resp"
},
{
"cpu.core*.l2cache.ports.out_l2cache_biu_req",
"cpu.core*.biu.ports.in_biu_req"
},
{
"cpu.core*.biu.ports.out_biu_ack",
"cpu.core*.l2cache.ports.in_biu_l2cache_ack"
"cpu.core*.biu.ports.out_biu_credits",
"cpu.core*.l2cache.ports.in_biu_l2cache_credits"
},
{
"cpu.core*.biu.ports.out_biu_resp",
Expand Down
14 changes: 4 additions & 10 deletions core/DCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ namespace olympia
in_l2cache_resp_.registerConsumerHandler(
CREATE_SPARTA_HANDLER_WITH_DATA(DCache, receiveRespFromL2Cache_, MemoryAccessInfoPtr));

in_l2cache_ack_.registerConsumerHandler(
CREATE_SPARTA_HANDLER_WITH_DATA(DCache, receiveAckFromL2Cache_, uint32_t));
in_l2cache_credits_.registerConsumerHandler(
CREATE_SPARTA_HANDLER_WITH_DATA(DCache, getCreditsFromL2Cache_, uint32_t));

in_lsu_lookup_req_.registerConsumerEvent(in_l2_cache_resp_receive_event_);
in_l2cache_resp_.registerConsumerEvent(in_l2_cache_resp_receive_event_);
Expand Down Expand Up @@ -291,14 +291,8 @@ namespace olympia
in_l2_cache_resp_receive_event_.schedule();
}

void DCache::receiveAckFromL2Cache_(const uint32_t & ack)
{
// When DCache sends the request to L2Cache for a miss,
// This bool will be set to false, and Dcache should wait for ack from
// L2Cache notifying DCache that there is space in it's dcache request buffer
//
// Set it to true so that the following misses from DCache can be sent out to L2Cache.
dcache_l2cache_credits_ = ack;
void DCache::getCreditsFromL2Cache_(const uint32_t &ack) {
dcache_l2cache_credits_ += ack;
}

// MSHR Entry allocation in case of miss
Expand Down
21 changes: 14 additions & 7 deletions core/DCache.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include "sparta/simulation/Unit.hpp"
#include "sparta/ports/DataPort.hpp"
#include "sparta/ports/SignalPort.hpp"
#include "sparta/resources/Pipeline.hpp"
Expand Down Expand Up @@ -34,6 +35,16 @@ namespace olympia
DCache(sparta::TreeNode* n, const CacheParameterSet* p);

private:
bool dataLookup_(const MemoryAccessInfoPtr & mem_access_info_ptr);

void reloadCache_(uint64_t phy_addr);

void getInstsFromLSU_(const MemoryAccessInfoPtr & memory_access_info_ptr);

void getCreditsFromL2Cache_(const uint32_t &);

void getRespFromL2Cache_(const MemoryAccessInfoPtr & memory_access_info_ptr);

////////////////////////////////////////////////////////////////////////////////
// L1 Data Cache Handling
////////////////////////////////////////////////////////////////////////////////
Expand All @@ -49,10 +60,6 @@ namespace olympia

void setupL1Cache_(const CacheParameterSet* p);

bool dataLookup_(const MemoryAccessInfoPtr & mem_access_info_ptr);

void reloadCache_(uint64_t phy_addr);

uint64_t getBlockAddr(const MemoryAccessInfoPtr & mem_access_info_ptr) const;

using MSHREntryInfoPtr = sparta::SpartaSharedPointer<MSHREntryInfo>;
Expand Down Expand Up @@ -99,10 +106,10 @@ namespace olympia
sparta::DataInPort<MemoryAccessInfoPtr> in_lsu_lookup_req_{&unit_port_set_,
"in_lsu_lookup_req", 0};

sparta::DataInPort<uint32_t> in_l2cache_ack_{&unit_port_set_, "in_l2cache_ack", 1};
sparta::DataInPort<uint32_t> in_l2cache_credits_{&unit_port_set_, "in_l2cache_credits", 1};

sparta::DataInPort<MemoryAccessInfoPtr> in_l2cache_resp_{&unit_port_set_, "in_l2cache_resp",
1};
sparta::DataInPort<MemoryAccessInfoPtr> in_l2cache_resp_{&unit_port_set_,
"in_l2cache_resp", 1};

////////////////////////////////////////////////////////////////////////////////
// Output Ports
Expand Down
Loading
Loading