math to compute the jump control bits

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

math to compute the jump control bits

ouverson
This post was updated on .
I'm working on my CPU implementation: the jump control bits specifically.

The jump control looks like it will need a truckload of And, Or and Not gates. In order to reduce the number I can, of course, use an Or8Way, and wire a Not gate to each jump instruction and fan out accordingly, but it still seems like a lot of And'ing and Or'ing.

Here's what I've got thus far:

C-instruction opcode / instruction[15] = a
Jump bit 3 / instruction[0] = b
Jump bit 2 / instruction[1] = c
Jump bit 1 / instruction[2] = d
zr out of ALU = e
ng out of ALU = f

THese are the scenarios where I need load = 1
a b c d e f
1 0 0 1 0 0
1 0 1 0 0 1
1 0 1 1 0 1
1 0 1 1 0 0
1 1 0 0 1 0
1 1 0 1 1 0
1 1 0 1 0 1
1 1 1 0 1 0
1 1 1 0 0 1
1 1 1 1

I see that I can pull the C-instruction opcode to end of And, Or gates to a final And gate: instruction[15] And ... Or, Or, Or, etc.

In previous projects, it was easier for me to see a pattern to reduce the gates (though the PC did take me some hours and help from the community).

Maybe there is no easy way to implement the jump control other than wiring together Not, And and Or gates; but figured I asked.
Reply | Threaded
Open this post in threaded view
|

Re: math to compute the jump control bits

WBahn
Administrator
Focus on each of the three jump bits separately.

Another way is to use the two flag bits to generate three signals (<,=,>) that tell you about the ALU output and then combine them very simply with the three jump bits.
Reply | Threaded
Open this post in threaded view
|

Re: math to compute the jump control bits

ouverson
This post was updated on .
I think that’s what I did?

Reply | Threaded
Open this post in threaded view
|

Re: math to compute the jump control bits

WBahn
Administrator
This post was updated on .
The approach you are using should work, but you've got a lot of redundant logic.

Say I have logic that makes the jump if the JLT bit (j1) is set and the ALU flag bits indicate that the answer is less than zero.

Now say that I have logic that makes the jump if the JEQ bit (j2) is set and the ALU flag bits indicate that the answer is zero.

If I OR those two together, do I really need to have additional logic that handles the JLE condition?
Reply | Threaded
Open this post in threaded view
|

Re: math to compute the jump control bits

ouverson
I see. I should be able to finish my CPU now.

Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: math to compute the jump control bits

Mike2345
In reply to this post by WBahn
Hello guys

I'm really Confused about how jump works all i know is that i have to do some math between the 3 jump bits and Control bit. however i have no idea which control bit to execute. All i know is which jump to execute. i felt like i'm the only one who didn't understand those. Can you give me some hints? Thank you