|
|||||||
![]() |
|
|
Thread Tools |
|
|
#1 |
|
HardwareHeaven Newbie
Join Date: Apr 2009
Posts: 10
Rep Power: 0 ![]() |
Hello
According to as10k1 manual (and other documents) the skip instruction can test many mix of the 5 lsb of any register. For example (AFAIU) a test value of 11101 00010 (binary, 10 lsb) should trigger a skip when the 5 lsb of the tested register are 00010 = 0x02 (bits 0,2,3,4 unset and bit 1 set). This would be a short (space saving) way of testing small integer value from 0 to 31. But i cannot get it work. ![]() I miss something! Any advice ? Thks. Xavier |
|
|
|
|
|
#2 |
|
HardwareHeaven Extreme Member
Join Date: Jan 2005
Posts: 5,507
Rep Power: 61 ![]() ![]() ![]() ![]() ![]() ![]() |
Re: 'Skip' instruction : how does this work ?
It is not any register, it is the Condition Code Register that is checked...
i.e. You are testing the flags that were set by the previous instruction. |
|
|
|
|
|
|
|
HardwareHeaven Newbie
Join Date: Apr 2009
Posts: 10
Rep Power: 0 ![]() |
Re : 'Skip' instruction : how does this work ?
Are you sure ?
AFAIK the 'skip R,A,X,Y' instruction does : 1) move A to R 2) test A according to X 3) skip (or not) Y instructions The A operand can be any register (any operand can be any register). One can use this for 'if/then/else' structure : the 1st skip save the CCR, and the 2nd one test the saved value. If I'm wrong then either all documents are wrong either I'm an idiot, and I'm not, for sure ![]() Well *cough* maybe I am, as I can not figure out how works step 2)
|
|
|
|
|
|
#4 |
|
h/h member-shmember
Join Date: Dec 2002
Location: Evil Empire
Posts: 2,606
Rep Power: 66 ![]() ![]() ![]() ![]() ![]() ![]() |
Ответ: 'Skip' instruction : how does this work ?
i'm not 100% sure as well, but i agree with Russ.
I suppose the "skip" tests the CCR to X, while the A register is just copied to R. (e.g. to test "any" register you still need two skip instructions, first one to copy A to CCR so that the second one can actually test it). Though i'd better base on real execution tests. >If I'm wrong then either all documents are wrong either I'm an idiot, Could you give some quotes please?
__________________
|
|
|
|
|
|
#5 |
|
HardwareHeaven Extreme Member
Join Date: Jan 2005
Posts: 5,507
Rep Power: 61 ![]() ![]() ![]() ![]() ![]() ![]() |
Re: 'Skip' instruction : how does this work ?
Yeah, I do not know... It only seems to work if the 'A' operand is 'CCR'.
I realize that the as10k1 manual says differently (and the guide written for kX basically just repeats the same info), but that is the only way it seems to work. Even saved CCR's do not seem to work... Also the docs describing the FX8010 architecture do not talk about the 'R' or 'A' operands of the skip instruction (but it does say that tests of the Condition Code Register are used to determine whether or not to skip), but does say that the 'X' (ccr mask) and 'Y' (skip count) operands can be regular GPR's. BTW: IIRC there is more info about the skip instruction in one of the patents, but I do not remember which patent, and a lot of the links appear to be dead. Last edited by Russ; Jun 2, 2009 at 01:22 AM. |
|
|
|
|
|
#6 |
|
h/h member-shmember
Join Date: Dec 2002
Location: Evil Empire
Posts: 2,606
Rep Power: 66 ![]() ![]() ![]() ![]() ![]() ![]() |
Ответ: 'Skip' instruction : how does this work ?
The "skip" execution is described in details in Processor with instruction set for audio effects
But its "language" seems to be intentionally "blurred" (as most patents do) and may contain misdirections (like swapped X/Y or shuffled test masks) so i would not rely on that too much. The as10k1 manual mentions "any register" only in context of "an always skip" (which could be a reasonable simplification, especially considering the times it was written).
__________________
Last edited by Max M.; Jun 2, 2009 at 02:45 AM. Reason: just some corrections for my charming english :) |
|
|
|
|
|
#7 |
|
HardwareHeaven Extreme Member
Join Date: Jan 2005
Posts: 5,507
Rep Power: 61 ![]() ![]() ![]() ![]() ![]() ![]() |
Re: 'Skip' instruction : how does this work ?
Yeah, that is the patent I was thinking of
![]() Can also be found here: Processor with instruction set for audio effects - Patent # 5930158 - PatentGenius |
|
|
|
|
|
#8 |
|
h/h member-shmember
Join Date: Dec 2002
Location: Evil Empire
Posts: 2,606
Rep Power: 66 ![]() ![]() ![]() ![]() ![]() ![]() |
Ответ: 'Skip' instruction : how does this work ?
btw., i'm just curious what could be an application of testing lower 5 bits of a GPR?
(well, personally, i always prefer to go a "math" way rather then with an explicit branch (even in higher level languages) - i'm mentioning it just because there's a chance that even more optimal (comparing to "one skip") solution can exist). (in other words: "instead of coding separate blocks 'A' and 'B' and switching them by 'skip' it could be possible to make a block 'C' which can do 'A+B' job while controled by some value 'X' produced by some non-linear maths of the 'wrap, limit, andxor, tstneg etc.' stuff" - to see what i mean check out http://www.hardwareheaven.com/effects-...ossfading.html )
__________________
|
|
|
|
|
|
|
|
HardwareHeaven Newbie
Join Date: Apr 2009
Posts: 10
Rep Power: 0 ![]() |
Re : 'Skip' instruction : how does this work ?
The 2-instruction code :
Code:
macints 0,reg,-1i,value skip 0,CCR,8,somewhere Code:
const test_mask = value + ~value << 5 skip 0,reg,test_mask,somewhere 'test_mask' is computed according to both documents : as10k1 manual and the patent. This might be useful in case of piecewise functions, where the tested register contains a stage number from 0 to 31. I can think of an ADSR-like envelop generator, or a complex saw/tri/sqr wave generator. Code:
interp res, V1, pos, V2 skip 0,stage,stage0_mask, 3i interp res, V2, pos, V3 skip 0,stage,stage1_mask, 1i interp res, V3, pos, V4 macs output, 0, res, volume But maybe one can do that with less than 5 instructions without any skip ![]() If the docs are correct, more complex tests might be done. For example, reg <>15 (01111) might be tested with: Code:
test_mask = 1 << 30 // select OR function -- not sure
+ 15 << 5 + ~15
|
|
|
|
|
|
#10 |
|
HardwareHeaven Extreme Member
Join Date: Jan 2005
Posts: 5,507
Rep Power: 61 ![]() ![]() ![]() ![]() ![]() ![]() |
Re: 'Skip' instruction : how does this work ?
I do not think you are calculating the masks correctly.
The way I take it is that you just mask off the bits you want to check, where the bits look like this: ..9.......................5....4.................. .0.. [!S] [!Z] [!M] [!B] [!N] [S] [Z] [M] [B] [N] For each 10 bits (the upper 5 bits are for testing the inverses of the lower 5 bits (i.e. for testing that a flag is not set)). The 2nd (bits 10..19) and 3rd (bits 20..29) groups of 10 are for additional (optional) tests. (with the remaining 2 bits being used to select one of the 4 forms). So if you want to test for [!Z] (not zero) your mask has a 1 at bit position 8. (1 << 8 = 256 (or if you prefer: (1 << 3) << 5 = 256): skip r, ccr, 0x100, count; Or if you want to test for [M][!S] (non-saturated negative), you would mask bits 2 and 9. ((1 << 9) + (1 << 2) = 516) skip r, ccr, 0x204, count; Or a more complex example, where maybe you want to test [M][!S] OR [!M][!Z][!S] (non-saturated negative OR non-saturated positive), you could masks bits 7,8, and 9 for the second part and shift them into bit positions 10..19, and add with the mask for the first part (same as previous). ( ((1 << 7) + (1 << 8) + (1 << 9) ) << 10) + 516 = 918020 skip r, ccr, 0xe0204, count; Also, with all the different options (flag combinations and mask forms) it seems there are multiple ways that you could test for the same flags (i.e. with the above [!Z][!S] (as well as some other masks) should give same result). In any case, that is how I think the masks work (something like that), but I would have to do a bit of testing to be sure (but I have never really needed anything beyond the basic stuff, so...). Last edited by Russ; Jun 3, 2009 at 12:45 AM. |
|
|
|
|
|
#11 | ||
|
h/h member-shmember
Join Date: Dec 2002
Location: Evil Empire
Posts: 2,606
Rep Power: 66 ![]() ![]() ![]() ![]() ![]() ![]() |
Ответ: 'Skip' instruction : how does this work ?
(using small font as being quite off-topic) Quote:
However in most cases such explicit switching is not really necessary (especially "integer stage encoding"). Quote:
To illustrate that the other way around could be much more optimal i've sketched a less or more complete ADSR module that uses no skips. Take a look (i made the module to be somewhat compatible with http://www.hardwareheaven.com/effects-...ystem-1-a.html so that it can be evaluated easier): adsr.da.txt (note that i did not optimize its register usage for better readability (for example all five temp registers maybe merged into one, etc.)). .................................................. Well, either way, the "split/skip" flow is more straightforward to code - so it's nothing wrong with it in general. And, after all, considering the overall count of instructions for a typical module, two more or less instructions of 20 (for example) may be not so important. But if you're looking for really optimal code, the first thing to consider is "can i do that without explicit branches?".
__________________
Last edited by Max M.; Jun 3, 2009 at 11:09 AM. Reason: updated adsr.da.txt with better comments |
||
|
|
|
|
|
|
||
|
HardwareHeaven Newbie
Join Date: Apr 2009
Posts: 10
Rep Power: 0 ![]() |
Re : 'Skip' instruction : how does this work ?
Russ:
Quote:
Code:
const test_mask = value + ~value << 5 I have to check my code once again... Max: Quote:
![]() A question: do you get 'linear' response ? My 'interp res, V1, pos, V2' is linear from V1 to V2, but i understand that your 'interp a,1,ak,a' in something like 1-exp(-a.t). Maybe it's not very important, but I imagine the attack is smoother. Many thanks! Last edited by vax71; Jun 3, 2009 at 02:39 PM. |
||
|
|
|
|
|
#13 |
|
HardwareHeaven Extreme Member
Join Date: Jan 2005
Posts: 5,507
Rep Power: 61 ![]() ![]() ![]() ![]() ![]() ![]() |
Re: 'Skip' instruction : how does this work ?
OK, I see, I misunderstood something in your code
.
|
|
|
|
|
|
#14 |
|
h/h member-shmember
Join Date: Dec 2002
Location: Evil Empire
Posts: 2,606
Rep Power: 66 ![]() ![]() ![]() ![]() ![]() ![]() |
Ответ: 'Skip' instruction : how does this work ?
yes, all three curves are exponential (or logarithmic, depending on point of view) - something like that.
But they can be changed to linear too. For example attack becomes linear when its interp replaced with just "a + ak" (this needs corresponding modification of the ak coefficient computation of course). Same for release (assuming inverse direction). The decay will need some deeper changes (as it won't longer "stop" at sustain level) - but yep, these are details i guess. A lot of little modifications are possible, here and there, as always, each having its unique applications. (different curves for different synths. personally i think that some kind of semi-logarithmic curve for attack is probably more universal, while decay and release are better to be fully exponential/logarithmic). With a posted module i just tried to somewhat mimic the kxm400 behaviour roughly - though it's not identical of course.
__________________
Last edited by Max M.; Jun 6, 2009 at 10:57 AM. Reason: link make up |
|
|
|
|
|
|
|
HardwareHeaven Newbie
Join Date: Apr 2009
Posts: 10
Rep Power: 0 ![]() |
Re : 'Skip' instruction : how does this work ?
The non linear attack looks like attack+hold, and the decay looks like delay+break. And the non-linear release is probably more natural. I'll give it a try
![]() .......... 'looks like you're right : 'skip' is useless ![]() I will no more focus on it. I can now see the Hidden Power of Limits Anyway I still want to know why I can not make 'skip' work... |
|
|
|
|
|
#16 |
|
HardwareHeaven Extreme Member
Join Date: Jan 2005
Posts: 5,507
Rep Power: 61 ![]() ![]() ![]() ![]() ![]() ![]() |
Re: 'Skip' instruction : how does this work ?
Maybe it is just something that was never implemented... Patents tend to try to be all inclusive in order to cover all the bases, etc.
|
|
|
|
|
|
#17 |
|
HardwareHeaven Lover
Join Date: Jan 2008
Location: germany, sb0090
Posts: 242
Rep Power: 26 ![]() ![]() |
Re: 'Skip' instruction : how does this work ?
hey guys, interesting topic. max you have done an adsr generator with only 16 registers, nice
my first (and only) adsr for kx- modular took 33 registersand a lot of skips (horrible spaghetti code). stylus Last edited by stylus02; Jun 4, 2009 at 03:18 PM. |
|
|
|
|
|
#18 |
|
h/h member-shmember
Join Date: Dec 2002
Location: Evil Empire
Posts: 2,606
Rep Power: 66 ![]() ![]() ![]() ![]() ![]() ![]() |
Ответ: 'Skip' instruction : how does this work ?
hehe, i guess whatever "horrible" code is always better then nothing ;)
__________________
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
|
|