There is pieces in forum postings but nothing very coherent. Chip's Spin2 manual has some info on the differences between Spin2/Pasm2 mix and Pasm2 only.
If it's not inline assembly then it goes in a DAT section. If it is inline then ORG and END contain it.
Debug is functional in assembly when mixed Spin2/Pasm2. Not sure about pure Pasm2 since it may not have a second stage loading.
I'm not looking to write a compete program in PASM2. I just want to write a runtime library function for p2llvm. I suspect I can figure it out. I just thought I'd ask if someone had written up a brief overview. I'm particularly interested in block transfers.
As with Evan's code, the attached object (I2C) uses inline PASM2 for speed and timing precision. It may also help shed a bit of light on PASM2. Once you've had a bit of time with it, I think you'll find PASM2 is easier to code than PASM1.
Block transfers within hubRAM would be fastest using SETQ prefixing of both RDLONG and WRLONG. But these ops do require a cogRAM or lutRAM buffer since it can only block transfer in one direct at a time.
If not wanting to wrangle buffer sizing/matching then next best would be use the RDFAST+RFLONG for prefetched rapid reading of hubRAM, along with WRLONG being pretty quick on its own for writing back to hubRAM.
A slightly crazy way of copying hubRAM to hubRAM could be done using two streamers. Disable the relevant pins so the outputs can't be driven, then config the %AAAA pin input selectors to OUT as the source. Then one streamer writing and one reading in concert can silently copy the data via pins.
Comments
There is pieces in forum postings but nothing very coherent. Chip's Spin2 manual has some info on the differences between Spin2/Pasm2 mix and Pasm2 only.
If it's not inline assembly then it goes in a DAT section. If it is inline then
ORG
andEND
contain it.Debug is functional in assembly when mixed Spin2/Pasm2. Not sure about pure Pasm2 since it may not have a second stage loading.
I'm not looking to write a compete program in PASM2. I just want to write a runtime library function for p2llvm. I suspect I can figure it out. I just thought I'd ask if someone had written up a brief overview. I'm particularly interested in block transfers.
Here's a runnable test case that happens to have inline assembly for using combos of Cordic ops.
EDIT: Doh! Latest edit had a compile error. I'm still not used to Spin's assignment operator.
As with Evan's code, the attached object (I2C) uses inline PASM2 for speed and timing precision. It may also help shed a bit of light on PASM2. Once you've had a bit of time with it, I think you'll find PASM2 is easier to code than PASM1.
Block transfers within hubRAM would be fastest using SETQ prefixing of both RDLONG and WRLONG. But these ops do require a cogRAM or lutRAM buffer since it can only block transfer in one direct at a time.
If not wanting to wrangle buffer sizing/matching then next best would be use the RDFAST+RFLONG for prefetched rapid reading of hubRAM, along with WRLONG being pretty quick on its own for writing back to hubRAM.
A slightly crazy way of copying hubRAM to hubRAM could be done using two streamers. Disable the relevant pins so the outputs can't be driven, then config the %AAAA pin input selectors to OUT as the source. Then one streamer writing and one reading in concert can silently copy the data via pins.
Thanks everyone for the examples. I think I'll take a very simple approach to start and then try to refine it after I get it working.