Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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 configs/user.tltest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# core
# core.tl_c
# core.tl_ul
core.way = 4
maximum_cycle = 0
memory.enable = 1
memory.start = 0x00000000
Expand Down
2 changes: 1 addition & 1 deletion dut/OpenLLC
1 change: 1 addition & 0 deletions main/Base/TLLocal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ struct TLLocalConfig {
unsigned int coreCount; // L1-L2 system count
unsigned int masterCountPerCoreTLC; // TL-C master count per core
unsigned int masterCountPerCoreTLUL; // TL-UL master count per core
unsigned int masterCountWay; // L2 way count

std::unordered_map<int, TLSequenceMode> sequenceModes; // Agent sequence modes

Expand Down
10 changes: 10 additions & 0 deletions main/DPI/coupledL2_dpi.svh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ import "DPI-C" function void TileLinkPullChannelA (
output byte user_needHint,
output longint user_vaddr,
output byte user_alias,
output byte user_way,
output int mask,
output longint data0,
output longint data1,
Expand All @@ -107,6 +108,7 @@ function void SvTileLinkPullChannelA (
output logic user_needHint,
output logic [35:0] user_vaddr,
output logic [1:0] user_alias,
output logic [3:0] user_way,
output logic [31:0] mask,
output logic [255:0] data,
output logic corrupt
Expand All @@ -125,6 +127,7 @@ function void SvTileLinkPullChannelA (
user_needHint,
user_vaddr,
user_alias,
user_way,
mask,
data[63:0],
data[127:64],
Expand Down Expand Up @@ -268,6 +271,7 @@ import "DPI-C" function void TileLinkPullChannelC (
output byte user_needHint,
output longint user_vaddr,
output byte user_alias,
output byte user_way,
output longint data0,
output longint data1,
output longint data2,
Expand All @@ -287,6 +291,7 @@ function void SvTileLinkPullChannelC (
output logic user_needHint,
output logic [35:0] user_vaddr,
output logic [1:0] user_alias,
output logic [3:0] user_way,
output logic [255:0] data,
output logic corrupt
);
Expand All @@ -304,6 +309,7 @@ function void SvTileLinkPullChannelC (
user_needHint,
user_vaddr,
user_alias,
user_way,
data[63:0],
data[127:64],
data[191:128],
Expand All @@ -327,6 +333,7 @@ import "DPI-C" function void TileLinkPushChannelD (
input byte size,
input longint source,
input longint sink,
input byte user_way,
input byte denied,
input longint data0,
input longint data1,
Expand All @@ -344,6 +351,7 @@ function void SvTileLinkPushChannelD (
input logic [2:0] size,
input logic [63:0] source,
input logic [63:0] sink,
input logic [3:0] user_way,
input logic denied,
input logic [255:0] data,
input logic corrupt
Expand All @@ -356,6 +364,7 @@ function void SvTileLinkPushChannelD (
guard_size: assert (!resetn || !valid || !$isunknown(size )) else $fatal("TileLinkPushChannelD: 'size' is unknown");
guard_source: assert (!resetn || !valid || !$isunknown(source )) else $fatal("TileLinkPushChannelD: 'source' is unknown");
guard_sink: assert (!resetn || !valid || !$isunknown(sink )) else $fatal("TileLinkPushChannelD: 'sink' is unknown");
// guard_user_way: assert (!resetn || !valid || !$isunknown(user_way )) else $fatal("TileLinkPushChannelD: 'user_way' is unknown");
guard_denied: assert (!resetn || !valid || !$isunknown(denied )) else $fatal("TileLinkPushChannelD: 'denied' is unknown");

/*
Expand Down Expand Up @@ -390,6 +399,7 @@ function void SvTileLinkPushChannelD (
size,
source,
sink,
$isunknown(user_way) ? 'hFF : user_way,
denied,
data[63:0],
data[127:64],
Expand Down
8 changes: 8 additions & 0 deletions main/DPI/tilelink_dpi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ extern "C" void TileLinkPullChannelA(
uint8_t* user_needHint,
uint64_t* user_vaddr,
uint8_t* user_alias,
uint8_t* user_way,
uint32_t* mask,
uint64_t* data0,
uint64_t* data1,
Expand All @@ -153,6 +154,7 @@ extern "C" void TileLinkPullChannelA(
*user_needHint = 0;
*user_vaddr = 0;
*user_alias = 0;
*user_way = 0;
*mask = 0;
*data0 = 0;
*data1 = 0;
Expand All @@ -173,6 +175,7 @@ extern "C" void TileLinkPullChannelA(
*user_needHint = port.a.needHint;
*user_vaddr = port.a.vaddr;
*user_alias = port.a.alias;
*user_way = port.a.way;
*mask = port.a.mask;
*data0 = (uint64_t(port.a.data->data[0]))
| (uint64_t(port.a.data->data[1]) << 8)
Expand Down Expand Up @@ -283,6 +286,7 @@ extern "C" void TileLinkPullChannelC(
uint8_t* user_needHint,
uint64_t* user_vaddr,
uint8_t* user_alias,
uint8_t* user_way,
uint64_t* data0,
uint64_t* data1,
uint64_t* data2,
Expand All @@ -300,6 +304,7 @@ extern "C" void TileLinkPullChannelC(
*user_needHint = 0;
*user_vaddr = 0;
*user_alias = 0;
*user_way = 0;
*data0 = 0;
*data1 = 0;
*data2 = 0;
Expand All @@ -318,6 +323,7 @@ extern "C" void TileLinkPullChannelC(
*user_needHint = port.c.needHint;
*user_vaddr = port.c.vaddr;
*user_alias = 0;
*user_way = port.c.way;
*data0 = (uint64_t(port.c.data->data[0]))
| (uint64_t(port.c.data->data[1]) << 8)
| (uint64_t(port.c.data->data[2]) << 16)
Expand Down Expand Up @@ -366,6 +372,7 @@ extern "C" void TileLinkPushChannelD(
const uint8_t size,
const uint64_t source,
const uint64_t sink,
const uint8_t user_way,
const uint8_t denied,
const uint64_t data0,
const uint64_t data1,
Expand All @@ -383,6 +390,7 @@ extern "C" void TileLinkPushChannelD(
port.d.size = size;
port.d.source = source;
port.d.sink = sink;
port.d.way = user_way;
port.d.denied = denied;
port.d.data->data[0] = data0 & 0xFF;
port.d.data->data[1] = (data0 >> 8) & 0xFF;
Expand Down
3 changes: 3 additions & 0 deletions main/DPI/tilelink_dpi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ extern "C" void TileLinkPullChannelA(
uint8_t* user_needHint,
uint64_t* user_vaddr,
uint8_t* user_alias,
uint8_t* user_way,
uint32_t* mask,
uint64_t* data0,
uint64_t* data1,
Expand Down Expand Up @@ -113,6 +114,7 @@ extern "C" void TileLinkPullChannelC(
uint8_t* user_needHint,
uint64_t* user_vaddr,
uint8_t* user_alias,
uint8_t* user_way,
uint64_t* data0,
uint64_t* data1,
uint64_t* data2,
Expand All @@ -132,6 +134,7 @@ extern "C" void TileLinkPushChannelD(
const uint8_t size,
const uint64_t source,
const uint64_t sink,
const uint8_t user_way,
const uint8_t denied,
const uint64_t data0,
const uint64_t data1,
Expand Down
2 changes: 2 additions & 0 deletions main/PortGen/portgen_static.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ namespace V3::PortGen {
PullMasterPort(i, "c_bits_size" , "c.size");
PullMasterPort(i, "c_bits_source" , "c.source");
PullMasterPort(i, "c_bits_address" , "c.address");
PullMasterPort(i, "c_bits_user_way" , "c.way");
cpp_file.Append(" verilated->", GenerateMasterPortName(i, "c_bits_user_alias"), " = 0;").EndLine();
cpp_file.Append(" std::memcpy(",
"verilated->", GenerateMasterPortName(i, "c_bits_data"), ", ",
Expand Down Expand Up @@ -245,6 +246,7 @@ namespace V3::PortGen {
PushMasterPort(i, "d.source" , "d_bits_source");
PushMasterPort(i, "d.sink" , "d_bits_sink");
PushMasterPort(i, "d.denied" , "d_bits_denied");
PushMasterPort(i, "d.way" , "d_bits_user_way");
cpp_file.Append(" std::memcpy(",
"port->d.data->data, ",
"verilated->", GenerateMasterPortName(i, "d_bits_data"), ", ",
Expand Down
2 changes: 2 additions & 0 deletions main/System/TLSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ void TLInitialize(TLSequencer** tltest, PluginManager** plugins, std::function<v
tlcfg.coreCount = TLTEST_DEFAULT_CORE_COUNT;
tlcfg.masterCountPerCoreTLC = TLTEST_DEFAULT_MASTER_COUNT_PER_CORE_TLC;
tlcfg.masterCountPerCoreTLUL = TLTEST_DEFAULT_MASTER_COUNT_PER_CORE_TLUL;
tlcfg.masterCountWay = TLTEST_DEFAULT_MASTER_COUNT_WAY;

tlcfg.startupCycle = TLTEST_DEFAULT_STARTUP_CYCLE;
tlcfg.maximumCycle = TLTEST_DEFAULT_MAXIMUM_CYCLE;
Expand Down Expand Up @@ -135,6 +136,7 @@ void TLInitialize(TLSequencer** tltest, PluginManager** plugins, std::function<v
INI_OVERRIDE_INT("tltest.config", "core", tlcfg.coreCount);
INI_OVERRIDE_INT("tltest.config", "core.tl_c", tlcfg.masterCountPerCoreTLC);
INI_OVERRIDE_INT("tltest.config", "core.tl_ul", tlcfg.masterCountPerCoreTLUL);
INI_OVERRIDE_INT("tltest.config", "core.way", tlcfg.masterCountWay);

INI_OVERRIDE_INT("tltest.config", "startup.cycle", tlcfg.startupCycle);

Expand Down
3 changes: 3 additions & 0 deletions main/TLAgent/Bundle.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ namespace tl_agent {
uint8_t needHint;
paddr_t vaddr;
uint8_t alias;
uint8_t way;
};

class BundleChannelB : public DecoupledBundle {
Expand Down Expand Up @@ -71,6 +72,7 @@ namespace tl_agent {
uint8_t needHint;
paddr_t vaddr;
uint8_t alias;
uint8_t way;
};

template<class Usr, class Echo, std::size_t N>
Expand All @@ -87,6 +89,7 @@ namespace tl_agent {
uint8_t dirty;
shared_tldata_t<N> data;
uint8_t corrupt;
uint8_t way;
};

class BundleChannelE : public DecoupledBundle {
Expand Down
28 changes: 27 additions & 1 deletion main/TLAgent/CAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ namespace tl_agent {
} else {
entry->update_status(this, S_SENDING_C, c->alias);
}
c->way = entry->way;
} else {
tlc_assert(false, this, "Localboard key not found!");
}
Expand Down Expand Up @@ -613,6 +614,7 @@ namespace tl_agent {
} else {
entry->update_status(this, S_SENDING_C, c->alias);
}
c->way = entry->way;
} else {
tlc_assert(false, this, "Localboard key not found!");
}
Expand Down Expand Up @@ -726,6 +728,7 @@ namespace tl_agent {
this->port->c.source = c->source;
this->port->c.alias = 0;
// this->port->c.dirty = c->dirty;
this->port->c.way = c->way;
this->port->c.valid = true;
return OK;
}
Expand Down Expand Up @@ -953,6 +956,7 @@ namespace tl_agent {
.Append("source: ", uint64_t(chnC.source))
.Append(", addr: ", uint64_t(chnC.address))
.Append(", alias: ", uint64_t(chnC.alias))
.Append(", way: ", uint64_t(chnC.way))
.EndLine());
}
inflightTimeStampsC[chnC.address] = { .time = cycle(), .opcode = TLOpcodeC::Release };
Expand All @@ -968,6 +972,7 @@ namespace tl_agent {
.Append("source: ", uint64_t(chnC.source))
.Append(", addr: ", uint64_t(chnC.address))
.Append(", alias: ", uint64_t(chnC.alias))
.Append(", way: ", uint64_t(chnC.way))
.Append(", data: "));
LogEx(data_dump_embedded<BEATSIZE>(chnC.data->data));
LogEx(std::cout << std::endl);
Expand Down Expand Up @@ -1146,6 +1151,7 @@ namespace tl_agent {

auto addr = idMap->query(this, chnD.source)->address;
auto alias = idMap->query(this, chnD.source)->alias;
auto way = chnD.way;

uint64_t latency;

Expand All @@ -1159,6 +1165,7 @@ namespace tl_agent {
.Append("source: ", uint64_t(chnD.source))
.Append(", addr: ", uint64_t(addr))
.Append(", alias: ", uint64_t(alias))
.Append(", way: ", uint64_t(way))
.EndLine());
}
}
Expand All @@ -1172,6 +1179,7 @@ namespace tl_agent {
.Append("source: ", uint64_t(chnD.source))
.Append(", addr: ", uint64_t(addr))
.Append(", alias: ", uint64_t(alias))
.Append(", way: ", uint64_t(way))
.Append(", data: "));
LogEx(data_dump_embedded<BEATSIZE>(chnD.data->data));
LogEx(std::cout << std::endl);
Expand Down Expand Up @@ -1411,6 +1419,15 @@ namespace tl_agent {
bool hasData = TLEnumEquals(chnD.opcode, TLOpcodeD::GrantData);
bool grant = TLEnumEquals(chnD.opcode, TLOpcodeD::GrantData, TLOpcodeD::Grant);

if (grant && way >= cfg->masterCountWay)
{
Log(this, Hex().ShowBase().Append("Invalid 'way' value, way: ", way).EndLine());
if (way == 0xFF)
Log(this, Append("0xFF captured, considering checking X-state propagation on 'way'.\n"));
tlc_assert(false, this,
"'way' on channel D is invalid or out of range, consider checking X-state propagation");
}

auto info = localBoard->query(this, addr);
auto exact_status = info->status[alias];
if (exact_status == S_A_WAITING_D_NESTED_SENDING_C) {
Expand All @@ -1435,13 +1452,15 @@ namespace tl_agent {
tlc_assert(chnD.opcode == pendingD.info->opcode, this, "Opcode mismatch among beats!");
tlc_assert(chnD.param == pendingD.info->param, this, "Param mismatch among beats!");
tlc_assert(chnD.source == pendingD.info->source, this, "Source mismatch among beats!");
tlc_assert(chnD.way == pendingD.info->way, this, "Way mismatch among beats!");
pendingD.update(this);
} else { // new D resp
auto resp_d = std::make_shared<BundleChannelD<RespField, EchoField, DATASIZE>>();
resp_d->opcode = chnD.opcode;
resp_d->param = chnD.param;
resp_d->source = chnD.source;
resp_d->data = grant ? make_shared_tldata<DATASIZE>() : nullptr;
resp_d->way = chnD.way;
int nr_beat = TLEnumEquals(chnD.opcode, TLOpcodeD::Grant, TLOpcodeD::ReleaseAck) ? 0 : 1; // TODO: parameterize it
pendingD.init(resp_d, nr_beat);
}
Expand Down Expand Up @@ -1470,13 +1489,15 @@ namespace tl_agent {
.Append(" at ", addr)
.ToString());

info->way = way;

latency = map_latency(addr);

if (glbl.cfg.verbose_xact_data_complete)
{
Log(this, Append("[data complete D] [GrantData ",
GrantDataParamToString(TLParamGrantData(chnD.param)), "] ")
.Hex().ShowBase().Append("source: ", uint64_t(chnD.source), ", addr: ", addr, ", alias: ", alias, ", data: "));
.Hex().ShowBase().Append("source: ", uint64_t(chnD.source), ", addr: ", addr, ", alias: ", alias, ", way: ", uint64_t(way), ", data: "));
LogEx(data_dump_embedded<DATASIZE>(pendingD.info->data->data));
LogEx(std::cout << std::endl);

Expand Down Expand Up @@ -1510,6 +1531,9 @@ namespace tl_agent {
.Append("Grant not expected on ", StatusToString(exact_status))
.Append(" at ", addr)
.ToString());

info->way = way;

// Always set dirty in AcquirePerm toT txns
info->update_dirty(this, true, alias);

Expand Down Expand Up @@ -1867,6 +1891,7 @@ namespace tl_agent {
#else
req_c->needHint = 0;
#endif
req_c->way = entry->way;
pendingC.init(req_c, DATASIZE / BEATSIZE);

if (glbl.cfg.verbose_xact_sequenced)
Expand Down Expand Up @@ -1974,6 +1999,7 @@ namespace tl_agent {
req_c->opcode = uint8_t(TLOpcodeC::Release);
req_c->param = uint8_t(TLParamRelease(param));
req_c->data = make_shared_tldata_zero<DATASIZE>();
req_c->way = entry->way;

if (glbl.cfg.verbose_agent_debug)
{
Expand Down
1 change: 1 addition & 0 deletions main/TLAgent/CAgent.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ namespace tl_agent {
TLPermission privilege[4];
TLPermission pending_privilege[4];
int dirty[4];
uint8_t way;

inline C_SBEntry(const TLLocalContext* ctx, const int status[], const TLPermission privilege[])
{
Expand Down
Loading