Thread: cache tag calculation

  1. #1
    essence of digital xddxogm3's Avatar
    Join Date
    Sep 2003
    Posts
    589

    cache tag calculation

    how would you calculate the cache tag?
    is there a way to break a binary address into it's separate parts?
    i know that we the block address is calculated by dividing the byte address by the block size. i know the set index is calculated by modulating the block address by the total number of sets. but how do you calculate the cache tag?
    "Hence to fight and conquer in all your battles is not supreme excellence;
    supreme excellence consists in breaking the enemy's resistance without fighting."
    Art of War Sun Tzu

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Treat the address as an unsigned long say, then use bitwise operators to mask off certain groups of bits.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need help with cache simulator!
    By dtogers123 in forum C Programming
    Replies: 3
    Last Post: 04-30-2008, 06:18 PM
  2. ideas requested for a CACHE.
    By bean66 in forum C Programming
    Replies: 2
    Last Post: 02-21-2008, 11:01 AM
  3. Resource manager tree
    By VirtualAce in forum Game Programming
    Replies: 23
    Last Post: 09-07-2007, 10:27 PM
  4. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  5. cache miss/hit
    By xddxogm3 in forum C++ Programming
    Replies: 3
    Last Post: 05-07-2007, 06:51 PM