Advertisement Jump to content
Sign in to follow this  
Nice Coder


This topic is 4932 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

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 ??


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?

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):

x is in #1
y is in #2

#3 INC #1
#4 INV #2
#3 ADD #3 #4
#4 is 0x80000000
#3 AND #3 #4
#1 SetEvar #3 #4 #2
#2 SetEvar #3 #4 #1

That if you can use banks in parallel.

Share this post

Link to post
Share on other sites
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)
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)
And (you can't get away from these)
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?

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?

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

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

x is in #1 // #1 := x
y is in #2 // #2 := y

#3 INC #1 // #1 := x + 1
#4 INV #2 // #2 := inv(y)
#3 ADD #3 #4 // #3 := (x+1)+(inv(y)) = (x - y)
#4 is 0x80000000 // #4 := mask(sign bit of int)
#3 AND #3 #4 // #3 := sign of (x - y)
#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.

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!