fix up interruption related bug in RAW version. Use our own interruption setup codes...
authorjzhou <jzhou>
Thu, 17 Jul 2008 01:56:10 +0000 (01:56 +0000)
committerjzhou <jzhou>
Thu, 17 Jul 2008 01:56:10 +0000 (01:56 +0000)
Robust/src/Makefile.raw.1
Robust/src/Makefile.raw.2
Robust/src/Makefile.raw.4
Robust/src/Makefile.raw.i.1
Robust/src/Makefile.raw.i.2
Robust/src/Makefile.raw.i.4
Robust/src/Runtime/mem.c [new file with mode: 0644]
Robust/src/Runtime/multicoretask.c
Robust/src/Runtime/raw_dataCache.s [new file with mode: 0644]
Robust/src/Runtime/raw_interrupt.s [new file with mode: 0644]

index 13c961e131bfc533e19411d482983fe86baad47e..beb104edd5f8d95476887cb364036e95e3af31b2 100644 (file)
@@ -2,18 +2,17 @@ TOPDIR=/home/jzhou/starsearch
 include $(TOPDIR)/Makefile.include
 
 RGCCFLAGS += -O2 
-RGCCFLAGS += -DTASK -DMULTICORE -DRAW 
+RGCCFLAGS += -DTASK -DMULTICORE -DRAW -DY1
 
 SIM-CYCLES = 10000
 
 ATTRIBUTES += HWIC
 
 TILE_PATTERN = 4x1
-#INCLUDES += -I.
 
 OBJECT_FILES_COMMON = multicoretask.o multicoreruntime.o Queue.o file.o math.o object.o \
                                          GenericHashtable.o SimpleHash.o ObjectHash.o socket.o checkpoint.o\
-                                         taskdefs.o methods.o raw_dataCache.o mem.o
+                                         taskdefs.o methods.o mem.o raw_dataCache.o raw_interrupt.o
                                          
 # this is for a multi-tile test
 include $(COMMONDIR)/Makefile.all
index 0716135793e151e8f01570621ada9e3ff90d99c0..d063a4130907be52562425a46c5f6233a5c202bd 100644 (file)
@@ -2,18 +2,17 @@ TOPDIR=/home/jzhou/starsearch
 include $(TOPDIR)/Makefile.include
 
 RGCCFLAGS += -O2 
-RGCCFLAGS += -DTASK -DMULTICORE -DRAW 
+RGCCFLAGS += -DTASK -DMULTICORE -DRAW -DY2
 
 SIM-CYCLES = 10000
 
 ATTRIBUTES += HWIC
 
 TILE_PATTERN = 4x2
-#INCLUDES += -I.
 
 OBJECT_FILES_COMMON = multicoretask.o multicoreruntime.o Queue.o file.o math.o object.o \
-                 GenericHashtable.o SimpleHash.o ObjectHash.o socket.o checkpoint.o\
-                 taskdefs.o methods.o raw_dataCache.o mem.o
+                                         GenericHashtable.o SimpleHash.o ObjectHash.o socket.o checkpoint.o\
+                                         taskdefs.o methods.o mem.o raw_dataCache.o raw_interrupt.o
                                          
 # this is for a multi-tile test
 include $(COMMONDIR)/Makefile.all
index 07f53da9a4feb07ed7cf82a944c9b55e381a26c9..0bf349bbd842a51ea9ef612c4d8ef40e0c719a66 100644 (file)
@@ -2,18 +2,17 @@ TOPDIR=/home/jzhou/starsearch
 include $(TOPDIR)/Makefile.include
 
 RGCCFLAGS += -O2 
-RGCCFLAGS += -DTASK -DMULTICORE -DRAW 
+RGCCFLAGS += -DTASK -DMULTICORE -DRAW -DY4
 
 SIM-CYCLES = 10000
 
 ATTRIBUTES += HWIC
 
 TILE_PATTERN = 4x4
-#INCLUDES += -I.
 
 OBJECT_FILES_COMMON = multicoretask.o multicoreruntime.o Queue.o file.o math.o object.o \
                                          GenericHashtable.o SimpleHash.o ObjectHash.o socket.o checkpoint.o\
-                                         taskdefs.o methods.o raw_dataCache.o mem.o
+                                         taskdefs.o methods.o mem.o raw_dataCache.o raw_interrupt.o
                                          
 # this is for a multi-tile test
 include $(COMMONDIR)/Makefile.all
index 1196a51e21ebb7bf134000078dafa70358a9ddc7..fe4c9f8f427e713357c8b272ad389805816f201f 100644 (file)
@@ -2,18 +2,17 @@ TOPDIR=/home/jzhou/starsearch
 include $(TOPDIR)/Makefile.include
 
 RGCCFLAGS += -O2 
