Shop OBEX P1 Docs P2 Docs Learn Events
Tachyon for Idiots — Parallax Forums

Tachyon for Idiots

OK... so exactly how do I load Tachyon onto a P123A9?

Comments

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2019-07-09 02:19
    You just did..... TAQOZ is part of the ROM that's built into the latest FPGA image. Just type the 3 characters "> space escape" and you will autobaud into TAQOZ.
    BTW, I'm assuming you have loaded FPGA images before.

    If you want the extended RAM version then you can use pnut or p2asm/loadp2 to compile and load the kernel and thereafter have that TAQOZ compile all the modules. I will post some instructions regarding this shortly.

    EDIT: I dug out my CVA9 board with the latest ROM I used for testing, just to double check. Fired up minicom (I used 921600 baud) and entered > space escape and hey presto.
    Cold start                                                
    -------------------------------------------------------------------------------
      Parallax P2  .:.:--TAQOZ--:.:.  V1.1--v33h         190219-1900
    -------------------------------------------------------------------------------
    TAQOZ#
    

    Then I type "lsio" at the prompt to list the I/O pin status.
    TAQOZ# lsio ---                                             
    P:00000000001111111111222222222233333333334444444444555555555566
    P:01234567890123456789012345678901234567890123456789012345678901
    =:d~~~~~~~~~~~~~~~~~~~~~~~~~~~d~~ddd~~hhhdhd~ddd~d~dhdhhdd~~~~~~ ok
    TAQOZ#
    

    The " -- " is inserted once the line is accepted when you hit enter and its sole purpose is to make it clear that what's on the left of this is user input and what's on the other side is the response, otherwise copy&paste as an example will be confusing for anyone else reading as to what was typed.

    Then reinserted the card that was in it.
    TAQOZ# mount --- 'PHSD04G 6269_0201 P2 CARD    32k 3,772M ok
    TAQOZ# DIR ---                                              
    'PHSD04G 6269_0201 P2 CARD    32k 3,772M
    ROOTDIR      $0000_26FE   1980.00.00.00.00   0
    P2      .ROM $0000_27BE   1980.00.00.00.00   65,536
    FILES        $0000_283E   2019.02.25.14.01   0
     ok
    TAQOZ#
    

    TAQOZ in ROM is a good place to start with learning to use TAQOZ and using it to test and explore hardware is what it is really good at.

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2019-07-09 12:00
    Here's a simple and practical exercise in bit bashing serial data with TAQOZ. You can even do this from the ROM although it uses RCFAST but if you have a scope you can see the data or better still, hook up a shift register and LEDs. Do you need a load pulse for the hardware? Figure that out yourself :)

    This is the exercise which is a mix of code typed on the console and comments which is mostly copy'n'pastable.
    { 	SHIFTING BITS OUT SERIALLY
    Simple unoptimised 8-bit serial shift out using bit bashing
    This one simply sends lsb first
    
    Before we start let's make it easier to copy and paste code that still has
    the console TAQOZ# prompt which otherwise would result in an error.
    Just create a dummy word (definition) of the same name that does nothing
    }
    
    : TAQOZ# ;
    
    { good, now TAQOZ won't throw an error when the user includes the prompt itself }
    TAQOZ# TAQOZ# ---  ok
    TAQOZ#
    
    { If you are using the ROM version then it won't know PIN! so we define it now }
    : PIN! ( data pin -- )	SWAP 1 AND IF HIGH ELSE LOW THEN ;
    
    ( COPY START )
    --- define our clock and data out pins as constants
    32 := CLK
    33 := DATA
    
    --- define a SHIFT_OUT routine that loops through 8 bits setting the data line and pulsing the clock
    : SHIFT_OUT ( send -- )  CLK LOW 8 FOR DUP DATA PIN! CLK HIGH CLK LOW 2/ NEXT DROP ; 
    ( COPY END )
    
    { if you are using the RAM version with DECOMP.FTH loaded we can SEE the code it generated }
    TAQOZ# SEE SHIFT_OUT
    
    ( this next section has stack and comments added to the listing assuming we passed a value of $43 to it)
    				STACK>TOP	COMMENT
    				$43
    E04E: pub SHIFT_OUT				Name in dictionary points to code at $5D86
    5D86: 5D3C     CLK		$43 32      Just make sure clock is low before we start
    5D88: 017E     LOW		$43
    5D8A: F808     8		$43 8
    5D8C: 0118     FOR		$43
    5D8E: 006E       DUP		$43 $43
    5D90: 5D42       DATA		$43 $43 33
    5D92: 0178       PIN!		$43		Write lsb of $43 to P33 (set data high or low)
    5D94: 5D3C       CLK		$43 32
    5D96: 017C       HIGH		$43		Set P32 (CLK) HGIH
    5D98: 5D3C       CLK		$43 32
    5D9A: 017E       LOW		$43		Set P32  (CLK) LOW
    5D9C: 009C       2/		$21 		Shift right (or unsigned /2) to position next bit
    5D9E: 0127     NEXT		$21		Decrement FOR counter and continue looping until count=0 (= DJNZ)
    5DA0: 0065     DROP				Discard used send data
    5DA2: 004D     ;				EXIT and return
          30 bytes
     ---  ok
    TAQOZ#
    
    {
    Using the same SHIFT_OUT routine we can modify it to reveal the stack contents just before it writes the data.
    In this case we create a word that is specific for this that will print out the top three stack items as 16-bits
    To make it easier to read we start each iteration on a new line with the current loop index (not the count)
    Forth normally uses the word PICK to pick an indexed stack item but TAQOZ only has direct access to the top
    four items which are held in fixed registers, so it is easier to say 4th 3rd and rather than 2nd and 1st
    we use OVER and DUP since these are the standard Forth words.
    }
    
    ( COPY START )
    TAQOZ# : REVEAL  CRLF I . SPACE 3RD .W SPACE OVER .W SPACE DUP .W SPACE ; ---  ok
    TAQOZ# : SHIFT_OUT ( send -- )  CLK LOW 8 FOR DUP DATA REVEAL PIN! CLK HIGH CLK LOW 2/ NEXT DROP ; ---  ok
    ( COPY END )
    
    { Now when we run it we can see the top of the stack on the right, same as the notation
    So it prints out the stack as 3rd 2nd 1st
    }
    TAQOZ# $43 SHIFT_OUT ---
    0 $0043 $0043 $0021
    1 $0021 $0021 $0021
    2 $0010 $0010 $0021
    3 $0008 $0008 $0021
    4 $0004 $0004 $0021
    5 $0002 $0002 $0021
    6 $0001 $0001 $0021
    7 $0000 $0000 $0021  ok
    TAQOZ#
    

    EDIT: fixed an error in the listing
  • AwesomeCronkAwesomeCronk Posts: 1,055
    edited 2019-07-09 12:17
    So, how would someone boot taqoz on a p1, using a standard Parallax board? What hardware connections are needed?
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2019-07-09 12:32
    So, how would someone boot taqoz on a p1, using a standard Parallax board? What hardware connections are needed?

    Click the link in my sig to download the latest binary and then F11 that in via Prop tool or BST. Hookup a terminal set to 115200k and hit ^C (control+C) to get it to reset again so you can see what it says.

    If you have color enabled (but not required) it should look like this: (BTW, Tachyon for the P2 is called TAQOZ but it works pretty much the same way)
    882 x 620 - 32K
  • rjo__rjo__ Posts: 2,114
    edited 2019-07-09 18:11
    Peter,

    Thank you. I do indeed have TAQOZ and it does work. It's a miracle.










  • rjo__rjo__ Posts: 2,114
    I can't get CLKFREQ to work as it instructs on your Google doc. It isn't in WORDS, but TAQOZ says ok as though it knows what I am talking about.

    >> CLKFREQ . 80000000

    You also have a ton of stuff linked through the P2 link in your signature. Where is the full version for P123A9?




  • rjo__rjo__ Posts: 2,114
    As a Forth idiot, until other idiots show up, I will speak for them.

    Here are my initial impressions after about two hours of looking... that's about all you'll get from your average idiot. I'm going to hang here, but by now the average idiot will already have made up his mind.

    1. I don't care about stacks. When Chip starts talking about stacks, I know he isn't talking to me.
    The first two hours of an idiot's time is like the first day of a Driver's ED class. I don't need to know how to design a camshaft to drive a car. If I need to know about stacks to use TAQOZ, I'm going to fail. It is just a matter of time.

    Recommendation:
    If you want to attract newbies, you need to treat the entire conversation about stacks as a footnote.

    2. It is very clear how to generate the list of defined words... but the next question never really get's answered to my understanding:what does the word actually do. Your document is immensely helpful... but there should be a command that let's me see the inner working of a word without having to dial up a website and after two hours, I don't see it. I got close, but when I tried to follow the instructions and see the innards I ended up with "Deadbea4, Deadbea3,Deadbea2, Deadbeaf" Not sure what Deadbeaf is, but (true story) last night I went to BurgerKing and tried to order 2 Whoppers for $6 and the lady actually said... "sorry we are all out of Whopper meat." So, maybe it has something to a freezer that got hacked by the Russians.

    Recommendation:
    needs a better word:)


  • rjo__ wrote: »
    As a Forth idiot, until other idiots show up, I will speak for them.

    Here are my initial impressions after about two hours of looking... that's about all you'll get from your average idiot. I'm going to hang here, but by now the average idiot will already have made up his mind.

    1. I don't care about stacks. When Chip starts talking about stacks, I know he isn't talking to me.
    The first two hours of an idiot's time is like the first day of a Driver's ED class. I don't need to know how to design a camshaft to drive a car. If I need to know about stacks to use TAQOZ, I'm going to fail. It is just a matter of time.

    Recommendation:
    If you want to attract newbies, you need to treat the entire conversation about stacks as a footnote.

    2. It is very clear how to generate the list of defined words... but the next question never really get's answered to my understanding:what does the word actually do. Your document is immensely helpful... but there should be a command that let's me see the inner working of a word without having to dial up a website and after two hours, I don't see it. I got close, but when I tried to follow the instructions and see the innards I ended up with "Deadbea4, Deadbea3,Deadbea2, Deadbeaf" Not sure what Deadbeaf is, but (true story) last night I went to BurgerKing and tried to order 2 Whoppers for $6 and the lady actually said... "sorry we are all out of Whopper meat." So, maybe it has something to a freezer that got hacked by the Russians.

    Recommendation:
    needs a better word:)


    The thing is that with Forth you have to care about the stack. If you are going enforce artificial limits on your understanding you will fail.

    When talking about C, your camshaft analogy may work. When talking about Forth, it's not something hidden away under the hood, but more like the road you are driving on.

    The way it works is like those spring loaded plate storages you might find in a cafeteria: First in, last out with some opportunity to look at the plates near the top.
  • MJBMJB Posts: 1,235
    edited 2019-07-09 21:36
    rjo__ wrote: »
    ... ... but there should be a command that let's me see the inner working of a word without having to dial up a website and after two hours, I don't see it. ...

    you do not want to hear about the stack ...
    but want to see the inner workings of a word ??

    1. as @AJL said - the stack is essential to FORTH,
    like you want to program C/Basic/... and don't want to hear about variables ...

    2. you can see the inner workig of a word - very simply typing
    SEE word
    
    ... maybe not in the ROM version ... but in the extended
    but then you need to invest a little more to make sense out of it.
  • So, Tachyon for p1 is written to the EEPROM? Then copied into the prop and executed like any other propeller program?
  • AJL wrote:
    The thing is that with Forth you have to care about the stack. If you are going enforce artificial limits on your understanding you will fail.
    +1

    However, admittedly, stack maintenance in Forth can be a total pita. Another stack-oriented language, Postscript, makes this a lot easier with its mark and cleartomark words. But operators like these require type-awareness in the stack, IOW requiring a separate type stack, or at least a bit array to keep track of where the marks are.

    -Phil
  • So, Tachyon for p1 is written to the EEPROM? Then copied into the prop and executed like any other propeller program?

    Propeller code is normally provided as source or as a binary or both. The thing is that as the source is updated the binary may not be because that requires a couple of extra steps to transfer the full Tachyon image as a binary back onto Dropbox since most of the code is compiled by Tachyon on the Prop itself.
    But when you want to just try it out, the binary is the best way to go.

    As for Spin/PASM source code, when you hit F11 it compiles it on the PC and generates a binary that is downloaded into the RAM and then EEPROM. So either way it is loaded into a Prop as a binary.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2019-07-10 03:51
    @rjo__ Since you have already been given stacks by some, I will skip that for the moment :)
    ... ... but there should be a command that let's me see the inner working of a word without having to dial up a website and after two hours, I don't see it. ...

    "Would be nice" rather than "should be" I would think. Developing software on a PC can spoil us and lead to high expectations. Tachyon runs totally on the Prop itself. However, both the P2 EVAL and P2D2 have micro SD as standard and I do have a mechanism both for decompiling a word and also another for viewing the original source. I started generating HELP files in Tachyon for the P1 and I have yet to do the same for the P2. Assuming that you had the HELP folder loaded on your SD card, you could type HELP HIGH for instance and it would locate and display the help file that covered this word such as this one here:
    --- PINIO.TXT
    --- Pin outputs - all set DIRA automatically
    LOW ( pin -- )			Make the pin a LOW output (Sets DIRA)
    HIGH ( pin -- )			Make the pin a HIGH output (Sets DIRA)
    FLOAT ( pin -- )		Make the pin an input (Resets DIRA)
    
    --- Multiple pin outputs - mask operation is direct and faster
    OUTCLR ( pinmask -- )		Clear the pins to LOW outputs (Sets DIRA)
    OUTSET ( pinmask -- )		Set the pins to HIGH output (Sets DIRA)
    OUTPUTS ( pinmask -- )		Set the pins to outputs (does not write OUTA)
    
    --- Fast pin output - stack parameter not dropped
    H ( pinmask -- pinmask )	Fast HIGH
    L ( pinmask -- pinmask )	Fast LOW
    T ( pinmask -- pinmask )	Fast toggle
    P ( pinmask -- pinmask )	Fast PULSE high (4 clock cycles)
    F ( pinmask -- pinmask )	Fast FLOAT
    
    --- Pin input
    PIN@ ( pin -- flg )		Read state of pin as a flag
    IN ( pinmask -- flg )		Read state of pins as flag (any high will be TRUE)
    
    INPUTS ( pinmask -- )		Set pins to inputs
    Examples:
    
    Details:
    
    Related:
    

    Generating and maintaining the help files is probably one of those low priority tasks but one that anyone can help generate too.
    but when I tried to follow the instructions and see the innards I ended up with "Deadbea4, Deadbea3,Deadbea2, Deadbeaf"
    I have absolutely no idea what you were doing and how you got there, maybe a copy&paste of your terminal would help me. However DEADBEEF is normally the hex value that is used to indicate a problem, in this case an empty stack is never really empty and so the stack registers are preloaded with dummy $DEADBEEF values that substitute the last digit with 1 to 4 for debug purposes. Now I'm guessing you tried the REVEAL word I had in the exercise, but if you ran that on an empty stack rather than from the SHIFT_OUT word, then those $DEADBEEx values will print out for sure.

    STACKS
    One thing I will say about stacks though. As Phil said, they can be a pita, but I find if you want to stuff junk into your back pocket then that can be a pita too. Same with stacks, keep it lean, which is why Tachyon only ever worries about the top 4 stack elements and tries to avoid even having that many for any one function. Take for instance the PANEL word that draws a filled rectangle on the VGA display. Normally you would have to provide 5 parameters to it, but I only provide one. That keeps the PANEL word simple and easy to deal with. Instead I create 4 words x y w h which you can guess their function, and each one is a word that takes one parameter. How does it look?
    100 x 100 y 200 w 50 h red panel
    
    Surely anyone could figure this one out (I would hope). So while stacks can be a pita if you let them, don't let them, keep it clean and simple by factoring your code as in the case of PANEL.
    BTW, since PANEL only requires a single stack parameter, that means I could follow the "red panel" with "white panel" and then "blue panel" and since the y variable is updated by h each time I draw a panel, guess what I end up with?.

    Traditional Forths will feature PICK and ROLL so you can grab the 8th parameter etc. What a total pita that is. What is the 8th parameter after all this stack juggling? I don't know, and I don't want to know which is why I will NOT implement these words in my system since they encourage bad practices.


    BTW, the FPGA version does not have the silicon's PLL clock circuitry and so it runs at 20Mhz or 80Mhz.
  • Here are a couple of variations on the SHIFT_OUT routine that are progressively more efficient until finally there is no routine, only a setup :)
    I will generate an updated P2-EVAL binary that has all the goodies loaded and update my sig with a direct link shortly.
    { VERSION USING THE LSBOUT INSTRUCTION TO OUTPUT THE DATA
    LSBOUT ( data pin -- data*2 pin )
    TAQOZ# $43 LAP SHIFT_OUT LAP .LAP --- 3,424 cycles= 13,696ns @250MHz ok
    This instruction is useful for serial data that may or may not require a clock
    }
    ---                 data mask, setup, 8 times each bit clocked         then discard
    : SHIFT_OUT ( send -- )  DATA CLK LOW 8 FOR LSBOUT CLK HIGH CLK LOW NEXT 2DROP ;
    
    
    
    { VERSION USING CLKOUT
    CLKOUT ( iobit dat -- iobit dat/2 ) REG27=iomask ) Shift msb bit out,  clock high, clock low
    TAQOZ# $43 LAP SHIFT_OUT LAP .LAP --- 1,232 cycles= 4,928ns @250MHz ok
    The advantage of the CLKOUT method is the finer control that can be achieved for
    each bit and clock speed by setting the CLKDLY register (0=none)
    }
    ---                    setup clock mask, data,    8 times clock a bit, then discard
    : SHIFT_OUT ( send -- )	CLK CLKREG COG! DATA SWAP 8 FOR CLKOUT NEXT 2DROP ;
    
    
    
    { VERSION USING KERNEL SPI INSTRUCTION
    The SPI instructions are fast kernel routines that rely upon an SPI config where
    the CS MISO MOSI CLK are specified in a single long as 4 decimal bytes.
    Unused pins are written as 99 - i.e. &99.99.33.32 SPIPINS.
    SPIWB ( byte -- ) ' write byte msb first '
    TAQOZ# $43 LAP SPIWB LAP .LAP --- 128 cycles= 512ns @250MHz ok
    This is the fastest way to send and receive SPI data short of a more complex smartpin mode
    }
    \ CS SI SO CK
     &99.99.33.32 SPIPINS
    \ then simply use SPIWB to write MSB first
    $43 SPIWB
    
Sign In or Register to comment.