ForthSeen - Alternative Embedded Systems - Blog

index - WwwFinds - Videos - Thoughts - NewLISP - GAS - GA - ColorForth - Breadboard - About


GAS144 - GA144 Simulator - Alpha Release

As promised I added some detailed explanations to the GAS144a documentation:

GAS144a-Documentation-Alpha-Release.pdf

Comments are welcome - send me an email to: Admin(at)dmemos.de

2014-Dec-30 19:30 – GAS, GA, NewLISP


GAS144 - GA144 Simulator - Alpha Release

As a small Christmas present - at least for myself - this is the first release of my Green-Arrays GA144 chip simulator in newLISP.
A proof of concept, it is possible to simulate one node with it.
The development is in progress and the first step towards a complete IDE for the GA144 :

GAS144a-Documentation-Alpha-Release.pdf

The source-files as text in zip-format: GAS144a.zip

2014-Dec-24 15:30 – GAS, GA, NewLISP


GA144 Disassembler Part4

While writing my own simulator I realized some special internals, which lead to a fault of my disassembler Part3.
Here my new disassembler version


; ga-disassembler-1-0.lsp dmemos 1.November.2014

( set 'F18cmd '(
";" "ex" "name;" "name" "unext" "next" "if" "-if" "@p" "@+"
"@b" "@" "!p" "!+" "!b" "!"
"+*" "2*" "2/" "not" "+" "and" "or" "drop" "dup" "pop"
"over" "a" "." "push" "b!" "a!" ))
; GA144 command-set

