Previous Thread
Next Thread
Print Thread
Page 1 of 3 1 2 3
Let's have fun with DSPs! #112870
03/14/18 04:59 PM
03/14/18 04:59 PM
Joined: Feb 2004
Posts: 2,012
Sydney, Australia
Vas Crabb Offline OP
Very Senior Member
Vas Crabb  Offline OP
Very Senior Member
Joined: Feb 2004
Posts: 2,012
Sydney, Australia
https://github.com/cuavas/mame/tree/dsp16

The DSP16A is an interesting chip. It's like the great granddaddy of VLIW and EPIC.
  • The instruction set is explicitly parallel, and it can manage a 16*16->32 multiply, a 32+36->36 addition, a 12+12->12 addition, a 16+16->16 (9+9->9 on DSP16) addition, two 8-bit increments, a ROM fetch, and a RAM access in a single cycle. Yes, the word is and, although there are limitations on the exact combinations you can use.
  • There are effectively no general-purpose registers - every register has an assigned role, although in some cases a few registers are interchangeable (e.g. the two accumulators and four RAM pointers).
  • It has dedicated silicon for saturation and rounding.
  • It has an on-board pseudorandom sequence generator.
  • It normally overlaps the ROM fetch for the next instruction with the current instruction, but it has a manually managed 15-instruction cache in the control unit. When executing from cache, it can overlap a ROM data fetch for the next instruction with the current instruction for higher throughput. By executing a tight loop from cache, you can make a very fast FIR filter with coefficients in ROM.
  • Although the DSP16 can only use internal program ROM or external program memory, but not both at the same time, the DSP16A can access external program memory while the internal ROM is enabled (QSound uses this to read sample data).
  • It supports multi-master time-division multiplexed synchronous serial protocols, making it ideal for processing circuit-switched voice calls.
  • The QSound DSP runs at 30MHz (60MHz clock input divided by two). On CPS2, it's already clocked at almost three times the speed of the main 68k CPU, it can issue an instruction every one or two cycles, and it can do up to four operations per instruction. The QSound DSP is far more powerful than the main CPU.


I've implemented almost all of the instructions, and enough of the onboard peripherals to for the QSound program to work. It's machine cycle-granular and fully interruptible. I think I've got a logic bug making looping samples screw up or something, so it doesn't sound right. It also has very high CPU requirements now that it's trying to run a 4-way explicit DSP at 30MHz.

Also, I want to meet the guy who wrote the program and buy him a beer. There are some pretty amusing techniques in the code.

Re: Let's have fun with DSPs! [Re: Vas Crabb] #112871
03/14/18 05:32 PM
03/14/18 05:32 PM
Joined: Oct 2004
Posts: 93
Italy
Dr.Zer0 Offline
Member
Dr.Zer0  Offline
Member
Joined: Oct 2004
Posts: 93
Italy
Great !

Re: Let's have fun with DSPs! [Re: Vas Crabb] #112872
03/14/18 06:47 PM
03/14/18 06:47 PM
Joined: Mar 2006
Posts: 1,026
PA, USA
L
Lord Nightmare Offline
Very Senior Member
Lord Nightmare  Offline
Very Senior Member
L
Joined: Mar 2006
Posts: 1,026
PA, USA
Originally Posted by Vas Crabb

Also, I want to meet the guy who wrote the program and buy him a beer. There are some pretty amusing techniques in the code.


https://en.wikipedia.org/wiki/Brian_L._Schmidt


"When life gives you zombies... *CHA-CHIK!* ...you make zombie-ade!"
Re: Let's have fun with DSPs! [Re: Vas Crabb] #112874
03/14/18 10:21 PM
03/14/18 10:21 PM
Joined: Dec 2004
Posts: 111
San Jose, CA
P
Phil Bennett Offline
Senior Member
Phil Bennett  Offline
Senior Member
P
Joined: Dec 2004
Posts: 111
San Jose, CA
Exciting stuff! Let me know if you need any digital audio captures from the hardware for verification purposes. I'm sure I can arrange something smile

Re: Let's have fun with DSPs! [Re: Vas Crabb] #112876
03/15/18 01:26 AM
03/15/18 01:26 AM
Joined: Feb 2004
Posts: 2,012
Sydney, Australia
Vas Crabb Offline OP
Very Senior Member
Vas Crabb  Offline OP
Very Senior Member
Joined: Feb 2004
Posts: 2,012
Sydney, Australia
Thanks for the offer Phil - it might be useful. I've force-pushed an update, and it's working much better now (issue with interrupt emulation, and AM_MIRROR covering too many bits). It just seems to be reading samples from the wrong place in ROM or something.

