etherforth_logo

Node 108

This node converts 18-bit GA144 words into 16-bit SRAM words and back, and performs read and write functions. Note that it runs in multiport execution so any of the three neighboring nodes (107, 208, and 109) can call this node's code.

Source code

sram node 208 node 107 node 109 node 008 node 108
108 18-bit
9/8 00 cj-c ! dup 1 . + dup 2/ 2/ 2/ . + -1 . + !
@b a ! 2/ 2/ 2/ ;
rd 08 @ 7 for 2* 2* push @ pop a! pop dup push
7 or dup push for +* +* unext a !b
begin 2* 2* unext down a! next ;
+read 16 c pop b! 5617 +read 9/8 for rd next ;
wr 1D dup or dup 7 for a! @b over over pop dup push
for +* . +* unext drop a 2/ 2/ down a! ! drop next 2/ 2/ ! ;
+write 2A c pop b! 5625 +write 9/8 for wr next ; 31

init down a! 5608 page ! 0 ! r-lu ; 37

4 d 0 0 ether

Definitions

9/8
Convert number of 18-bit words c we want to read from/write to SRAM into number of 16-bits words (less one) needed. Then send the result to node 008 and execute instruction word j (@p call) in node 008. Convert number of 18-bit words c into number of 8-tuplets c. Therefore, data can be stored in multiples of 8 18-bit words only. Then we read first address in SRAM and send it to node 008.
rd
Fetch first 16-bit word, run 8 loops, shift the word 2 bits left, read another word from SRAM, concatenate using +* +* instructions, send 18-bit word from A out, shift the rest after concatenation left so that bits 17 and 16 are zero, and repeat with another 16-bit word. Do this for 8 cycles.
+read
Pop address of the port we are called from (focus call) and store in B so we know where to send data read form SRAM. Then send number of 16-bit words to node 8 and call +read there. Word 9/8 leaves number of times (less one) we call rd. Return from +read to multiport execution.
wr, +write
Work in a similar fashion as rd and +read. Nop in wr is relevant due to carry propagation; this is not an issue in rd as T is never added to S. Chuck is indeed a genius! See Evalblog for details.
init
Set A to point to node 008, call @p page and set page zero. Then jump back to multiport execution. Thus, any node of 107, 208, 109 can access SRAM.

Description

Note that if we want to access another page we have to change it first but this feature is not used in etherforth.