aboutsummaryrefslogtreecommitdiff
path: root/devkit
diff options
context:
space:
mode:
Diffstat (limited to 'devkit')
-rw-r--r--devkit/Makefile2
-rw-r--r--devkit/cacheracer.h24
2 files changed, 20 insertions, 6 deletions
diff --git a/devkit/Makefile b/devkit/Makefile
index 3890bc0..2a8d744 100644
--- a/devkit/Makefile
+++ b/devkit/Makefile
@@ -29,7 +29,7 @@ FLAGS = $(COMMONFLAGS) $(FLAGS_$(basename $(notdir $@)))
all: $(TARGETS)
-$(TARGETS): bin/%: obj/%.o
+$(TARGETS): bin/%: obj/%.o cacheracer.h
$(CC) $(LINKFLAGS) $< -o $@
$(OBJECTS): obj/%.o: %.c
diff --git a/devkit/cacheracer.h b/devkit/cacheracer.h
index 5885395..7626524 100644
--- a/devkit/cacheracer.h
+++ b/devkit/cacheracer.h
@@ -31,20 +31,33 @@ void __start(int core_id);
#define HOME_RW ((void *) HOME_RW_START)
#define HOME_DATA ((void *) HOME_DATA_START)
+/** Cache Layout
+ *
+ * Each team is given a shared direct-mapped cache with 2 blocks; each
+ * block contains 64 words (256 bytes) of memory.
+ */
+
+#define CACHE_NUM_BLOCKS 2
+
/** Definitions of global data */
#define TAUNT_SIZE 228
struct player_status {
+ unsigned int cache_tags[CACHE_NUM_BLOCKS];
+ unsigned int cache_fetch_tags[CACHE_NUM_BLOCKS];
+ unsigned int cycles_left;
+ unsigned int score;
+ unsigned char payload;
+ unsigned char pad0, pad1, pad2;
signed char taunt[TAUNT_SIZE];
-};
+} __attribute__ ((packed));
/** Pointers to global structures */
#define HOME_STATUS ((struct player_status*) (HOME_RW_START - sizeof(struct player_status)))
-__attribute__ ((unused, noinline))
-static void prints(char *fmt) {
+__attribute__ ((unused, noinline)) static void prints(char *fmt) {
__asm__ __volatile__ (
"ADDI a1, %0, 0\n\t"
"ADDI a0, zero, 22\n\t"
@@ -55,11 +68,12 @@ static void prints(char *fmt) {
}
__attribute__ ((unused, noinline)) static void printi(int i) {
- /* invoke system call number 22 */
__asm__ __volatile__ (
- "ADDI a1, a0, 0\n\t"
+ "ADDI a1, %0, 0\n\t"
"ADDI a0, zero, 23\n\t"
"SCALL\n\t"
+ :
+ : "r" (i)
);
}