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

Add L1 Instruction Cache #152

Closed
1 change: 1 addition & 0 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
project (core)
add_library(core
Core.cpp
ICache.cpp
Fetch.cpp
Decode.cpp
Rename.cpp
Expand Down
10 changes: 7 additions & 3 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 "Rename.hpp"
Expand Down Expand Up @@ -39,6 +40,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 @@ -56,8 +61,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 @@ -100,7 +104,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 @@ -152,6 +160,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 @@ -213,20 +233,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"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the planned documentation, can you please include a list of input and output ports of the Icache and what do they represent. It would be helpful to understand this part of code changes.

},
{
"cpu.core*.biu.ports.out_biu_resp",
Expand Down
8 changes: 4 additions & 4 deletions core/DCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace olympia {
in_lsu_lookup_req_.registerConsumerHandler
(CREATE_SPARTA_HANDLER_WITH_DATA(DCache, getInstsFromLSU_, MemoryAccessInfoPtr));

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

in_l2cache_resp_.registerConsumerHandler
(CREATE_SPARTA_HANDLER_WITH_DATA(DCache, getRespFromL2Cache_, MemoryAccessInfoPtr));
Expand Down Expand Up @@ -99,13 +99,13 @@ namespace olympia {
busy_ = false;
}

void DCache::getAckFromL2Cache_(const uint32_t &ack) {
void DCache::getCreditsFromL2Cache_(const uint32_t &ack) {
danbone marked this conversation as resolved.
Show resolved Hide resolved
// 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;
dcache_l2cache_credits_ += ack;
}

}
4 changes: 2 additions & 2 deletions core/DCache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace olympia

void getInstsFromLSU_(const MemoryAccessInfoPtr & memory_access_info_ptr);

void getAckFromL2Cache_(const uint32_t & ack);
void getCreditsFromL2Cache_(const uint32_t &);

void getRespFromL2Cache_(const MemoryAccessInfoPtr & memory_access_info_ptr);

Expand All @@ -59,7 +59,7 @@ 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};
Expand Down
Loading
Loading