Code example: SETXDAC
potatohead
Posts: 10,261
I like Searith's unit tests, and thought we might just start a thread with code use samples for the various instructions. These can go into the docs later on, but we can use them now. Discuss here, and when sorted, add to one or a new Google Document. I'm open to suggestions, thinking one page per instruction to allow for use examples and a super clear set of info for each instruction. I personally always liked this format from the older school programming manual type productions.
Let's start with this one. Where this is incomplete or incorrect, jump right in. I'm thinking of starting a thread for many of the instructions so they can get a full discussion. The result, again, should be a page on this instruction, with use examples, function, bits, modes, etc... I've got my own questions tagged ***
SETXDAC - Load 8 bit values into the 4 DAC's associated with a given COG*
SETDAC D/# --> LSB = DAC 0 -- MSB = DAC 3
*I recall each COG having a quick path to 4 of the DACS. This may require more documentation.
**What is L? Immediate mode flag?
***Technically, does AUGD modify the instruction in it's "D" form, or the immediate "#" form?
Let's start with this one. Where this is incomplete or incorrect, jump right in. I'm thinking of starting a thread for many of the instructions so they can get a full discussion. The result, again, should be a page on this instruction, with use examples, function, bits, modes, etc... I've got my own questions tagged ***
SETXDAC - Load 8 bit values into the 4 DAC's associated with a given COG*
SETDAC D/# --> LSB = DAC 0 -- MSB = DAC 3
CCCC 1101011 00L DDDDDDDDD 000011100 SETXDAC D/# C - Condition Codes Opcode = %1101011 --- --------- 000011100 D = Value sourced from Destination COG address L = Destination Address mode?** 0 = Value sourced from COG Destination Register 1 = Immediate, value sourced from D instruction bits # = D as immediate value $0-$1ff ## = works with AUGD for large immediate values $0-$7F_FFFF AUGD #$7F_FFFF —> target D target SETXDAC #D*** Examples: Immediate Value: SETXDAC #$ff ‘Set DAC 0 to $FF SETXDAC ##$AA_BB ’Set DAC 0 to $BB, DAC 1 to $AA Destination COG Register sourced value: SETXDAC dacval ’DAC 0 = $33, DAC 1 = $BB, DAC 2 = $AA, DAC 3 = $FF […] dacval long $FF_AA_BB_33
*I recall each COG having a quick path to 4 of the DACS. This may require more documentation.
**What is L? Immediate mode flag?
***Technically, does AUGD modify the instruction in it's "D" form, or the immediate "#" form?
Comments
How about?
And put that right under the instruction bit fields, so people are clear on what all the bits really are.
As the opcode is spread across two bitfields... It's a bit confusing.
There are a few variations on this too, some ops are S/D ones, others D only, etc....
What do you guys think? The formatting options are pretty limited, but it's clear and easily published out to other formats.
Any and all feedback on that welcome. I'm wanting to understand if it's a good idea, or the format too limited to make any sense.
The rough idea here is to give each instruction, or a couple grouped together, if it makes sense like it might for GETCNT, and friends, and provide basic instruction function, binary data, and code snippets one could copy paste...
Here's why I liked it: https://ddingus.gitbooks.io/propeller-2-instruction-reference/content/rep.html
One can link right to an instruction and get to that portion of a greater document.
This also can be sourced in a GitHub repository, allowing for push requests and collaboration too. I've not done that on this proof of concept test, but it likely makes the best sense.
As we test and these bits of code pile up, why not collect 'em?