Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csci320
pin_cache
Commits
e30b1b4a
Commit
e30b1b4a
authored
Oct 22, 2013
by
Alan Marchiori
Browse files
fix
parent
bedd5b8f
Changes
4
Hide whitespace changes
Inline
Side-by-side
cache/Makefile
deleted
100644 → 0
View file @
bedd5b8f
#
# Main Makefile for the AvDark cache simulator.
#
# Course: Advanced Computer Architecture, Uppsala University
# Course Part: Lab assignment 1
#
# Author: Andreas Sandberg <andreas.sandberg@it.uu.se>
#
# $Id: Makefile 80 2012-09-13 06:51:51Z andse541 $
#
COURSE_DIR
?=
.
PIN_ROOT
=
~/pin-2.13-61206-gcc.4.4.7-linux
PIN_KIT
=
$(PIN_ROOT)
CONFIG_ROOT
=
$(PIN_ROOT)
/source/tools/Config
CC
=
gcc
CFLAGS
=
-Wall
-std
=
gnu99
include
$(CONFIG_ROOT)/makefile.config
SRC_FILES
=
cache.c
TOOL_ROOTS
=
avdc
TOOLS
=
$
(
TOOL_ROOTS:%
=
$(OBJDIR)
%
$(PINTOOL_SUFFIX)
)
all
:
tools
tools
:
$(OBJDIR) $(TOOLS)
$(OBJDIR)
:
mkdir
-p
$(OBJDIR)
$(OBJDIR)%.o
:
%.c
$(CC)
-c
-std
=
c99
$(PIN_CXXFLAGS)
${OUTOPT}$@
$<
$(OBJDIR)%.o
:
%.cc
$(CXX)
-c
$(CXXFLAGS)
$(PIN_CXXFLAGS)
${OUTOPT}$@
$<
$(TOOLS)
:
$(PIN_LIBNAMES)
$(TOOLS)
:
%$(PINTOOL_SUFFIX) : $(OBJDIR)pin-glue.o $(OBJDIR)cache.o
${PIN_LD}
$(PIN_LDFLAGS)
$(LINK_DEBUG)
${LINK_OUT}$@
$^
${PIN_LPATHS}
$(PIN_LIBS)
$(LIBS)
$(DBG)
info
:
@
echo
"To compile the cache simulator, just run make."
@
echo
@
echo
"To run test cases, use one of the following targets:"
@
echo
" test-direct - Tests for direct mapped caches"
@
echo
" test-assoc - Tests for set associative caches"
@
echo
" test - All tests"
@
echo
@
echo
"To run a make target type 'make target'"
test
:
test-direct test-assoc
test-direct
:
test0
@
echo
"**************************************************"
@
echo
"* Running tests for direct mapped caches *"
@
echo
"**************************************************"
./test0
>
/dev/null
test-assoc
:
test1
@
echo
"**************************************************"
@
echo
"* Running tests for associative caches *"
@
echo
"**************************************************"
./test1
>
/dev/null
test0
:
test0.o cache.o
test1
:
test1.o cache.o
pin-clean
:
$(RM)
-r
$(OBJDIR)
clean
:
pin-clean
$(RM)
*
.o test0 test1
.PHONY
:
all clean test-direct test-assoc tools
cache/cache.c
View file @
e30b1b4a
...
...
@@ -7,10 +7,10 @@
* Original authors: UART 1.0(?)
* Modified by: Andreas Sandberg <andreas.sandberg@it.uu.se>
*
* $Id:
avdark-
cache.c 14 2011-08-24 09:55:20Z ansan501 $
* $Id: cache.c 14 2011-08-24 09:55:20Z ansan501 $
*/
#include "
avdark-
cache.h"
#include "cache.h"
#include <stdarg.h>
#include <stdio.h>
...
...
@@ -138,8 +138,9 @@ avdc_access(avdark_cache_t *self, avdc_pa_t pa, avdc_access_type_t type)
void
avdc_flush_cache
(
avdark_cache_t
*
self
)
{
int
i
;
/* HINT: You will need to update this function */
for
(
int
i
=
0
;
i
<
self
->
number_of_sets
;
i
++
)
{
for
(
i
=
0
;
i
<
self
->
number_of_sets
;
i
++
)
{
self
->
lines
[
i
].
valid
=
0
;
self
->
lines
[
i
].
tag
=
0
;
}
...
...
@@ -229,7 +230,7 @@ avdc_new(avdc_size_t size, avdc_block_size_t block_size,
self
=
AVDC_MALLOC
(
1
,
avdark_cache_t
);
memset
(
self
,
0
,
sizeof
(
*
self
));
self
->
dbg
=
0
;
self
->
dbg
=
1
;
if
(
!
avdc_resize
(
self
,
size
,
block_size
,
assoc
))
{
AVDC_FREE
(
self
);
...
...
cache/cache.h
View file @
e30b1b4a
...
...
@@ -6,7 +6,7 @@
*
* Author: Andreas Sandberg <andreas.sandberg@it.uu.se>
*
* $Id:
avdark-
cache.h 13 2011-08-24 09:50:25Z ansan501 $
* $Id: cache.h 13 2011-08-24 09:50:25Z ansan501 $
*/
#ifndef AVDARK_CACHE_H
...
...
@@ -32,7 +32,7 @@ typedef enum {
/**
* Forward declaration of the avdc_cache_line struct which is declared
* in
avdark-
cache.c. The forward declaration is needed for the
* in cache.c. The forward declaration is needed for the
* simulator configuration struct.
*/
typedef
struct
avdc_cache_line
avdc_cache_line_t
;
...
...
@@ -53,7 +53,7 @@ typedef struct {
/**
* A pointer to an array of cache blocks. You will need to
* change this structure, the strucutre declaration is in
*
avdark-
cache.c. This pointer is initialized by
* cache.c. This pointer is initialized by
* avdc_resize().
*
* HINT: You may need to change how the internal cache state
...
...
cache/test1.c
View file @
e30b1b4a
...
...
@@ -9,7 +9,7 @@
* $Id: test1.c 13 2011-08-24 09:50:25Z ansan501 $
*/
#include "
avdark-
cache.h"
#include "cache.h"
#include <stdlib.h>
#include <stdio.h>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment