gem5-users@gem5.org

The gem5 Users mailing list

View all threads

Tags and Indexing Policy

NS
Nazmus Sakib
Fri, Nov 15, 2024 11:29 PM

Hello.
In tags/indexingPolicy/base.cc there is an extractTag function.
In base.hh the prototype is:
virtual Addr extractTag(const Addr addr) const;

In base.cc, the definition is:
Addr
BaseIndexingPolicy::extractTag(const Addr addr) const
{
return (addr >> tagShift);
}

Whether it is set associative or skewed associative, extractTag remains same (no override).

From any tag class (base_set_assoc or sector), you can call this extractTag.

I wanted a method to return setShift value from "indexing policy" back to "tag" class.

In base.hh, I did:
virtual int extractss() const;  [same prototype as extractTag]

In base.cc I did,
int
BaseIndexingPolicy::extractss() const
{
return setShift;
}

From sector_tags.cc, I tried to call this extractss() .
But build fails stating no extractss() declared in the scope. (I am calling it from an existing method in the sector_tags.cc).

Why would this happen ?
Note: setShift is under "protected", not "public"

Hello. In tags/indexingPolicy/base.cc there is an extractTag function. In base.hh the prototype is: virtual Addr extractTag(const Addr addr) const; In base.cc, the definition is: Addr BaseIndexingPolicy::extractTag(const Addr addr) const { return (addr >> tagShift); } Whether it is set associative or skewed associative, extractTag remains same (no override). From any tag class (base_set_assoc or sector), you can call this extractTag. I wanted a method to return setShift value from "indexing policy" back to "tag" class. In base.hh, I did: virtual int extractss() const; [same prototype as extractTag] In base.cc I did, int BaseIndexingPolicy::extractss() const { return setShift; } From sector_tags.cc, I tried to call this extractss() . But build fails stating no extractss() declared in the scope. (I am calling it from an existing method in the sector_tags.cc). Why would this happen ? Note: setShift is under "protected", not "public"
GT
Giacomo Travaglini
Mon, Nov 18, 2024 9:03 AM

Hi Nazmus,

BaseIndexingPolicy is simply a template instantiation of IndexingPolicyTemplate. So the method definition should be there.

Kind Regards

Giacomo

From: Nazmus Sakib via gem5-users gem5-users@gem5.org
Date: Friday, 15 November 2024 at 23:31
To: gem5-users@gem5.org gem5-users@gem5.org
Cc: Jason Lowe-Power jlowepower@ucdavis.edu, Nazmus Sakib nsakib6@nmsu.edu
Subject: [gem5-users] Tags and Indexing Policy
Hello.
In tags/indexingPolicy/base.cc there is an extractTag function.
In base.hh the prototype is:
virtual Addr extractTag(const Addr addr) const;

In base.cc, the definition is:
Addr
BaseIndexingPolicy::extractTag(const Addr addr) const
{
return (addr >> tagShift);
}

Whether it is set associative or skewed associative, extractTag remains same (no override).

From any tag class (base_set_assoc or sector), you can call this extractTag.

I wanted a method to return setShift value from "indexing policy" back to "tag" class.

In base.hh, I did:
virtual int extractss() const;  [same prototype as extractTag]

In base.cc I did,
int
BaseIndexingPolicy::extractss() const
{
return setShift;
}

From sector_tags.cc, I tried to call this extractss() .
But build fails stating no extractss() declared in the scope. (I am calling it from an existing method in the sector_tags.cc).

Why would this happen ?
Note: setShift is under "protected", not "public"

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

Hi Nazmus, BaseIndexingPolicy is simply a template instantiation of IndexingPolicyTemplate. So the method definition should be there. Kind Regards Giacomo From: Nazmus Sakib via gem5-users <gem5-users@gem5.org> Date: Friday, 15 November 2024 at 23:31 To: gem5-users@gem5.org <gem5-users@gem5.org> Cc: Jason Lowe-Power <jlowepower@ucdavis.edu>, Nazmus Sakib <nsakib6@nmsu.edu> Subject: [gem5-users] Tags and Indexing Policy Hello. In tags/indexingPolicy/base.cc there is an extractTag function. In base.hh the prototype is: virtual Addr extractTag(const Addr addr) const; In base.cc, the definition is: Addr BaseIndexingPolicy::extractTag(const Addr addr) const { return (addr >> tagShift); } Whether it is set associative or skewed associative, extractTag remains same (no override). From any tag class (base_set_assoc or sector), you can call this extractTag. I wanted a method to return setShift value from "indexing policy" back to "tag" class. In base.hh, I did: virtual int extractss() const; [same prototype as extractTag] In base.cc I did, int BaseIndexingPolicy::extractss() const { return setShift; } From sector_tags.cc, I tried to call this extractss() . But build fails stating no extractss() declared in the scope. (I am calling it from an existing method in the sector_tags.cc). Why would this happen ? Note: setShift is under "protected", not "public" IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.