GAS144 - GA144 Simulator - Alpha Release
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
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
- only the commands are x-or'd with 0x15555
- the jump addresses are not x-ored and taken directly
- more than one @p can lead to more than one following literal words
; 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:
For better understanding, the jump "address" is not used directly, but combined with the actual program counter:
- slot0 jumps: bit0 to bit9, the 10 least-significant-bits, set the complete 10bits of the program counter, all targets are in reach, also the I/O space and other nodes
- slot1 jumps: bit0 to bit7, the 8 lsb are replacing the lsb of the program counter, P8 forced to 0, no I/O space in reach
- slot2 jumps: bit0 to bit2, the 3 lsb are replacing the lsb of programm counter, P8 forced to zero, no I/O space
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
- A controller system stripped to the minimum
- .. by the way maybe you could leave out one or the other command :)
- I like the asynchronous design
- I like the minimal power consumption
- I like that there is no interrupt
- I like the simplicity - you can have the whole system in your head
- I like the higher reliability and robustness within a smaller system
- I like the whole FORTH idea
- .. it would be great to reduce current software to 1% of the size .. and more
- It's like LEGO you have some simple parts .. discover the possibilities
- .. you can build your own peripherals by demand
- .. you can build parallel peripherals
- .. you can build self-modifying and optimizing systems
- The future prospects and the potential are great, too ..
- .. you can make it smaller down to a few processors, super small like dust
- .. you could put thousands of processor in parallel if necessary
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:
- Understanding and testing the GA144
- Writing a first abstraction layer - maybe in newLISP
- .. a simulator - dto.
- .. a profiler - dto.
- .. a function library
- Writing a second abstraction layer ..
- .. maybe a graphical interface
- .. in Java or Clojure
- .. as an APP for Anroid
- At best a bit of everything in parallel .. ;)
2014-Sep-10 18:00 – GA, Thoughts, NewLISP
WwwFinds ..
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
; 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:
2014-Aug-03 17:00 – GA, NewLISP
GA144 Disassembler Part2
; 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
; 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