Forums - Open Redstone Engineers
Conditions for CPU - Printable Version

+- Forums - Open Redstone Engineers (https://forum.openredstone.org)
+-- Forum: ORE General (https://forum.openredstone.org/forum-39.html)
+--- Forum: School Discussion (https://forum.openredstone.org/forum-51.html)
+--- Thread: Conditions for CPU (/thread-11112.html)



Conditions for CPU - UnCluckable - 10-19-2016

I was trying to figure out conditions for a CPU I want to build. I tried to look at bennyscubes video, but that didn't help me. I've searched through the internet, found nothing. Is there any other place I can go to to learn about this stuff?

Looking for conditions like A = B ? A > B ? A < B ?


RE: Conditions for CPU - LambdaPI - 10-19-2016

You can use subtraction for that + a zero flag.

Zero flag basically checks whether or not the output is all zeros.

After doing A-B
1. IF zero flag is on and cout is on, then A=B
2. IF zero flag is off and cout is on, then A>B
3. IF zero flag is off and cout is off, then A<B

Its as simple as that. Hope this helps.


RE: Conditions for CPU - Koyarno - 10-19-2016

To further elaborate on lambda's post:

You can use 3 bits to single out the conditions to check for, so 1 bit checks A < B region, 1 does A = B and 1 does A > B.
This way you can make the total of 6: A < B, A <=B, A == B, A >=B, A > B, A != B (A < B and A > B enabled)

This system is what i use in my current cpu.

If you have control over which values you can compare, you dont need A < B where you could just use A > B and switch the registers for the subtraction/comparison.