NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.
Tech:CLT Tutor Sources
C sources for Program Cache Layout Tutorial.
Return to Program Cache Layout
main.c[edit]
/*****************************************************************************/ /* MAIN.C - defines main() and static function local() for Cache Layout */ /* Tool Tutorial. */ /*****************************************************************************/ #include <stdio.h>
void lots(int i); void rare(); static void local();
/*****************************************************************************/ /* MAIN() - calls rare() once; calls main.c:local() 4 times. */ /*****************************************************************************/ void main() { int i; rare(); for (i = 1; i < 5; i++) local(); printf("\n"); fflush(stdout); }
/*****************************************************************************/ /* LOCAL() - calls lots() 80 times. */ /*****************************************************************************/ static void local() { int i; printf("-"); for (i = 0; i < 20; ++i) lots(i); }
lots.c[edit]
/*****************************************************************************/ /* LOTS.C - defines lots() and static function local() for Cache Layout */ /* Tool Tutorial. */ /*****************************************************************************/ #include <stdio.h> static void local();
/*****************************************************************************/ /* LOTS() - calls lots.c:local() 100+ times. */ /*****************************************************************************/ void lots(int i) { local(); if (i % 3 == 0) local(); }
/*****************************************************************************/ /* LOCAL() - print out a '.' to stdout. */ /*****************************************************************************/ void local() { printf("."); }
rare.c[edit]
/*****************************************************************************/ /* RARE.C - defines global function rare() for Cache Layout Tool Tutorial. */ /*****************************************************************************/ void rare() { }