X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=cpu%2Fsrc%2Fr_w_ram_b.vhd;fp=cpu%2Fsrc%2Fr_w_ram_b.vhd;h=1bbf460d73197714ee6f4904b974c42463e2b31d;hb=0c7231e471031c7d03f241dc4970b622fc64c695;hp=204479e232738d676b936447598f5314bdb52cf1;hpb=3d489ff42261e4d7c23b1877b95c0581c7691369;p=calu.git diff --git a/cpu/src/r_w_ram_b.vhd b/cpu/src/r_w_ram_b.vhd index 204479e..1bbf460 100644 --- a/cpu/src/r_w_ram_b.vhd +++ b/cpu/src/r_w_ram_b.vhd @@ -13,11 +13,19 @@ architecture behaviour of r_w_ram is -- r0 = 0, r1 = 1, r2 = 3, r3 = A signal ram : RAM_TYPE := ( -0 => x"ed080048", --;ldi r1, 9;; -1 => x"ed500080", --;ldil r10, list@lo ;; global pointer -2 => x"fd500002", --;ldih r10, list@hi;; -3 => x"eb000107", --;call+ fibcall;; -4 => x"eb7ffe03", --;br+ main;; + + 0 => "11101101000000000000000000000000", + 1 => "11101101001000000000000000000000", + 2 => "11100111101000000000000000000000", + 3 => "11100001000000000000000000100001", + 4 => "11101100100000000000010000000000", + 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] @@ -28,32 +36,32 @@ architecture behaviour of r_w_ram is --2; } --3;fibcall; --2;update counter for aligned access -5 => x"e5088800", --;lls r1, r1, 2 ;; *4 +11 => x"e5088800", --;lls r1, r1, 2 ;; *4 --2;calculate adress of top element -6 => x"e0150800", --;add r2, r10, r1;; +12 => x"e0150800", --;add r2, r10, r1;; --3;fibmem; --2;load top element -7 => x"e7010000", --;ldw r0, 0(r2);; +13 => x"e7010000", --;ldw r0, 0(r2);; --2;compare if set -8 => x"ec800000", --;cmpi r0, 0;; +14 => x"ec800000", --;cmpi r0, 0;; --2;return if set -9 => x"0b000008", --;retnz-;; +15 => x"0b000008", --;retnz-;; --2;decrement adress for next lopp -10 => x"e1910020", --;subi r2, r2, 4;; +16 => x"e1910020", --;subi r2, r2, 4;; --2;iterative call for n-1 element -11 => x"eb7ffe07", --;call+ fibmem;; +17 => x"eb7ffe07", --;call+ fibmem;; --2;load n-2 element -12 => x"e7197ffc", --;ldw r3, 0-4(r2);; +18 => x"e7197ffc", --;ldw r3, 0-4(r2);; --2;add n-1 and n-2 element -13 => x"e0018000", --;add r0, r3, r0;; +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 -14 => x"e1110020", --;addi r2, r2, 4;; +20 => x"e1110020", --;addi r2, r2, 4;; --2;store fib n -15 => x"e7810000", --;stw r0, 0(r2);; -16 => x"eb00000a", --;ret+;; +21 => x"e7810000", --;stw r0, 0(r2);; +22 => x"eb00000a", --;ret+;;