cachesim
A cache simulator
cache.c
Go to the documentation of this file.
00001 /* -*- mode:c; coding: utf-8 -*- */
00002 
00003 #include "cache.h"
00004 #include "direct_cache.h"
00005 #include "full_cache.h"
00006 
00007 #include <string.h>
00008 
00009 AbstractMemory *
00010 cache_create(ConfigFile *cfg, const char *var_prefix, StatisticsInfo *info, AbstractMemory *mem, Random *rnd)
00011 {
00012     const char *a = config_file_get(cfg, "associativity");
00013     if (!a) {
00014         error_undefined("cache_create", "associativity");
00015     } else if (!strcmp(a, "full")) {
00016         return full_cache_create(cfg, var_prefix, info, mem, rnd);
00017     } else if (!strcmp(a, "direct")) {
00018         return direct_cache_create(cfg, var_prefix, info, mem, rnd);
00019     } else {
00020         error_invalid("cache_create", "associativity");
00021     }
00022     return NULL;
00023 }
00024 
00025 /*
00026  * Local variables:
00027  *  c-basic-offset: 4
00028  * End:
00029  */