( define ( get-slot-commands x )
( set 'cmds '() )
( set 'x (^ 0x15555 x ))
( push (F18cmd (<< ( & 7 x) 2 ))cmds)
( push (F18cmd (>> ( & 0xF8 x)3))cmds)
( push (F18cmd (>> ( & 0x1F00 x)8)) cmds)
( push (F18cmd (>> ( & 0x3E000 x)13)) cmds))
; decode instruction-word into slot-commands
; call:( get-slot-commands 0x01dfa ), result:("@b" "@p" "and" ".")

( define ( get-jump-address x )
( case x
(0 ( set 'adr (& IREG 0x3FF)))
(1 ( set 'adr (& IREG 0xFF )))
(2 ( set 'adr (& IREG 7 )))
(true "jump in slot3 not possible" )))
; get address for jump-commands for different slots

( set 'hexdump '(
0x01dfa 0x02000 0x19408 0x04b02 0x00115 0x2f455 0x04bb2 0x0015d
0x3bdfa 0x1ffff 0x209f2 0x1b40f 0x05bb2 0x07530 0x11400 0x05bb2
0x00000 0x11400 0x3a8ef 0x00100 0x26cb2 0x11406 0x134a9 0x256aa 0x24D4A ))
; Example hexdump as test-input

; start of disassembly

( while ( < 0 ( length hexdump))
( set 'IREG ( pop hexdump )) ; read word from hexdump

( get-slot-commands IREG ) ; get raw commands-list

; delete commands after "ex" or ";"
( if ( set 'i ( find "ex" cmds)) ( set 'cmds ( 0 (++ i) cmds)))
( if ( set 'i ( find ";" cmds)) ( set 'cmds ( 0 (++ i) cmds)))

; count how many @p's are in the list
( set 'count@p 0 )
( dolist ( x cmds ) ( if ( = x "@p") (++ count@p )) )

; in case of jump command "name" or "name;" - get address
( set 'adr nil )
( if ( or (set 'i ( find "name" cmds)) ( set 'i ( find "name;" cmds)))
( begin ( get-jump-address i) ( set 'cmds ( 0 (++ i) cmds))))
( if adr ( push (format "0x%X" adr) cmds -1 ))

; print out command-list
( println (format "0x%X" IREG) ": " cmds )

; in case of "@p" commands - print literal
( while ( < 0 count@p )
( -- count@p )
( set 'x ( pop hexdump))
( println "literal: " x " = " (format "0x%X" x) ))
)



This is the result:


0x1DFA: ("@b" "@p" "and" ".")
literal: 8192 = 0x2000
0x19408: ("if" "ex")
0x4B02: ("@p" "b!" "@b" ".")
literal: 277 = 0x115
0x2F455: ("push" "ex")
0x4BB2: ("@p" "b!" "." ".")
literal: 349 = 0x15D
0x3BDFA: ("drop" "@p" "and" ".")
literal: 131071 = 0x1FFFF
0x209F2: ("over" "." "+" ".")
0x1B40F: ("-if" "ex")
0x5BB2: ("@p" "!b" "." ".")
literal: 30000 = 0x7530
0x11400: ("name;" "0x0")
0x5BB2: ("@p" "!b" "." ".")
literal: 0 = 0x0
0x11400: ("name;" "0x0")
0x3A8EF: ("drop" "push" "drop" "@p")
literal: 256 = 0x100
0x26CB2: ("pop" "pop" "." ".")
0x11406: ("name;" "0x6")
0x134A9: ("name" "0xA9")
0x256AA: ("dup" "name" "0xAA")
0x24D4A: ("dup" "dup" "name" "0x2")


Here is the original code in ArrayForth:


down is equal to 0x115 that could be a next improvement, inserting symbolic addresses like up and down .. maybe after my simulator.. Now the hexdump is even clearer to me.

For better understanding, the jump "address" is not used directly, but combined with the actual program counter:

This version of my disassembler as textfile: disassembler-1-0.lsp
If you download and open it with notpad++ you see the coloured syntax.

2014-Nov-01 19:00 – GA, NewLISP


GA144 Usage and Applications

Occasionally I'm talking about my new hobby, the GreenArrays and Chuck Moore's GA144 super chip, just yesterday with some colleagues and an university Professor at dinner. It's always the same - A count of 144 32-bit processors each having only 64 words of RAM and 64 words of ROM.. For what the heck do you need this? - what can you do with it ? is the normal reaction - That's exactly what I want to find out my answer.

Here are my thoughts about this GA144-project, as a beginner with this IC, but also as an electronics engineer with 28+ years of working experience in development:
A few weeks back in my holidays I read again two of my favourite books, one after the other, Paul Graham's Hackers & Painters and Carmine Gallo's The innovation secrets of Steve Jobs . At the same time I mused about the GA144. The whole chip is simple ingenious. What lacks is the continuation of the idea outside of the chip. A super simple and beautiful programming environment. What Paul Graham named as one or two more abstraction layers, above the FORTH-machine language, maybe something like LISP or the 100-year-Language. The IDE should be simple like LEGO, intuitive in operation, so that a 10 year old child could use it ..
I have a day job, a family and an old house, the reason why it will take some time, but this are roughly my plans:

2014-Sep-10 18:00 – GA, Thoughts, NewLISP


WwwFinds ..

Secrects of Frugality - GreenArrays Presentation on forth.org

Efficient Implementation of Cryptographic Primitives on the GA144 Multi-core Architecture

ga144tools - Python toolchain for GA144 - James Bowman on github

GA144 Running C - James Bowman on forth.org

The Python-Toolchain for the GA144 seems to be quite interesting, maybe it's a bit of sacrilege for a Forth purist ( not me ).
In contrast to the elegant simplicity of the GA144 chip, the current ArrayForth development environment is in my view the complete opposite, difficult for beginners to use and to understand - if at all.

If I would be unfaithful to my beloved newLISP, I would choose more mainstream, a Java based solution, maybe Clojure, an Android APP would be cool and a great advertisement - of course also for training as a simulator and perhaps even as a programming tool via USB-interface .. I should think about this...

2014-Sep-01 19:00 – GA, WwwFinds, Thoughts, NewLISP


GA144 Disassembler Part3

Now with the extension that after a line with a "@p" command a constant value is following:


; ga3.lsp dmemos 3.August.2014

( set 'F18cmd '(
";" "ex" "name;" "name" "unext" "next" "if" "-if" "@p" "@+"
"@b" "@" "!p" "!+" "!b" "!"
"+*" "2*" "2/" "not" "+" "and" "or" "drop" "dup" "pop"
"over" "a" "." "push" "b!" "a!" ))

; get bits from start to end of value x GA144: bit 17..0
( define ( get_bits x s e )
( set 'mask 0 )
( for ( i s e ) ( set 'mask ( | mask (<< 1 i ))))
( set 'out (>> ( & mask x ) s ))
)

; In the lowest slot3, no special considerations ( besides shifting bits left by 2)
; for slot0, slot1 and slot2 you have to consider this:
; "ex" and ";" in slot0..3 lock all lower slots, stops evaluating
; "name" and "name;" use lower slots as an address
( define ( x_commands xi xlst sb eb )
( set 'acmd ( F18cmd (get_bits i sb eb )))
( if ( or ( = acmd "ex" ) ( = acmd ";" )) ( set 'xlst '()))
( if ( or ( = acmd "name" ) (= acmd "name;"))
( begin ( set 'xadr ( format "0x%X" ( get_bits i 0 (-- sb) )))
( set 'xlst (list xadr))))
( push acmd xlst )
)

( define ( get_F18cmds i )
( set 'cmds '() )
( set 'i ( ^ i 0x15555))
( push ( F18cmd (<< (get_bits i 0 2) 2)) cmds )
( set 'cmds ( x_commands xi cmds 3 7 ))
( set 'cmds ( x_commands xi cmds 8 12 ))
( set 'cmds ( x_commands xi cmds 13 17 ))

( push (format "0x%X" (^ i 0x15555)) cmds )
; cmds
)

( set 'hexdump '(
0x01dfa 0x02000 0x19408 0x04b02 0x00115 0x2f455 0x04bb2 0x0015d
0x3bdfa 0x1ffff 0x209f2 0x1b40f 0x05bb2 0x07530 0x11400 0x05bb2
0x00000 0x11400 0x3a8ef 0x00100 0x26cb2 0x11406 0x134a9 ))

( set 'xout '() )
( dolist ( c hexdump )
( if (find "@p" xout)
( begin
( println (format " 0x%X = " c) c ) ; "@p" in last line
( set 'xout '() ))
( begin ; else normal command line
(set 'xout ( get_F18cmds c ))
( println xout ))))


This is the result:


("0x1DFA" "@b" "@p" "and" ".")
0x2000 = 8192
("0x19408" "if" "ex")
("0x4B02" "@p" "b!" "@b" ".")
0x115 = 277
("0x2F455" "push" "ex")
("0x4BB2" "@p" "b!" "." ".")
0x15D = 349
("0x3BDFA" "drop" "@p" "and" ".")
0x1FFFF = 131071
("0x209F2" "over" "." "+" ".")
("0x1B40F" "-if" "ex")
("0x5BB2" "@p" "!b" "." ".")
0x7530 = 30000
("0x11400" "name;" "0x155")
("0x5BB2" "@p" "!b" "." ".")
0x0 = 0
("0x11400" "name;" "0x155")
("0x3A8EF" "drop" "push" "drop" "@p")
0x100 = 256
("0x26CB2" "pop" "pop" "." ".")
("0x11406" "name;" "0x153")
("0x134A9" "name" "0x1FC")


Here is the original code in ArrayForth:

Now the hexdump is clearer PS: down is equal to 0x115

.. to be continued ..

2014-Aug-03 17:00 – GA, NewLISP


GA144 Disassembler Part2

Now with the extension that "ex" and ";" stops evaluating and the slots after "name" and "name;" are considered as an address.


; ga2d.lsp dmemos 2.August.2014

( set 'F18cmd '(
";" "ex" "name;" "name" "unext" "next" "if" "-if" "@p" "@+"
"@b" "@" "!p" "!+" "!b" "!"
"+*" "2*" "2/" "not" "+" "and" "or" "drop" "dup" "pop"
"over" "a" "." "push" "b!" "a!" ))

; get bits from start to end of value x GA144: bit 17..0
( define ( get_bits x s e )
( set 'mask 0 )
( for ( i s e ) ( set 'mask ( | mask (<< 1 i ))))
( set 'out (>> ( & mask x ) s ))
)

; In the lowest slot3, no special considerations ( besides shifting bits left by 2)
; for slot0, slot1 and slot2 you have to consider this:
; "ex" and ";" in slot0..3 lock all lower slots, stops evaluating
; "name" and "name;" use lower slots as an address
( define ( x_commands xi xlst sb eb )
( set 'acmd ( F18cmd (get_bits i sb eb )))
( if ( or ( = acmd "ex" ) ( = acmd ";" )) ( set 'xlst '()))
( if ( or ( = acmd "name" ) (= acmd "name;"))
( begin ( set 'xadr ( format "0x%X" ( get_bits i 0 (-- sb) )))
( set 'xlst (list xadr))))
( push acmd xlst )
)

( define ( get_F18cmds i )
( set 'cmds '() )
( set 'i ( ^ i 0x15555))
( push ( F18cmd (<< (get_bits i 0 2) 2)) cmds )
( set 'cmds ( x_commands xi cmds 3 7 ))
( set 'cmds ( x_commands xi cmds 8 12 ))
( set 'cmds ( x_commands xi cmds 13 17 ))

( push (format "0x%X" (^ i 0x15555)) cmds )
; cmds
)

( set 'hexdump '(
0x01dfa 0x02000 0x19408 0x04b02 0x00115 0x2f455 0x04bb2 0x0015d
0x3bdfa 0x1ffff 0x209f2 0x1b40f 0x05bb2 0x07530 0x11400 0x05bb2
0x00000 0x11400 0x3a8ef 0x00100 0x26cb2 0x11406 0x134a9 0x256aa 0x24D4A ))

( dolist ( c hexdump )
( println ( get_F18cmds c ) ))


This is the result:


("0x1DFA" "@b" "@p" "and" ".")
("0x2000" "@" "and" "@b" "+")
("0x19408" "if" "ex")
("0x4B02" "@p" "b!" "@b" ".")
("0x115" "@b" "+" "@p" ";")
("0x2F455" "push" "ex")
("0x4BB2" "@p" "b!" "." ".")
("0x15D" "@b" "+" "ex")
("0x3BDFA" "drop" "@p" "and" ".")
("0x1FFFF" "next" "@b" "and" "@p")
("0x209F2" "over" "." "+" ".")
("0x1B40F" "-if" "ex")
("0x5BB2" "@p" "!b" "." ".")
("0x7530" "@+" ";")
("0x11400" "name;" "0x155")
("0x5BB2" "@p" "!b" "." ".")
("0x0" "@b" "and" "@b" "+")
("0x11400" "name;" "0x155")
("0x3A8EF" "drop" "push" "drop" "@p")
("0x100" "@b" "+" "@b" "+")
("0x26CB2" "pop" "pop" "." ".")
("0x11406" "name;" "0x153")
("0x134A9" "name" "0x1FC")
("0x256AA" "dup" "name" "0xFF")
("0x24D4A" "dup" "dup" "name" "0x7")


The hex-dump is from the practical example from July 20th below.
Maybe you have mentioned that I added the last 2 own hex-codes to test slot1 and slot2 jumps.
I constructed this with a rudimentary GA144-assembler in newLisp :)
To be continued .. Next question is how I can recognize variables instead of commands ??

2014-Aug-02 18:00 – GA, NewLISP


GA144 Disassembler

There are different ways to learn a new system. I'm starting a disassembler for the GA144 - based on newLisp - a daring blend of FORTH and LISP :


; ga1d.lsp dmemos 2.August.2014

( set 'F18cmd '(
";" "ex" "name;" "name" "unext" "next" "if" "-if" "@p" "@+"
"@b" "@" "!p" "!+" "!b" "!"
"+*" "2*" "2/" "not" "+" "and" "or" "drop" "dup" "pop"
"over" "a" "." "push" "b!" "a!" ))


; get bits from start to end of value x GA144: bit 17..0
( define ( get_bits x s e )
( set 'mask 0 )
( for ( i s e ) ( set 'mask ( | mask (<< 1 i ))))
( set 'out (>> ( & mask x ) s ))
)

( define ( get_F18cmds i )
( set 'cmds '() )
( set 'i ( ^ i 0x15555))
( print (format "0x%x" i ) "|" )
( push ( F18cmd (<< (get_bits i 0 2) 2)) cmds)
( print cmds "|" )
( push ( F18cmd (get_bits i 3 7)) cmds)
( print cmds "|" )
( push ( F18cmd (get_bits i 8 12)) cmds)
( push ( F18cmd (get_bits i 13 17)) cmds)
( push (format "0x%X" (^ i 0x15555 ) ) cmds )
cmds
)

( set 'hexdump '(
0x01dfa 0x02000 0x19408 0x04b02 0x00115 0x2f455 0x04bb2 0x0015d
0x3bdfa 0x1ffff 0x209f2 0x1b40f 0x05bb2 0x07530 0x11400 0x05bb2
0x00000 0x11400 0x3a8ef 0x00100 0x26cb2 0x11406 0x134a9 ))

( dolist ( c hexdump )
( println ( get_F18cmds c ) ))


This is the result:


("0x1DFA" "@b" "@p" "and" ".")
("0x2000" "@" "and" "@b" "+")
("0x19408" "if" "ex" "@" "+")
("0x4B02" "@p" "b!" "@b" ".")
("0x115" "@b" "+" "@p" ";")
("0x2F455" "push" "ex" ";" ";")
("0x4BB2" "@p" "b!" "." ".")
("0x15D" "@b" "+" "ex" ";")
("0x3BDFA" "drop" "@p" "and" ".")
("0x1FFFF" "next" "@b" "and" "@p")
("0x209F2" "over" "." "+" ".")
("0x1B40F" "-if" "ex" "@" "@p")
("0x5BB2" "@p" "!b" "." ".")
("0x7530" "@+" ";" "!p" "+")
("0x11400" "name;" "ex" "@b" "+")
("0x5BB2" "@p" "!b" "." ".")
("0x0" "@b" "and" "@b" "+")
("0x11400" "name;" "ex" "@b" "+")
("0x3A8EF" "drop" "push" "drop" "@p")
("0x100" "@b" "+" "@b" "+")
("0x26CB2" "pop" "pop" "." ".")
("0x11406" "name;" "ex" "@b" "!p")
("0x134A9" "name" "ex" "a!" "+*")
("0x134A9" "name" "ex" "a!" "+*")


This is the second version, after I saw, that the bits in the last slot must be shifted-left by 2 .
Now there's the next step necessary, after a jump command like ex the rest of the slots are meaningless .. I'm learning :)

2014-Aug-02 09:00 – GA, NewLISP


To-TOP