From: Randy Howard on 10 Jan 2007 16:33 On Wed, 10 Jan 2007 15:21:42 -0600, globalsk wrote (in article <1168464102.176197.99380(a)k58g2000hse.googlegroups.com>): > > user923005 ha escrito: > >> globalsk wrote: >>> I can't, this is for a university project and I have to use >>> simplescalar's cache. It's code is kinda of documented, but not enough >>> in the areas I'm looking and dont seem to find any information about >>> this, not even in the main web page. That's why I ask here as I'm >>> someone might have the knowledge about all this maskings. >> >> Did you read this stuff: >> http://simplescalar.com/docs/users_guide_v2.pdf >> >> A search on "cache" shows 78 hits in that document. >> >> And for this one: >> http://simplescalar.com/docs/hack_guide_v2.pdf >> >> A search on "cache" shows 105 hits. >> >> 35 hits in here: >> http://simplescalar.com/docs/simple_tutorial_v4.pdf >> >> 159 in here: >> http://simplescalar.com/docs/simple_tutorial_v2.pdf >> >> If (after reading these things) you do not get your answers, why not >> send an email to info(a)simplescalar.com with your specific questions. > > Of course, I did look those up, but they dont give answers to my > cuestions. So you sent an email to that address with the specific questions you don't yet have answers for and are waiting on a response? -- Randy Howard (2reply remove FOOBAR) "The power of accurate observation is called cynicism by those who have not got it." - George Bernard Shaw
From: globalsk on 10 Jan 2007 18:43 Randy Howard ha escrito: > On Wed, 10 Jan 2007 15:21:42 -0600, globalsk wrote > (in article <1168464102.176197.99380(a)k58g2000hse.googlegroups.com>): > > > > > user923005 ha escrito: > > > >> globalsk wrote: > >>> I can't, this is for a university project and I have to use > >>> simplescalar's cache. It's code is kinda of documented, but not enough > >>> in the areas I'm looking and dont seem to find any information about > >>> this, not even in the main web page. That's why I ask here as I'm > >>> someone might have the knowledge about all this maskings. > >> > >> Did you read this stuff: > >> http://simplescalar.com/docs/users_guide_v2.pdf > >> > >> A search on "cache" shows 78 hits in that document. > >> > >> And for this one: > >> http://simplescalar.com/docs/hack_guide_v2.pdf > >> > >> A search on "cache" shows 105 hits. > >> > >> 35 hits in here: > >> http://simplescalar.com/docs/simple_tutorial_v4.pdf > >> > >> 159 in here: > >> http://simplescalar.com/docs/simple_tutorial_v2.pdf > >> > >> If (after reading these things) you do not get your answers, why not > >> send an email to info(a)simplescalar.com with your specific questions. > > > > Of course, I did look those up, but they dont give answers to my > > cuestions. > > So you sent an email to that address with the specific questions you > don't yet have answers for and are waiting on a response? > > > > -- > Randy Howard (2reply remove FOOBAR) > "The power of accurate observation is called cynicism by those > who have not got it." - George Bernard Shaw Hello Randy, I did write an email to the address but don't know (or hope) the will answer me. Thats why I'm trying in a more active sources of information like this one.
From: Barry on 10 Jan 2007 20:16 "globalsk" <jmilanasue(a)gmail.com> wrote in message news:1168464692.827813.289410(a)i39g2000hsf.googlegroups.com... > > Barry ha escrito: > > > "globalsk" <jmilanasue(a)gmail.com> wrote in message > > news:1168392800.832029.100260(a)o58g2000hsb.googlegroups.com... > > > More insight about this topic and the core of the question relies in > > > this part of code also: > > > > > > cp->blk_mask = bsize-1; > > > cp->set_shift = log_base2(bsize); > > > cp->set_mask = nsets-1; > > > cp->tag_shift = cp->set_shift + log_base2(nsets); > > > cp->tag_mask = (1 << (32 - cp->tag_shift))-1; > > > cp->tagset_mask = ~cp->blk_mask; > > > > > > Don't understand how this masking works. > > > I know all this is later used for testing cache's hit or miss in a > > > block: > > > > > > if (CACHE_TAGSET(cp, addr) == cp->last_tagset) > > > { > > > /* hit in the same block */ > > > blk = cp->last_blk; > > > goto cache_fast_hit; > > > }), > > > > > > But if someone can give examples with addresses and bits it will be > > > clearer. > > > > > > All this code is for cache simulation as you can see, where you can > > > define associativity and all the regular parameters for a cache. > > > globalsk ha escrito: > > > > > > > Hello, > > > > > > > > I'm trying to understand this fragment of code in Simplescalar's > > > > cache.c code (I've search and look over dozens sites, including > > > > simplescalar.com and there's no help about the coding): > > > > > > > > /* cache access macros */ > > > > #define CACHE_TAG(cp, addr) ((addr) >> (cp)->tag_shift) > > > > #define CACHE_SET(cp, addr) (((addr) >> (cp)->set_shift) & > > > > (cp)->set_mask) > > > > #define CACHE_BLK(cp, addr) ((addr) & (cp)->blk_mask) > > > > #define CACHE_TAGSET(cp, addr) ((addr) & (cp)->tagset_mask) > > > > > > > > I know is about shifting and moving bits around, but don't know how and > > > > specially why is done in this way and for what. > > > > > > > > cp is an structure for a cache > > > > addr is a typedef qword_t (64 bits) > > > > md_addr_t blk_mask; idem, typedef qword_t > > > > int set_shift; > > > > md_addr_t set_mask; /* use *after* shift */ > > > > int tag_shift; > > > > md_addr_t tag_mask; /* use *after* shift */ > > > > md_addr_t tagset_mask; /* used for fast hit detection */ > > > > > > > > Maybe this is little information, but maybe someone with the knowledge > > > > about caches and this type of coding can help out. Please if someone > > > > can give a helping hand about this and links where they explain in more > > > > detail simplescalar's code will be very appreciated. > > > > > > > > Please forgive my syntax mistakes, english is not my mother tongue. > > > > > > > I don't think you have clearly expressed whether you do not > > understand the C code, or how the code is attempting to simulate > > a cache. > > > > I thought it was the C code in which case you can find many > > sources on bit shifting and masking with a simple web search. > > Of course you can search on Kernighan & Ritchie and learn > > 101 more things in the process. The chances that you are > > programming in C at a university and someone doesn't have a > > copy of K&R you could borrow are miniscule. But if you > > intend to do any C programming you should just by one. > > > > How the simulator does is job is certainly a question for the author(s) > > unless you are willing to pay someone to take the time to do it for > > you. Although, if it were a common tool you would likely find > > someone here willing to give help. > > Hello is more about how the code is attempting to simulate a cache and > how it does it with all this masking and shifting (I now what the > instructions do but don't understand why). Of course the author could > answer it but is not likely, more likely is to find someone with a > little knowledge on cache, which for whom it will be pretty easy to > answer I think, don't have to be an expert. I myself is the first time > I have to touch something related with a cache and is taking some > effort fo find answers. > > Thanks > Well you are looking at a few lines of code and talking about "cache." I can think of at least three levels of cache on some systems, before you get to I/O.
From: globalsk on 11 Jan 2007 05:28 Barry ha escrito: > "globalsk" <jmilanasue(a)gmail.com> wrote in message > news:1168464692.827813.289410(a)i39g2000hsf.googlegroups.com... > > > > Barry ha escrito: > > > > > "globalsk" <jmilanasue(a)gmail.com> wrote in message > > > news:1168392800.832029.100260(a)o58g2000hsb.googlegroups.com... > > > > More insight about this topic and the core of the question relies in > > > > this part of code also: > > > > > > > > cp->blk_mask = bsize-1; > > > > cp->set_shift = log_base2(bsize); > > > > cp->set_mask = nsets-1; > > > > cp->tag_shift = cp->set_shift + log_base2(nsets); > > > > cp->tag_mask = (1 << (32 - cp->tag_shift))-1; > > > > cp->tagset_mask = ~cp->blk_mask; > > > > > > > > Don't understand how this masking works. > > > > I know all this is later used for testing cache's hit or miss in a > > > > block: > > > > > > > > if (CACHE_TAGSET(cp, addr) == cp->last_tagset) > > > > { > > > > /* hit in the same block */ > > > > blk = cp->last_blk; > > > > goto cache_fast_hit; > > > > }), > > > > > > > > But if someone can give examples with addresses and bits it will be > > > > clearer. > > > > > > > > All this code is for cache simulation as you can see, where you can > > > > define associativity and all the regular parameters for a cache. > > > > globalsk ha escrito: > > > > > > > > > Hello, > > > > > > > > > > I'm trying to understand this fragment of code in Simplescalar's > > > > > cache.c code (I've search and look over dozens sites, including > > > > > simplescalar.com and there's no help about the coding): > > > > > > > > > > /* cache access macros */ > > > > > #define CACHE_TAG(cp, addr) ((addr) >> (cp)->tag_shift) > > > > > #define CACHE_SET(cp, addr) (((addr) >> (cp)->set_shift) & > > > > > (cp)->set_mask) > > > > > #define CACHE_BLK(cp, addr) ((addr) & (cp)->blk_mask) > > > > > #define CACHE_TAGSET(cp, addr) ((addr) & (cp)->tagset_mask) > > > > > > > > > > I know is about shifting and moving bits around, but don't know how > and > > > > > specially why is done in this way and for what. > > > > > > > > > > cp is an structure for a cache > > > > > addr is a typedef qword_t (64 bits) > > > > > md_addr_t blk_mask; idem, typedef qword_t > > > > > int set_shift; > > > > > md_addr_t set_mask; /* use *after* shift */ > > > > > int tag_shift; > > > > > md_addr_t tag_mask; /* use *after* shift */ > > > > > md_addr_t tagset_mask; /* used for fast hit detection */ > > > > > > > > > > Maybe this is little information, but maybe someone with the > knowledge > > > > > about caches and this type of coding can help out. Please if someone > > > > > can give a helping hand about this and links where they explain in > more > > > > > detail simplescalar's code will be very appreciated. > > > > > > > > > > Please forgive my syntax mistakes, english is not my mother tongue. > > > > > > > > > > I don't think you have clearly expressed whether you do not > > > understand the C code, or how the code is attempting to simulate > > > a cache. > > > > > > I thought it was the C code in which case you can find many > > > sources on bit shifting and masking with a simple web search. > > > Of course you can search on Kernighan & Ritchie and learn > > > 101 more things in the process. The chances that you are > > > programming in C at a university and someone doesn't have a > > > copy of K&R you could borrow are miniscule. But if you > > > intend to do any C programming you should just by one. > > > > > > How the simulator does is job is certainly a question for the author(s) > > > unless you are willing to pay someone to take the time to do it for > > > you. Although, if it were a common tool you would likely find > > > someone here willing to give help. > > > > Hello is more about how the code is attempting to simulate a cache and > > how it does it with all this masking and shifting (I now what the > > instructions do but don't understand why). Of course the author could > > answer it but is not likely, more likely is to find someone with a > > little knowledge on cache, which for whom it will be pretty easy to > > answer I think, don't have to be an expert. I myself is the first time > > I have to touch something related with a cache and is taking some > > effort fo find answers. > > > > Thanks > > > > Well you are looking at a few lines of code and talking about > "cache." I can think of at least three levels of cache on some > systems, before you get to I/O. In simplescalar simultation you can define levels and sizes of cache, in the project we'll be using 2 levels, L1: il1 & dL1 and L2: unified. My question is why they do the masking and shifting in this way. The answer will be to put a general examples/theory with and address the cpu is looking up in a cache and the corresponding hit with data in a line in a block. Please forgive me, I'm only looking for help!
First
|
Prev
|
Pages: 1 2 3 Prev: van Emde Boas tree implementation Next: Bron-Kerbosh algorithm for clique detection |