HomeForumsWhat's newResources 
 
 
DSP execution time
ob1 - Jan 5, 2007

 1  2  Next> 

 ob1 Jan 5, 2007
Well well well...

The SEGA Saturn does explain very well the instructions and logic of the DSP inside the SCU, but, one thing is missing : execution time. eg, when I do

Code:
  
MOV MUL,P

how many DSP cycles does it take ?

 mrkotfw Jan 6, 2007
Are you even able to assemble any code? I haven't looked into the DSP much myself...

 antime Jan 6, 2007
The SOA#8 technical note claims that a multiplication is performed in one cycle, so I would assume that all other instructions do as well. The patent... on the DMA mechanism states that if the DSP program tries to access the same memory while it's being written to by DMA, the program will be paused. It's not immediately clear at least to me if this covers the whole memory or just a single memory location.

 ob1 Jan 7, 2007

Piratero said:
Are you even able to assemble any code?


Oh yeah !!! I even wrote a "développement limité" of cosine (1 - x^2/4 + x^4/120) using the dsp !

 ob1 Jan 7, 2007

antime said:
The SOA#8 technical note claims that a multiplication is performed in one cycle


I would have assumed that. It's hopeful, since I've learned the DSP runs at half the speed of the bus : 14MHz.

 RockinB Jan 8, 2007

antime said:
The SOA#8 technical note claims that a multiplication is performed in one cycle, so I would assume that all other instructions do as well.


That's right. I have been doing two little projects with the DSP in the past and it's been much fun.

 mrkotfw Jan 8, 2007
Am I missing something here? I never knew there even was a DSP assembler out there...

 ob1 Jan 8, 2007
I haven't opened Saturn Orbit yet (maybe my boss won't like it). Nevertheless, the SCU is clear enough. You write your assembly program let's say, on paper, then, with the doc, you convert it yourself in machine language. You get some 32-bits words. This is the program you're willing to send to the DSP Program Data Port.

Yesterday, I started implementing IEE754 single precision on it. I already can extract sign, exponent and mantissa from my numbers. IEE754 won't be very useful on the Saturn, but it's a pretty good exercise.

 RockinB Jan 9, 2007

Piratero said:
Am I missing something here? I never knew there even was a DSP assembler out there...


DSPSIM.EXE and DSPASM.EXE. There is even a homebrew disassembler out there..

 mrkotfw Jan 9, 2007

ob1 said:
I haven't opened Saturn Orbit yet (maybe my boss won't like it). Nevertheless, the SCU is clear enough. You write your assembly program let's say, on paper, then, with the doc, you convert it yourself in machine language. You get some 32-bits words. This is the program you're willing to send to the DSP Program Data Port.

Yesterday, I started implementing IEE754 single precision on it. I already can extract sign, exponent and mantissa from my numbers. IEE754 won't be very useful on the Saturn, but it's a pretty good exercise.


Impressive! keep up the good work! Wouldn't it be better to just write your own assembler? I may be looking at the DSP pretty soon.

 ob1 Jan 9, 2007

Piratero said:
Wouldn't it be better to just write your own assembler ?


I have started ! But then I saw a listing of Saturn Orbit showing a file called dspasm.exe. Guess that's the assembler.

 CyberWarriorX Jan 9, 2007
According to the SCU manual, it runs at half the SH2 speed. It also states that each step takes about 70 ns. According to Charles MacDonald's Saturn hardware notes, the SCU is affected by the selectable clock speed that's used for the SH2's and VDP's. So basically the SCU runs at either 13Mhz or 14Mhz depending on the setting.

 RockinB Jan 9, 2007

ob1 said:
I have started ! But then I saw a listing of Saturn Orbit showing a file called dspasm.exe. Guess that's the assembler.


Exactly. DSPSIM.EXE is the simulator. It's great neat stuff. There should also be some pdf manuals about the assembler and simulator.

 mrkotfw Jan 9, 2007

ob1 said:
I have started ! But then I saw a listing of Saturn Orbit showing a file called dspasm.exe. Guess that's the assembler.


You can't forget us Unix guys! That's why I asked

 ob1 Jan 9, 2007
OH !!! Got it !!!

I won't forget you. As soon as I find a little bit of time, I'll restart working on my assembler. It will be in Java if you don't mind. Well, maybe in C. Don't know really yet.

You guy make me want to dev more !

Even if, OMG, it seems to me that the Saturn is gonna be a hell to code, compared to the Genny !!!


CU

Olivier

 dibz Jan 9, 2007
I imagine Java or C would both be good, if you decide to release your sources others can always port the code to other languages if the need arises.

 mrkotfw Jan 9, 2007

ob1 said:
OH !!! Got it !!!

I won't forget you. As soon as I find a little bit of time, I'll restart working on my assembler. It will be in Java if you don't mind. Well, maybe in C. Don't know really yet.

You guy make me want to dev more !

Even if, OMG, it seems to me that the Saturn is gonna be a hell to code, compared to the Genny !!!

CU

Olivier


C would be better... By the way, you're only scratching the surface. Welcome to hell.:devil

 ob1 Jan 10, 2007

Piratero said:
By the way, you're only scratching the surface. Welcome to hell.:devil



The more I read docs on the Saturn, the more I know it'll be pretty damn hard to dev !!!

 ob1 Jan 10, 2007
From the SOA#8 (sattech.pdf, SEGA Saturn Technical Bulletins & all),

the MUL takes 1 cycle to complete, but the ALU computation is done in the same cycle.

The DSP can handle multiple operations simultaneously. They just have to be Operation commands and concern ALU or any different bus.

I can have an ALU computation, while a D1 bus access, while a X access, while a Y access ! 4 operations meanwhile, talk about parallelism ! All I have to do is to ensure that they are operation commands, that they do not concern the same bus and to write these operations on the same line :

Code:
  
	MOV M0,X	MOV M1,Y

In the same cycle, M0 is loaded into X register, and M1 is loaded into Y register. Meanwhile, the MUL is computing X * Y.

On the next step, MUL has finished and you can do

Code:
  
	MOV MUL,P

P = X * Y, then you can use P.


With, the ALU, you can do even faster :

Code:
  
	MOV M0,P	MOV M1,A

	ADD	MOV ALU,A	MOV ALL,MC2

In just a single cycle, you have done M2[CT2++] = M0 + M1

 Runik Jan 10, 2007
Just a remark : be careful with DSP docs as they're full of mistakes and typos (like every Sega doc translated from japanese to english )

 1  2  Next>