Node 008
This node is a central node of SRAM controller.
Source code
008 sram control 17.531 a.awc
pages 0123 2556A , 2557A , 3556A , 3557A ,
!pg 04 @p drop !p ;
pg 05 -n 2556A page0 io b! ;
page 08 n b! @b !pg
we+ 0A pg 4 or !b
inc 0D r b! 12000 ad !b l b! ;
ad 10 r b! 5600 ad !b @ !b l b! ;
read 13 ad
rd 14 12000 read !b @b ! inc ;
+read 17 c push read zif ; then
begin 12000 read !b @b ! inc next ; 55ns
write 1F ad
wr 20 5603 write !b @ !b
we 23 pg !b we+ ;
+write 25 c push write zif ; then begin wr next ; 118ns 2B
init io b! 2557F !b left right over over over
over over over we+ down a! -d-- ; 37
5 d 0 0 ether
pages 0123 2556A , 2557A , 3556A , 3557A ,
!pg 04 @p drop !p ;
pg 05 -n 2556A page0 io b! ;
page 08 n b! @b !pg
we+ 0A pg 4 or !b
inc 0D r b! 12000 ad !b l b! ;
ad 10 r b! 5600 ad !b @ !b l b! ;
read 13 ad
rd 14 12000 read !b @b ! inc ;
+read 17 c push read zif ; then
begin 12000 read !b @b ! inc next ; 55ns
write 1F ad
wr 20 5603 write !b @ !b
we 23 pg !b we+ ;
+write 25 c push write zif ; then begin wr next ; 118ns 2B
init io b! 2557F !b left right over over over
over over over we+ down a! -d-- ; 37
5 d 0 0 ether
Definitions
- !pg
- Store page constant to pg.
- pg
- Select page.
- page
- Set new page n (0-4) in pg, which also sets CE and WE lines low, and fall through to
- we+
- Set page and WE signal high, then fall through to
- inc
- Call ad in node 009 and return.
- ad
- Send new address to node 009 and call ad to set this new address to address lines.
- read
- Set address, then fall through to
- rd
- Call read in node 007, read data back, send them DOWN and call inc to advance address pointer.
- +read
- Read c+1 words from SRAM consecutive locations. We use zif so we call read only for the first access.
- write
- Set address in node 009 and fall through to
- wr
- Send data to node 007 and call write there.
- we
- Set page and WE line high.
- +write
- Write c+1 words into consecutive memory locations.
- init
- Set page 0, CE and WE high, preset stack with left right, call we+ (not necessary; i think it was in the original code but adding 2557F !b makes it redundand - can be removed), set A to DOWN (where we get data and addresses from) and jump to DOWN.
Description
There are four constants for GPIO pins; drives pins 17 (a19) and 5 (a18) low or high to select page 0-3, pins 3 (we) and 1 (ce) low. The current page (constant) is set as the first word of pg.