SimX writeback configuration

This commit is contained in:
Blaise Tine 2024-07-27 17:25:13 -07:00
parent 904a6dc136
commit 69126dfd35
5 changed files with 34 additions and 34 deletions

View file

@ -436,7 +436,7 @@ public:
auto port_id = req_id % config_.ports_per_bank;
// check MSHR capacity
if ((!core_req.write || !config_.write_through)
if ((!core_req.write || config_.write_back)
&& bank.mshr.full()) {
++perf_stats_.mshr_stalls;
continue;
@ -572,7 +572,7 @@ private:
if (pipeline_req.write) {
// handle write has_hit
auto& hit_line = set.lines.at(hit_line_id);
if (config_.write_through) {
if (!config_.write_back) {
// forward write request to memory
MemReq mem_req;
mem_req.addr = params_.mem_addr(bank_id, pipeline_req.set_id, pipeline_req.tag);
@ -603,7 +603,7 @@ private:
else
++perf_stats_.read_misses;
if (free_line_id == -1 && !config_.write_through) {
if (free_line_id == -1 && config_.write_back) {
// write back dirty line
auto& repl_line = set.lines.at(repl_line_id);
if (repl_line.dirty) {
@ -617,7 +617,7 @@ private:
}
}
if (pipeline_req.write && config_.write_through) {
if (pipeline_req.write && !config_.write_back) {
// forward write request to memory
{
MemReq mem_req;

View file

@ -1,10 +1,10 @@
// Copyright © 2019-2023
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -30,12 +30,12 @@ public:
uint8_t addr_width; // word address bits
uint8_t ports_per_bank; // number of ports per bank
uint8_t num_inputs; // number of inputs
bool write_through; // is write-through
bool write_back; // is write-back
bool write_reponse; // enable write response
uint16_t mshr_size; // MSHR buffer size
uint8_t latency; // pipeline latency
};
struct PerfStats {
uint64_t reads;
uint64_t writes;
@ -47,7 +47,7 @@ public:
uint64_t mshr_stalls;
uint64_t mem_latency;
PerfStats()
PerfStats()
: reads(0)
, writes(0)
, read_misses(0)
@ -82,11 +82,11 @@ public:
~CacheSim();
void reset();
void tick();
const PerfStats& perf_stats() const;
private:
class Impl;
Impl* impl_;

View file

@ -1,10 +1,10 @@
// Copyright © 2019-2023
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -15,11 +15,11 @@
using namespace vortex;
Cluster::Cluster(const SimContext& ctx,
Cluster::Cluster(const SimContext& ctx,
uint32_t cluster_id,
ProcessorImpl* processor,
const Arch &arch,
const DCRS &dcrs)
ProcessorImpl* processor,
const Arch &arch,
const DCRS &dcrs)
: SimObject(ctx, "cluster")
, mem_req_port(this)
, mem_rsp_port(this)
@ -43,9 +43,9 @@ Cluster::Cluster(const SimContext& ctx,
for (uint32_t i = 0; i < sockets_per_cluster; ++i) {
uint32_t socket_id = cluster_id * sockets_per_cluster + i;
auto socket = Socket::Create(socket_id,
this,
arch,
auto socket = Socket::Create(socket_id,
this,
arch,
dcrs);
socket->icache_mem_req_port.bind(&icache_switch->ReqIn.at(i));
@ -58,7 +58,7 @@ Cluster::Cluster(const SimContext& ctx,
}
// Create l2cache
snprintf(sname, 100, "cluster%d-l2cache", cluster_id);
l2cache_ = CacheSim::Create(sname, CacheSim::Config{
!L2_ENABLED,
@ -67,10 +67,10 @@ Cluster::Cluster(const SimContext& ctx,
log2ceil(L1_LINE_SIZE), // W
log2ceil(L2_NUM_WAYS), // A
log2ceil(L2_NUM_BANKS), // B
XLEN, // address bits
XLEN, // address bits
1, // number of ports
2, // request size
true, // write-through
2, // request size
L2_WRITEBACK, // write-back
false, // write response
L2_MSHR_SIZE, // mshr size
2, // pipeline latency
@ -90,7 +90,7 @@ Cluster::~Cluster() {
//--
}
void Cluster::reset() {
void Cluster::reset() {
for (auto& barrier : barriers_) {
barrier.reset();
}

View file

@ -39,7 +39,7 @@ ProcessorImpl::ProcessorImpl(const Arch& arch)
XLEN, // address bits
1, // number of ports
uint8_t(arch.num_clusters()), // request size
true, // write-through
L3_WRITEBACK, // write-back
false, // write response
L3_MSHR_SIZE, // mshr size
2, // pipeline latency

View file

@ -1,10 +1,10 @@
// Copyright © 2019-2023
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -16,11 +16,11 @@
using namespace vortex;
Socket::Socket(const SimContext& ctx,
Socket::Socket(const SimContext& ctx,
uint32_t socket_id,
Cluster* cluster,
const Arch &arch,
const DCRS &dcrs)
Cluster* cluster,
const Arch &arch,
const DCRS &dcrs)
: SimObject(ctx, "socket")
, icache_mem_req_port(this)
, icache_mem_rsp_port(this)
@ -44,7 +44,7 @@ Socket::Socket(const SimContext& ctx,
XLEN, // address bits
1, // number of ports
1, // number of inputs
false, // write-through
false, // write-back
false, // write response
(uint8_t)arch.num_warps(), // mshr size
2, // pipeline latency
@ -64,7 +64,7 @@ Socket::Socket(const SimContext& ctx,
XLEN, // address bits
1, // number of ports
DCACHE_NUM_REQS, // number of inputs
true, // write-through
DCACHE_WRITEBACK, // write-back
false, // write response
DCACHE_MSHR_SIZE, // mshr size
2, // pipeline latency