fibonacci tested rc1, 107 cycles, 1k2le, 57MHz
[calu.git] / cpu / src / r_w_ram_b.vhd
index 1bbf460d73197714ee6f4904b974c42463e2b31d..fa01d93b0dfd11a77b06eec9fea8fe634017b345 100644 (file)
@@ -14,56 +14,59 @@ architecture behaviour of r_w_ram is
 
        signal ram : RAM_TYPE := (
 
-       0 => "11101101000000000000000000000000",
-       1 => "11101101001000000000000000000000",
-       2 => "11100111101000000000000000000000",
+       0 => "11101101000000000000000000000000",        --ldi
+       1 => "11101101001000000000000000000000",        --ldi
+       2 => "11100111101000000000000000000000",        --stw
        3 => "11100001000000000000000000100001",
-       4 => "11101100100000000000010000000000",
+       4 => "11101100100000000000001100000000",
        5 => "00001011011111111111111010000011",
-
-6 => x"ed080048",      --;ldi r1, 9;;
-7 => x"ed500080",      --;ldil r10, list@lo ;; global pointer
-8 => x"fd500002",      --;ldih r10, list@hi;;
-9 => x"eb000107",      --;call+ fibcall;;
-10 => x"eb7ffe03",     --;br+ main;;
-               --2; fib(n) {
-               --2;   if (list[n] > 0) {
-               --2;    return list[n]
-               --2;   }
-               --2;   a = fib(n-1)
-               --2;   list[n] = a + list[n-2]
-               --2;   return list[n]
-               --2; }
-               --3;fibcall;
-               --2;update counter for aligned access
-11 => x"e5088800",     --;lls r1, r1, 2 ;; *4
-               --2;calculate adress of top element
-12 => x"e0150800",     --;add r2, r10, r1;;
-               --3;fibmem;
-               --2;load top element
-13 => x"e7010000",     --;ldw r0, 0(r2);;
-               --2;compare if set
-14 => x"ec800000",     --;cmpi r0, 0;;
-               --2;return if set
-15 => x"0b000008",     --;retnz-;;
-               --2;decrement adress for next lopp
-16 => x"e1910020",     --;subi r2, r2, 4;;
-               --2;iterative call for n-1 element
-17 => x"eb7ffe07",     --;call+ fibmem;;
-               --2;load n-2 element
-18 => x"e7197ffc",     --;ldw r3, 0-4(r2);;
-               --2;add n-1 and n-2 element
-19 => x"e0018000",     --;add r0, r3, r0;;
-               --2;increment address for n element
-               --2;is needed because after return
-               --2;we need r2 to be set to the address
-               --2;of element n
-20 => x"e1110020",     --;addi r2, r2, 4;;
-               --2;store fib n
-21 => x"e7810000",     --;stw r0, 0(r2);;
-22 => x"eb00000a",     --;ret+;;
-
-                                  
+       6 => "11101101000000000000000000001000",
+       7 => "11100111100000000000000000001111",
+       8 => "11100111100000000000000000010011",
+
+       9 => x"ed080048",       --;ldi r1, 9;;
+       10 => x"ed500080",      --;ldil r10, list@lo ;; global pointer
+       11 => x"fd500002",      --;ldih r10, list@hi;;
+       12 => x"eb000107",      --;call+ fibcall;;
+       --13 => x"eb7ffe03",    --;br+ main;;
+       13 => "11101011000000000000000000000010",       -- endless loop --2; fib(n) {
+                       --2;   if (list[n] > 0) {
+                       --2;    return list[n]
+                       --2;   }
+                       --2;   a = fib(n-1)
+                       --2;   list[n] = a + list[n-2]
+                       --2;   return list[n]
+                       --2; }
+                       --3;fibcall;
+                       --2;update counter for aligned access
+       14 => x"e5088800",      --;lls r1, r1, 2 ;; *4
+                       --2;calculate adress of top element
+       15 => x"e0150800",      --;add r2, r10, r1;;
+                       --3;fibmem;
+                       --2;load top element
+       16 => x"e7010000",      --;ldw r0, 0(r2);;
+                       --2;compare if set
+       17 => x"ec800000",      --;cmpi r0, 0;;
+                       --2;return if set
+       18 => x"0b000008",      --;retnz-;;
+                       --2;decrement adress for next lopp
+       19 => x"e1910020",      --;subi r2, r2, 4;;
+                       --2;iterative call for n-1 element
+       20 => x"eb7ffe07",      --;call+ fibmem;;
+                       --2;load n-2 element
+       21 => x"e7197ffc",      --;ldw r3, 0-4(r2);;
+                       --2;add n-1 and n-2 element
+       22 => x"e0018000",      --;add r0, r3, r0;;
+                       --2;increment address for n element
+                       --2;is needed because after return
+                       --2;we need r2 to be set to the address
+                       --2;of element n
+       23 => x"e1110020",      --;addi r2, r2, 4;;
+                       --2;store fib n
+       24 => x"e7810000",      --;stw r0, 0(r2);;
+       25 => x"eb00000a",      --;ret+;;
+
+-- 1 1 2 3 5 8 13 21 34        55                         
 
 
                                  others => x"F0000000");