Skip to content

Commit

Permalink
This is the first commit! The Makefile recursion used to build the si…
Browse files Browse the repository at this point in the history
…mulator

should probably revised such that making in subdirectories is automatic.
Presently, subdirectory makefiles are done explicitly
  • Loading branch information
Jonathan Eastep committed Apr 17, 2008
1 parent 301a334 commit 47e5cd7
Show file tree
Hide file tree
Showing 56 changed files with 4,756 additions and 1 deletion.
26 changes: 26 additions & 0 deletions Makefile
@@ -0,0 +1,26 @@
include common/makefile.gnu.config

all:
$(MAKE) -C common
$(MAKE) -C pin
$(MAKE) -C qemu

pinbin:
$(MAKE) -C common
$(MAKE) -C pin

qemubin:
$(MAKE) -C common
$(MAKE) -C qemu

clean:
$(MAKE) -C common clean
$(MAKE) -C pin clean
$(MAKE) -C qemu clean
-rm -f *.o *.d *.rpo

squeaky: clean
$(MAKE) -C common squeaky
$(MAKE) -C pin squeaky
$(MAKE) -C qemu squeaky
-rm -f *~
2 changes: 1 addition & 1 deletion README
@@ -1 +1 @@
This is the carbon simulator project
This is the Carbon simulator project
40 changes: 40 additions & 0 deletions common/Makefile
@@ -0,0 +1,40 @@
include ./makefile.gnu.config

all: userobjs coreobjs networkobjs phystransobjs miscobjs testobjs


userobjs:
$(MAKE) -C user

coreobjs:
$(MAKE) -C core

networkobjs:
$(MAKE) -C network

phystransobjs:
$(MAKE) -C phys_trans

miscobjs:
$(MAKE) -C misc

testobjs:
$(MAKE) -C tests

clean:
$(MAKE) -C user clean
$(MAKE) -C core clean
$(MAKE) -C network clean
$(MAKE) -C phys_trans clean
$(MAKE) -C misc clean
$(MAKE) -C tests clean
-rm -f *.o *.d *.rpo

squeaky: clean
$(MAKE) -C user squeaky
$(MAKE) -C core squeaky
$(MAKE) -C network squeaky
$(MAKE) -C phys_trans squeaky
$(MAKE) -C misc squeaky
$(MAKE) -C tests squeaky
-rm -f *~
4 changes: 4 additions & 0 deletions common/README
@@ -0,0 +1,4 @@
This folder contains code common to the various simulator implementations.

Style note:
The files in this folder should not depend upon Pin or QEMU if possible. Or, they should be made portable.
23 changes: 23 additions & 0 deletions common/core/Makefile
@@ -0,0 +1,23 @@
include ../makefile.gnu.config

DBG=-g
OPT=-O2
CFLAGS=-c -I$(PIN_HOME)/InstLib -I../../pin/src -I../user -I../network -I../phys_trans -I../misc -I../ -I./ -fomit-frame-pointer -Wall -Werror -Wno-unknown-pragmas $(DBG) $(OPT) -MMD
LDFLAGS=

SOURCES = cache.cc ocache.cc perfmdl.cc core.cc
OBJECTS = $(SOURCES:%.cc=%.o)


all: $(OBJECTS)


## build rules

%.o : %.cc
$(CXX) $(CFLAGS) $(PIN_CXXFLAGS) -o $@ $<

clean:
-rm -f *.o *.d *.rpo
squeaky: clean
-rm -f *~
2 changes: 2 additions & 0 deletions common/core/README
@@ -0,0 +1,2 @@
This directory is for the functional and performance models
for the processing core.
77 changes: 77 additions & 0 deletions common/core/cache.cc
@@ -0,0 +1,77 @@
#include "cache.h"


/* ================================================================================================ */
/* CacheBase methods */
/* ================================================================================================ */

CacheBase::CacheBase(std::string name, UINT32 size, UINT32 line_bytes, UINT32 assoc) :
name(name), cache_size(size), line_size(line_bytes), associativity(assoc),
line_shift(floorLog2(line_bytes)), set_index_mask((size / (assoc * line_bytes)) - 1)
{

ASSERTX(isPower2(line_size));
ASSERTX(isPower2(set_index_mask + 1));

for (UINT32 access_type = 0; access_type < k_ACCESS_TYPE_NUM; access_type++)
{
access[access_type][false] = 0;
access[access_type][true] = 0;
}
}


// Stats output method

string CacheBase::statsLong(string prefix, CacheType cache_type) const
{
const UINT32 header_width = 19;
const UINT32 number_width = 12;

string out;

out += prefix + name + ":" + "\n";

if (cache_type != k_CACHE_TYPE_ICACHE) {
for (UINT32 i = 0; i < k_ACCESS_TYPE_NUM; i++)
{
const AccessType access_type = AccessType(i);

std::string type(access_type == k_ACCESS_TYPE_LOAD ? "Load" : "Store");

out += prefix + ljstr(type + "-Hits: ", header_width)
+ myDecStr(getHits(access_type), number_width)
+ " " +fltstr(100.0 * getHits(access_type) / safeFDiv(getAccesses(access_type)), 2, 6)
+ "%\n";

out += prefix + ljstr(type + "-Misses: ", header_width)
+ myDecStr(getMisses(access_type), number_width)
+ " " +fltstr(100.0 * getMisses(access_type) / safeFDiv(getAccesses(access_type)), 2, 6)
+ "%\n";

out += prefix + ljstr(type + "-Accesses: ", header_width)
+ myDecStr(getAccesses(access_type), number_width)
+ " " +fltstr(100.0 * getAccesses(access_type) / safeFDiv(getAccesses(access_type)), 2, 6)
+ "%\n";

out += prefix + "\n";
}
}

out += prefix + ljstr("Total-Hits: ", header_width)
+ myDecStr(getHits(), number_width)
+ " " +fltstr(100.0 * getHits() / getAccesses(), 2, 6) + "%\n";

out += prefix + ljstr("Total-Misses: ", header_width)
+ myDecStr(getMisses(), number_width)
+ " " +fltstr(100.0 * getMisses() / getAccesses(), 2, 6) + "%\n";

out += prefix + ljstr("Total-Accesses: ", header_width)
+ myDecStr(getAccesses(), number_width)
+ " " +fltstr(100.0 * getAccesses() / getAccesses(), 2, 6) + "%\n";

out += "\n";

return out;
}

0 comments on commit 47e5cd7

Please sign in to comment.