Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Tweaks to remote memory access (still not quite right).

  • Loading branch information...
commit 73a2821324f38ba7c125267e9882401438f4fb78 1 parent bee84f7
James Hanlon authored February 06, 2012
4  system/xs1/builtins_remotemem.xc
... ...
@@ -1,7 +1,7 @@
1 1
 #define _RWRITE(destID, address, value) \
2 2
 do { \
3 3
   unsigned c; \
4  
-  GETR_CHANEND(c) \
  4
+  GETR_CHANEND(c); \
5 5
   SETD(c, destID << 16 | XS1_RES_TYPE_CHANEND); \
6 6
   OUTCT(c, XS1_CT_WRITE4); \
7 7
   OUT(c, address); \
@@ -13,7 +13,7 @@ do { \
13 13
 #define _RREAD(destID, address, value) \
14 14
 do { \
15 15
   unsigned c; \
16  
-  GETR_CHANEND(c) \
  16
+  GETR_CHANEND(c); \
17 17
   SETD(c, destID << 16 | XS1_RES_TYPE_CHANEND); \
18 18
   OUTCT(c, XS1_CT_READ4); \
19 19
   OUT(c, address); \
27  test/features/builtin_remotemem.sire
... ...
@@ -1,30 +1,29 @@
1  
-val location := NUM_CORES-1;
  1
+val N is NUM_CORES-1;
2 2
 
3  
-proc foo(chanend c) is
4  
-{ var v;
  3
+proc foo(val origin) is
  4
+{ chanend c;
  5
+  var v;
5 6
   var address[];
  7
+  connect c:0 to master origin;
6 8
   v := memalloc(address, 1);
7 9
   c ! address;
8 10
   c ? v;
9 11
   v := memfree(address)
10 12
 }
11 13
 
12  
-proc baz(chanend c) is
13  
-{ var v;
  14
+proc bar(val dest) is
  15
+{ chanend c;
  16
+  var v;
14 17
   var address;
  18
+  connect c:0 to slave dest;
15 19
   c ? address;
16  
-  rwrite(location, 0x20000, 0xDEADBEEF);
17  
-  rread(location, 0x20000, v);
  20
+  %rwrite(location, 0x20000, 0xDEADBEEF);
  21
+  rread(dest, 0x20000, v);
18 22
   %printhexln(v);
19 23
   %assert v = 0xDEADBEEF;
20  
-  c ! 0;
  24
+  c ! 0
21 25
 }
22 26
 
23  
-proc bar(chanend c) is
24  
-  on location do baz(c)
25  
-
26 27
 proc main() is
27  
-{ chan x;
28  
-  foo(x) || bar(x)
29  
-}
  28
+{ on N do bar(0) || foo(N) }
30 29
 

0 notes on commit 73a2821

Please sign in to comment.
Something went wrong with that request. Please try again.