-RGCCFLAGS += -DTASK -DMULTICORE -DRAW -DINTERRUPT 
+RGCCFLAGS += -DTASK -DMULTICORE -DRAW -DINTERRUPT -DY1
 
 SIM-CYCLES = 10000
 
 ATTRIBUTES += HWIC
 
 TILE_PATTERN = 4x1
-#INCLUDES += -I.
 
 OBJECT_FILES_COMMON = multicoretask.o multicoreruntime.o Queue.o file.o math.o object.o \
                                          GenericHashtable.o SimpleHash.o ObjectHash.o socket.o checkpoint.o\
-                                         taskdefs.o methods.o raw_dataCache.o mem.o
+                                         taskdefs.o methods.o mem.o raw_dataCache.o raw_interrupt.o
                                          
 # this is for a multi-tile test
 include $(COMMONDIR)/Makefile.all
index 231ebb3b72675674217ffea1b87b77907e73e99a..4e557a1d1ccbd42182430705aee1bda98570998a 100644 (file)
@@ -2,18 +2,17 @@ TOPDIR=/home/jzhou/starsearch
 include $(TOPDIR)/Makefile.include
 
 RGCCFLAGS += -O2 
-RGCCFLAGS += -DTASK -DMULTICORE -DRAW -DINTERRUPT
+RGCCFLAGS += -DTASK -DMULTICORE -DRAW -DINTERRUPT -DY2
 
 SIM-CYCLES = 10000
 
 ATTRIBUTES += HWIC
 
 TILE_PATTERN = 4x2
-#INCLUDES += -I.
 
 OBJECT_FILES_COMMON = multicoretask.o multicoreruntime.o Queue.o file.o math.o object.o \
                                          GenericHashtable.o SimpleHash.o ObjectHash.o socket.o checkpoint.o\
-                                         taskdefs.o methods.o raw_dataCache.o mem.o
+                                         taskdefs.o methods.o mem.o raw_dataCache.o raw_interrupt.o
                                          
 # this is for a multi-tile test
 include $(COMMONDIR)/Makefile.all
index 3cc5b5938faaa568bba3e935ded9e6d94333b783..a2e5180b81ee0466b94f026ae5b15571b2c2473f 100644 (file)
@@ -2,18 +2,17 @@ TOPDIR=/home/jzhou/starsearch
 include $(TOPDIR)/Makefile.include
 
 RGCCFLAGS += -O2 
-RGCCFLAGS += -DTASK -DMULTICORE -DRAW -DINTERRUPT
+RGCCFLAGS += -DTASK -DMULTICORE -DRAW -DINTERRUPT -DY4
 
 SIM-CYCLES = 10000
 
 ATTRIBUTES += HWIC
 
 TILE_PATTERN = 4x4
-#INCLUDES += -I.
 
 OBJECT_FILES_COMMON = multicoretask.o multicoreruntime.o Queue.o file.o math.o object.o \
                                          GenericHashtable.o SimpleHash.o ObjectHash.o socket.o checkpoint.o\
-                                         taskdefs.o methods.o raw_dataCache.o mem.o
+                                         taskdefs.o methods.o mem.o raw_dataCache.o raw_interrupt.o
                                          
 # this is for a multi-tile test
 include $(COMMONDIR)/Makefile.all
diff --git a/Robust/src/Runtime/mem.c b/Robust/src/Runtime/mem.c
new file mode 100644 (file)
index 0000000..2de0dc9
--- /dev/null
@@ -0,0 +1,50 @@
+#include "mem.h"
+
+#ifdef RAW
+#include "runtime.h"
+#include <raw.h>
+
+/*void * m_calloc(int m, int size) {
+       void * p = malloc(m*size);
+       int i = 0;
+       for(i = 0; i < size; ++i) {
+               *(char *)(p+i) = 0;
+       }
+       return p;
+}*/
+
+void * mycalloc(int m, int size) {
+       void * p = NULL;
+       int isize = 2*kCacheLineSize-4+(size-1)&(~kCacheLineMask);
+       raw_test_pass(0xdd00);
+#ifdef INTERRUPT
+       // shut down interrupt
+       raw_user_interrupts_off();
+#endif
+       p = calloc(m, isize);
+       //p = m_calloc(m, isize);
+       raw_test_pass_reg(p);
+       raw_test_pass_reg((kCacheLineSize+((int)p-1)&(~kCacheLineMask)));
+#ifdef INTERRUPT
+       // re-open interruption
+       raw_user_interrupts_on();
+#endif
+       return (void *)(kCacheLineSize+((int)p-1)&(~kCacheLineMask));
+}
+
+void * mycalloc_i(int m, int size) {
+       void * p = NULL;
+       int isize = 2*kCacheLineSize-4+(size-1)&(~kCacheLineMask);
+       raw_test_pass(0xdd00);
+       p = calloc(m, isize);
+       //p = m_calloc(m, isize);
+       raw_test_pass_reg(p);
+       raw_test_pass_reg((kCacheLineSize+((int)p-1)&(~kCacheLineMask)));
+       return (void *)(kCacheLineSize+((int)p-1)&(~kCacheLineMask));
+}
+
+void myfree(void * ptr) {
+       return;
+}
+
+#endif
index 6542bdd2e0ae6de58ec087d68199e3db3a0f1a7e..e00c5e4f03f5f7b9de9728a90474502f292172d2 100644 (file)
@@ -18,7 +18,7 @@
 #ifdef RAW
 #include <raw.h>
 #include <raw_compiler_defs.h>
