You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.0 KiB

7 months ago
  1. /*
  2. * cachelab.h - Prototypes for Cache Lab helper functions
  3. */
  4. #ifndef CACHELAB_TOOLS_H
  5. #define CACHELAB_TOOLS_H
  6. #define MAX_TRANS_FUNCS 100
  7. typedef struct trans_func{
  8. void (*func_ptr)(int M,int N,int[N][M],int[M][N]);
  9. char* description;
  10. char correct;
  11. unsigned int num_hits;
  12. unsigned int num_misses;
  13. unsigned int num_evictions;
  14. } trans_func_t;
  15. /*
  16. * printSummary - This function provides a standard way for your cache
  17. * simulator * to display its final hit and miss statistics
  18. */
  19. void printSummary(int hits, /* number of hits */
  20. int misses, /* number of misses */
  21. int evictions); /* number of evictions */
  22. /* Fill the matrix with data */
  23. void initMatrix(int M, int N, int A[N][M], int B[M][N]);
  24. /* The baseline trans function that produces correct results. */
  25. void correctTrans(int M, int N, int A[N][M], int B[M][N]);
  26. /* Add the given function to the function list */
  27. void registerTransFunction(
  28. void (*trans)(int M,int N,int[N][M],int[M][N]), char* desc);
  29. #endif /* CACHELAB_TOOLS_H */