Jump to content
  • Advertisement
Sign in to follow this  
Nice Coder

redacted

This topic is 4875 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Guest Anonymous Poster


a MAP or Translate

input 1
data a count and array of size count+1 (first or last is out of range default)

output is set to value in array corresponding to the input position in the array.

(secondary use if for offset jumps (like a switch/case statement) and the values are address/relative offset


What is this for ??
Simple is fine for a superscalar RISC but terrible for a interpretor language.



Mult (not just power of 2 -- shifts)

Min/Max ??

ABS


Not having sub makes doing compare > = = <

Share this post


Link to post
Share on other sites
How do you use constants in the middle of your program?
Could it be as simple as in normal asm? Or do you have to explicitly insetr constant in the register?

Quote:
Original post by Nice Coder
Min/Max, i'm looking for a good version for these


x - y = x + (-y) = x + (inv(y) + 1) = (x+1) + inv(y)
So the program (assuming we have to explicitly insert mask into register):

minmax(x,y):
x is in #1
y is in #2

clock1:
#3 INC #1
#4 INV #2
clock2:
#3 ADD #3 #4
#4 is 0x80000000
clock3:
#3 AND #3 #4
clock4:
#1 SetEvar #3 #4 #2
#2 SetEvar #3 #4 #1

That if you can use banks in parallel.
/def

Share this post


Link to post
Share on other sites
Quote:
Original post by Nice Coder
Which instructions would you require as absolutely essential/Really useful for doing things very quickly. (ie. something like SUM).

Currently i've got (all int i'm afraid. i got no idea how to do floating point arithmatic in hw).

Add (no sub)
Inv
Inc (INV + INC = NEG, so if you have -210, you INV it, then INC it to turn it into 210. Is inc really nessisary?)
Sum (just for performance, four inputs, one output. Out = in1 + in2 + in3 + in4)
Gbarrel (two inputs, and you determine wether your shifting right or left by using the lsb.)
Lshift (same thing, just a required shift direction)
Rshift
And (you can't get away from these)
Or
Xor
SetEvar (Pretty much, if x == y, then set its output to Z. Three input)
SetNvar (Same thing just x != y)
Set (just output = input)

Importaint - These are the jumps as well. Instead of jmp 210, you would use #Pc set 210)

Am i missing anyhing massively importaint?

From,
Nice coder

okay, subtract can [and usually is] be implemented using an adder combined with a bit to invert all of the parts of one input

so now you can do invert

but still you have the adder attached, you can do invert and increment in the same cycle


I don't belive you'd often add many inputs like that [in sum]

... I don't understand gbarrel, yes a set would be important. the pentium 4 has conditional loads and stores...


I think I missed something fundamental

Share this post


Link to post
Share on other sites
Didn't quite catch your explanation about data segments. Could you explain it more?

Quote:
Original post by Nice Coder
Can you explain how that works :-)


I'll add comments saying what is inside each bank.

minmax(x,y):
x is in #1 // #1 := x
y is in #2 // #2 := y

clock1:
#3 INC #1 // #1 := x + 1
#4 INV #2 // #2 := inv(y)
clock2:
#3 ADD #3 #4 // #3 := (x+1)+(inv(y)) = (x - y)
#4 is 0x80000000 // #4 := mask(sign bit of int)
clock3:
#3 AND #3 #4 // #3 := sign of (x - y)
clock4:
#1 SetEvar #3 #4 #2 // if (the sign == 0x80000000) then #1 := y (else stays as x)
#2 SetEvar #3 #4 #1 // if (the sign == 0x80000000) then #2 := x (else stays as y)

And in the end #1 gets max and #2 gets min.


Also, is your goal to limit the amount of opcodes, or to speed up calculations?
If latter, I'd sugest adding XCHG opcode.
/def

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!