-#include <libints.h>
+//#include <libints.h>
 #elif defined THREADSIMULATE
 // use POSIX message queue
 // for each core, its message queue named as
@@ -201,8 +201,9 @@ int main(int argc, char **argv) {
 #ifdef INTERRUPT
        if (corenum < NUMCORES) {
        // set up interrupts
-       setup_interrupts();
-       start_gdn_avail_ints(recvMsg);
+       setup_ints();
+       //setup_interrupts();
+       //start_gdn_avail_ints(recvMsg);
        raw_user_interrupts_on();
        raw_test_pass(0xee04);
        }
diff --git a/Robust/src/Runtime/raw_dataCache.s b/Robust/src/Runtime/raw_dataCache.s
new file mode 100644 (file)
index 0000000..97230fa
--- /dev/null
@@ -0,0 +1,31 @@
+.text
+.global flushAddr
+.global invalidateAddr
+.global flushCacheline
+
+       
+flushAddr:
+# arguments come in on $4 and $5
+# $4 has the address
+# $5 has the length, eventually
+
+       afl $4, 0
+       jr    $31
+       
+
+invalidateAddr:
+# arguments come in on $4 and $5
+# $4 has the address
+# $5 has the length, eventually
+
+       ainv $4, 0
+       jr $31
+
+
+flushCacheline:
+# arguments come in on $4
+# $4 has the base tag address
+
+       tagfl $4
+       jr $31
+
diff --git a/Robust/src/Runtime/raw_interrupt.s b/Robust/src/Runtime/raw_interrupt.s
new file mode 100644 (file)
index 0000000..1581b4e
--- /dev/null
@@ -0,0 +1,82 @@
+#include <raw_asm.h>
+
+       .text
+       .align  2
+       .globl  setup_ints
+       .ent    setup_ints
+setup_ints:    
+       # run main program
+       # set up switch
+#      mtsri   SW_FREEZE, 1
+#      la      $8, __sw_main
+#      mtsr    SW_PC, $8
+#      nop
+#      mtsri   SW_FREEZE, 0
+       
+       # set up dynamic network
+       uintoff
+       intoff
+
+       # set gdn_cfg
+#   la $8, ((XSIZE-1)<<27)|((YSIZE-1)<<22)|(XOFF<<17)|(YOFF<<12)|(LOG_XSIZE<<9)
+       xor $8,$8,$8
+#ifdef Y1
+       aui $8,$8,(3<<11)|(0 <<6)|(0 <<1)
+       ori $8, (0 <<12)|(2<<9)
+#elif defined Y2
+       aui $8,$8,(3<<11)|(1 <<6)|(0 <<1)
+       ori $8, (0 <<12)|(2<<9)
+#elif defined Y4
+       aui $8,$8,(3<<11)|(3 <<6)|(0 <<1)
+       ori $8, (0 <<12)|(2<<9)
+#else
+       aui $8,$8,(3<<11)|(3 <<6)|(0 <<1)
+       ori $8, (0 <<12)|(2<<9)
+#endif
+       mtsr    GDN_CFG,$8
+#      mtsr    PASS,$8
+
+       # set exception vector
+    la $3, interrupt_table
+#      mtsri PASS, 0xaaa
+#      mtsr PASS, $3
+    mtsr EX_BASE_ADDR, $3
+
+       # set EX_MASK
+       mfsr    $8,EX_MASK
+       ori     $8,$8,0x20          # 1 << kVEC_GDN_AVAIL
+       mtsr    EX_MASK,$8
+
+       inton
+       uinton
+
+       .end    setup_ints
+
+
+.macro empty_vec fail_code
+        mtsri FAIL, \fail_code
+1:      b 1b
+        nop
+        nop
+.endm
+
+interrupt_table:
+
+vec_gdn_refill:
+        empty_vec 0x2300
+vec_gdn_complete:
+        empty_vec 0x2301
+vec_trace:
+        empty_vec 0x2302
+vec_extern:
+        empty_vec 0x2303
+vec_timer:
+        empty_vec 0x2304
+vec_gdn_avail:
+       sw      $2,-8($sp)
+#      la      $2,gdn_avail_handler
+#      jr      $2
+       jal recvMsg 
+vec_event_counters:
+        empty_vec 0x2306
+