Digging into the FV-1 instruction set and "Mnemonics"

Started by ElectricDruid, January 29, 2021, 09:18:00 AM

Previous topic - Next topic

ElectricDruid

Hi All,

I'm finally getting around to digging into Spin FV-1 ASM properly. Yes, late to the party, as ever ;). It's a fascinating little thing. Very specific, but very streamlined for what it can do. It seems to be a question of making what you want to do fit its way of doing things! It very definitely has it's own way of thinking, which is quite cool.

I've got a couple of questions for you seasoned FV-1 coders:

1) What on earth do the instruction "mnemonics" actually stand for?!? I find it helps if I can read them into something helpful in English. One good example from the FV-1 instructions is LDAX, "LoaD Accumulator, then multiply (X)". That makes sense. SKP is "Skip", that's another simple one. But there's others that I can't make head or tail of. I'd read "RDxx" as "Read something or other" and "WRxx" as "Write something or other" but it doesn't seem to be that simple since most of those instructions do several things.
Has anyone worked out any kind of "key" for these mnemonics?

2) There are no instructions for loading a constant into a register or the accumulator, apparently. How do I do something like that?
If I want to initialise the accumulator with 1.0, say? Or if I want to put 1.5 into REG0?
I've found alternative ways to do this, but it seems very around-the-houses, and if there's a neater way I'm missing, that'd be much better.

Thanks!
Tom

octfrank

To answer the questions:

1. Because Keith made them that way. I did the digital design of the chip but Keith named the instructions, there is a logic to it and some are obvious like you saw and other are not (I would really have to think about some to remember) but in general they are based on what the over all instruction is doing or if it is part of a set to do a low or high shelf. If the instruction ends with an X (i.e. RDFX) it means we are using a register not delay memory. Keith considered registers eXternal to the delay line.

2. Most people use SOF (which stands for Scale and OFfset) to load the accumulator with a value like "SOF 0, 0.5" will load 0.5 into ACC. You are limited to a range of -1.0 to +0.999 using SOF.
Frank Thomson
Experimental Noize

ElectricDruid

Quote from: octfrank on January 29, 2021, 09:52:00 AM
To answer the questions:

1. Because Keith made them that way. I did the digital design of the chip but Keith named the instructions, there is a logic to it and some are obvious like you saw and other are not (I would really have to think about some to remember) but in general they are based on what the over all instruction is doing or if it is part of a set to do a low or high shelf. If the instruction ends with an X (i.e. RDFX) it means we are using a register not delay memory. Keith considered registers eXternal to the delay line.
X = eXternal, ok!

Quote
2. Most people use SOF (which stands for Scale and OFfset) to load the accumulator with a value like "SOF 0, 0.5" will load 0.5 into ACC. You are limited to a range of -1.0 to +0.999 using SOF.
Aha! Ok, thanks Frank, that's great. Is there a single-instruction way to initialise a register too, or do I have to put a value in Acc and then store it? E.g.

SOF    0, 0.5          ; Load Acc with 0.5
WRAX REG0, 1.0   ; Store 0.5 into Reg0, leave accumulator unaffected

octfrank

Quote from: ElectricDruid on January 29, 2021, 09:55:53 AM
Quote from: octfrank on January 29, 2021, 09:52:00 AM
2. Most people use SOF (which stands for Scale and OFfset) to load the accumulator with a value like "SOF 0, 0.5" will load 0.5 into ACC. You are limited to a range of -1.0 to +0.999 using SOF.
Aha! Ok, thanks Frank, that's great. Is there a single-instruction way to initialise a register too, or do I have to put a value in Acc and then store it? E.g.

SOF    0, 0.5          ; Load Acc with 0.5
WRAX REG0, 1.0   ; Store 0.5 into Reg0, leave accumulator unaffected

As far as I can recall, no, unless someone came up with a trick to do it. But this is why we added WRDLD to FXCore.

And the "F" in RDFX stands for Filter since it can be used with a WRAX to make a LP filter, a WRLX to make a Low shelf or WRHX for a High shelf.
Frank Thomson
Experimental Noize

Digital Larry

#4
I think you may have to forget anything you know about typical assembly languages when approaching the FV-1.  Its instruction set is super optimized to audio processing occasionally at the expense of comprehensibility.  This lets you do things like implement a single pole filter in 2 instructions or pitch shifting in 6 or 8 or however many it is.

Thinking back, I realize that I started looking for patterns - "this is a filter", "this is a reverb", "this is an all pass", "this is a chorus", "this is a delay", etc.  That helped me more than stumbling over the code instruction by instruction.  There's really only a couple ways to do filters efficiently on the FV-1 so I'm going to be really surprised if you can invent a new one.  Both approaches are valid, but it may be easier to approach it initially in terms of recognizing and using functional blocks.
Digital Larry
Want to quickly design your own effects patches for the Spin FV-1 DSP chip?
https://github.com/HolyCityAudio/SpinCAD-Designer

Sweetalk

Quote from: Digital Larry on January 29, 2021, 11:19:16 AM
I think you may have to forget anything you know about typical assembly languages when approaching the FV-1.  Its instruction set is super optimized to audio processing occasionally at the expense of comprehensibility.  This lets you do things like implement a single pole filter in 2 instructions or pitch shifting in 6 or 8 or however many it is.

Thinking back, I realize that I started looking for patterns - "this is a filter", "this is a reverb", "this is an all pass", "this is a chorus", "this is a delay", etc.  That helped me more than stumbling over the code instruction by instruction.  There's really only a couple ways to do filters efficiently on the FV-1 so I'm going to be really surprised if you can invent a new one.  Both approaches are valid, but it may be easier to approach it initially in terms of recognizing and using functional blocks.

This!. Start with functional blocks and the basic instructions like sof, wrax, rdax, mulx, wra. Then you can dig inside the blocks and see what they do. In some cases, there's only one way to do things, like pitch shifting, so I use it as a block, besides understanding what does inside.

@ElectricDruid Feel free to message me if you need some help.

@octfrank I know that you're fully commited to the FXCore, but there's any plans to update some things in the FV1 taking into account how many people uses it?

octfrank

Quote from: Sweetalk on February 09, 2021, 04:56:27 AM
@octfrank I know that you're fully commited to the FXCore, but there's any plans to update some things in the FV1 taking into account how many people uses it?

That would not be easy to do, since Spin owns FV-1 it is not my decision. While I run Spin for Keith's widow since he died she does not really understand the costs and time involved in making a new chip. So FV-1 will probably not change but it does feed and house Keith's widow and children.

Another thing to consider is if we were to change FV-1 and increased speed, added functions, etc. we would probably need to go to a smaller geometry and the analog would suffer. Right now FV-1 is at a sweet spot between costs, features and performance.

We did see that the pedal and effects market did need a new chip for higher performance and that is why we are making FXCore. We dropped the internal CODECs for speed and performance, added features asked for from FV-1 users (barrel shifter, lookup table, etc.) and improved a few things like the pitch shifter. And it is much faster.

So each chip has its place, FV-1 for cost sensitive products, FXCore for higher end products. FXCore does have 2 advantages over FV-1, first is you can select the CODEC to use so it can be low or high end and second it is easy to daisy chain FXCores since they can sync to a word clock you can tie the digital out of one to the digital in of the next.
Frank Thomson
Experimental Noize