Re: Let's have fun with DSPs! [Re: Vas Crabb] #112877
03/15/18 02:01 AM
03/15/18 02:01 AM
Joined: Feb 2004
Posts: 2,012
Sydney, Australia
Vas Crabb Offline OP
Very Senior Member
Vas Crabb  Offline OP
Very Senior Member
Joined: Feb 2004
Posts: 2,012
Sydney, Australia
And with a bit more tweaking, it reads samples from the right place! Effects sound right to me. I guess it's time to think about making it fast now...

Re: Let's have fun with DSPs! [Re: Vas Crabb] #112878
03/15/18 04:04 AM
03/15/18 04:04 AM
Joined: Feb 2004
Posts: 2,012
Sydney, Australia
Vas Crabb Offline OP
Very Senior Member
Vas Crabb  Offline OP
Very Senior Member
Joined: Feb 2004
Posts: 2,012
Sydney, Australia
http://arcade.vastheman.com/qsound.wav
The QSound jingle at 8s plays 16 channels simultaneously with effects, then you can hear the first few seconds of the attract music with spatialiser in effect from about 18s (it's a 30-second capture of sfz2alj with QSoundâ„¢ DSP emulated).

Re: Let's have fun with DSPs! [Re: Vas Crabb] #112879
03/15/18 05:47 AM
03/15/18 05:47 AM
Joined: Feb 2004
Posts: 2,012
Sydney, Australia
Vas Crabb Offline OP
Very Senior Member
Vas Crabb  Offline OP
Very Senior Member
Joined: Feb 2004
Posts: 2,012
Sydney, Australia
Oh, while I think of it Phil, do you have the gear to check what the glue logic presents on the low eight data lines during sample reads? The DSP wants 16-bit signed samples, and the ROM contains 8-bit signed samples that need to end up in the most significant byte. I want to know what ends up in the least significant byte (I'm emulating it as byte smearing).

The lines in question are RB00 to RB07, on pins 35, 36, 37, 38, 39, 40, 42 and 43 (information manual p7-7 or 162 in PDF numbering). I want to know if they're always tied high/low, or if they're somehow affected by what's on lines RB08 to RB15, on pins 44, 45, 46, 47, 48, 49, 50 and 51. The DSP samples RB00 to RB15 on falling edges of the CKO output (pin 33, see p7-10/165). There are no read/write strobes as it's designed to be used with dumb ROM.

Re: Let's have fun with DSPs! [Re: Vas Crabb] #112881
03/15/18 07:28 AM
03/15/18 07:28 AM
Joined: May 2006
Posts: 121
F
Firehawke Offline
Senior Member
Firehawke  Offline
Senior Member
F
Joined: May 2006
Posts: 121
I put together a quick demo video of the new audio improvements: https://www.twitch.tv/videos/238950989
It goes SFA2 old, SFA2 with QSound, SFA1 old, then SFA1 with QSound. Seems like SFA2 is a lot more noticeable than SFA1, but I'd put that down to them having more time to work with QSound in general.

Re: Let's have fun with DSPs! [Re: Vas Crabb] #112882
03/15/18 09:10 AM
03/15/18 09:10 AM
Joined: Feb 2004
Posts: 2,012
Sydney, Australia
Vas Crabb Offline OP
Very Senior Member
Vas Crabb  Offline OP
Very Senior Member
Joined: Feb 2004
Posts: 2,012
Sydney, Australia
And with a bit more love, the new DSP16 core and disassembler are in mainline, although it still isn't enabled for QSound due to the current performance.

Phil, I thought of another thing I'd like traced on a real game (doesn't matter whether it's CPS1.5/CPS2/ZN1/ZN2). Could you capture the following for a couple of sample periods and show a graph:
  • OSE (DSP pin 52, output)
  • OCK (DSP pin 59, output)
  • OLD (DSP pin 60, output)
  • SYNC (DSP pin 62, input?)
  • PSEL (DSP pin 72, output)
  • WS (TDA1543 DAC pin 2, input)

Page 1 of 3 1 2 3

Who's Online Now
1 registered members (1 invisible), 112 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Shout Box
Forum Statistics
Forums9
Topics8,606
Posts112,517
Members4,828
Most Online296
Dec 5th, 2018
Powered by UBB.threads™ PHP Forum Software 7.6.1.1
(Release build 20180111)
Page Time: 0.025s Queries: 14 (0.008s) Memory: 5.7244 MB (Peak: 5.9447 MB) Zlib enabled. Server Time: 2018-12-16 16:20:03 UTC