▄▄▄▄· ▪ ▄▄▄▄▄▄▄▌ ▄▄ • ▐█ ▀█▪██ •██ ██• ▪ ▐█ ▀ ▪ ▐█▀▀█▄▐█· ▐█.▪██▪ ▄█▀▄ ▄█ ▀█▄ ██▄▪▐█▐█▌ ▐█▌·▐█▌▐▌▐█▌.▐▌▐█▄▪▐█ ·▀▀▀▀ ▀▀▀ ▀▀▀ .▀▀▀ ▀█▄▀▪·▀▀▀▀
2014/12/24 Oguz Meteer // guztech
The GA144 chip by GreenArrays is outlandish in a total lot of solutions:
- It has 144, 18-bit cores.
- It’s miles asynchronous, so there is now not any clock.
- It’s miles programmed in Forth, and GreenArrays provides colorForth, a version of arrayForth particularly for the GA144.
Even supposing there is ample documentation, getting started with this chip can nonetheless be rather daunting. There are just a few tutorials on the on-line, but they’re written for older variations of arrayForth and extinguish no longer work with essentially the most up-to-date version. Critical data is unfolded at some stage within the documentation, so judge over again if you rob to desire to launch with the GA144 fleet. Especially when or no longer you should program the chip with an IDE that appears to be love this:
Perform no longer dismay then over again, as I will uncover on this post how one can write a Good day World instance and salvage it working on the simulator, with emphasis on the final fragment as I will no longer rush into essential factors of the chip works. I extinguish search info from you to bag some journey with Forth and its stack essentially based fully nature. Also, please read the arrayForth user manual because it’s very precious for getting a sense for arrayForth. Extra hyperlinks to inviting data about the GA144 might possibly presumably additionally be found on the extinguish of this post (highly beneficial!).
Ought to you first launch arrayForth, you are greeted with the next cloak:
One thing that you just can additionally nonetheless learn about arrayForth is that it uses a reveal keyboard structure for entering rather a bunch of kinds and colours of syntax (therefore colorForth). On web page 13, chapter 3 of the arrayForth user manual, that you just can additionally obtain the structure oldschool whereas you are within the editor. Prior to we launch writing our Good day World instance, we desire to clutch how reminiscence is organized, where we set our code, which nodes jog which block of code, etc.
Memory in arrayForth is organized in 1400 blocks, some which own machine application such because the compiler and simulator, whereas others own instance code or are merely empty. A summary of how reminiscence blocks are organized might possibly presumably additionally be found on web page 18, chapter 4 of the arrayForth user manual, whereas an broad overview might possibly presumably additionally be found within the
EVB001-02b.html file located within the installation folder. We are going to search that blocks 840 to 1078 might possibly presumably additionally be oldschool to store user
code. Impart that it’s no longer 1079 because handiest even numbered blocks can own code, whereas uneven numbered blocks are oldschool to store user feedback.
The GA144 chip contains 144 F18 laptop programs in a grid of 18×8:
Each laptop, called a node, has an identifier that starts with 000 for the backside left node and ends with 717 for the cease moral node. Each node is attached to its neighbor nodes. The outermost nodes are linked to the out of doors world, either in the present day, or by peripherals equivalent to UART, SPI, ADC, etc. Attributable to this truth, or no longer you should carefully concept the structure of your application.
Now that all individuals knows a small about the GA144, let’s write our first portion of code that performs the next calculation:
3(x+1). We are going to say our code at block 860, which lies within the assign that’s available for user code.
This opens up the editor and greets us with an empty block:
Kind the next:
Your cloak might possibly presumably additionally nonetheless now explore love this (backside fragment is brushed off):
If assembly, then you definately will sign the yellow 0 org fragment. No subject comes after that might possibly be placed at reminiscence situation 0 and up. The blue br is an editor repeat that’s no longer compiled into executable code, but rather tells the editor to insert two contemporary traces. If it became cr, then handiest one line contemporary line would were added. Subsequent up, we are succesful of define three words (functions if you’ll be succesful to): setup, calc, and mul.
- setup will give the variable x in our formulation
3(x+1)a designate and store it in register a.
- calc will retrieve the worth in register a, add one to it, and multiply it by three.
- mul is a feature that performs the 18-bit multiplication because the F18 laptop doesn’t bag a single multiply instruction. For more data, compare the very supreme post about multiplication by Ashley Nathan Feniello.
Let’s first code the mul be conscious:
a! 0 17 for + unext drop drop a ;
Subsequent up is the calc be conscious:
a 1 + 3 mul ;
The closing be conscious is setup:
4 a! calc ; br
In this case, I even bag chosen x = 4, which might possibly well lead to just a few(4+1) = 15 = 0x0F in hex. We are nearly performed! Final fragment of our Good day World instance is to be certain that the entry level of our program (setup) is known as when a node is loaded with our code. We are going to role it love this:
0a9 org setup ;
Thıs provides us the final line of our code, and places the entry existing our code at take care of 0xA9 where setup will be called.
Now press assign to exit of modifying mode (you’ll be succesful to search that the crimson 860 within the backside moral will flip grey). Our code wants be compiled, which might possibly presumably additionally be performed by typing compile and pressing assign. You might possibly well presumably presumably additionally assign the say of all 1400 blocks with the “assign” be conscious (form assign and assign).
So we bag written code, but how will we salvage it into one of many nodes? Here’s the fragment that’s no longer as much as this level if you explore at rather a bunch of, older tutorials, and it’s additionally no longer very properly documented. Block 200 contains directions to load code blocks onto nodes, and this is where we are succesful of load our code. First commerce all directions which might possibly well be no longer white or blue to white (which might possibly well be feedback). You might possibly well presumably presumably extinguish that by placing the cursor within the assist of the instruction/number and pressing a till it turns white.
We are going to be placing the loading directions after the first line:
node 860 load br
This line selects node 404, and loads block 860 in it. How it appears to be:
The cause we say this in block 200 is since the softsim simulator, which resides within arrayForth (blocks 148-150), first sets up the simulator (block 148) and loads application code saved in block 200 (block 150).
You might possibly well presumably presumably repeat this step if you rob to desire to say the identical block in any other node (working the identical code in parallel), or if you rob to desire to load any other code block in any other node. If we had been to jog the simulator now, we’d search that node 404 is suspended and doesn’t extinguish any code. To be certain the node starts with the program counter pointing on the moral entry level, we desire to alter block 216. This block contains the configuration and testsbeds for the simulator.
Begin up block 216:
And add the next code sooner than the road that starts with the comment “rom write check 200 +node 13 /p,”:
0a9 404 enter br
Block 216 now appears to be love this:
Now the moral entry level for node 404 has been role, and we’re ready to jog our code within the simulator!
Kind so (or softsim) en press assign to launch the simulator.
Web divulge 33, chapter 7 of the arrayForth user manual explains how the simulator works, but I’ll give a rapid rationalization.
On the cease moral, there is an 18 by 8 grid representing all nodes of the GA144. A inexperienced symbol represents a node that’s working and a gray one methodology that the node is suspended. In the occasion you assign no longer need modified block 216 as defined above, node 404 (5th from the left and 4th from above) would be grey because it would no longer jog our Good day World instance.
There might possibly be additionally a crimson and a yellow X, which signify the “focal level” node and the “rather a bunch of” node respectively. On the backside moral, the reminiscence contents of the level of pastime node is confirmed. In the occasion you press the “/” key, then the cease moral will be changed with the reminiscence contents of the “rather a bunch of” node. Here’s precious if that that you just can presumably bag two nodes the focus on with each rather a bunch of.
The left half of the cloak displays the inner say of nodes, equivalent to register contents. This grid of 8 by 4 nodes is marked by a blue rectangle within the grid overview on the cease moral, and might possibly presumably additionally additionally be moved to acquire the nodes that we’re drawn to. An instance of the inner say of a node:
From top to backside:
- Node number (grey), com port take care of (white)
- Slot number (white), opcode title (inexperienced)
- Instruction register (white)
- Memory timer (inexperienced), program counter (white)
- A, A register (white)
- B, B register (white)
- IO, IO register (cyan)
- R, top of the return stack (crimson)
- T, top of info stack (inexperienced)
- S, 2d on the data stack (inexperienced)
- @ represents a conversation port that’s being oldschool
Operating our code
If we say the crimson X on node 404, and adjust the blue rectangle to embrace node 404, we are succesful of search what occurs with the node that we’re attempting to jog our instance on:
If we step by the code by pressing n repeatedly, we are succesful of search that node 404 executes our code:
Under I will almost in the present day uncover what occurs chronologically. First, the reminiscence take care of is acknowledged, and next is a numbered list of directions that correspond to instruction slots (search the F18 Abilities Reference represent for more data).
- soar to 0xA
- set the worth saved in 0xB (which is 4) on the stack
- store the cease of the stack in register A
- soar to 0x6
- set the worth saved in register A on the stack
- set the worth saved in 0x7 (1) on the stack
- designate addition
- set the worth saved in 0x8 (3) on the stack
- soar to 0x0
- store the cease of the stack in register A
- set the worth saved in 0x1 (0) on the stack
- set the worth saved in 0x2 (0x11 = 17) on the stack
- store the cease of the stack on the cease of the return stack
- designate a step multiply
- skip to the next instruction if the return stack is 0, else rush assist to the old slot
- drop the worth saved on top of the data stack
- drop the worth saved on the cease of the data stack
- set the worth saved in register A on the stack
When the final instruction has performed, we are succesful of search that the worth 0xF or 15 in decimal on the cease of the stack, confirming that our instance works because it ought to be! I hope that this post will assist filling within the blanks after studying the GreenArrays documentation.
Ashley Nathan Feniello has written a total lot of very supreme weblog posts on the GA144:
Web website online of Chuck Moore (inventor of Forth and co-founder/CTO of GreenArrays):
F18 instruction role:
Performing arithmetic on the F18:
NOW WITH OVER +8500 USERS. participants can Be half of Knowasiak free of payment. Designate in on Knowasiak.com