load value of register in PC

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

load value of register in PC

TommyM
Hi all,

Since this is my first post in this forum I would like to begin by thanking some of you for the time you put into answering questions on this forum. They have helped me out on several occasions and are invaluable.

I have just completed my implementation of the PC and I have a question about a (minor?) detail of my implementation.

In the last step of the PC we have to update/read the register. If reset, load and inc are all 0, we could basically output the current state of the register. But since the logic doesn't really change the out(t-1) in this case, we could just always set the load to 1 in the register, and set the in to the current internal out. This would write to the register every clock cycle of the PC.

E.g:

    Register(in=rnew, load=true, out=new, out=out);

My question is whether this is bad practice. It's easily fixable by doing a double OR on the input flags of the PC.

E.g:

    Or(a=reset, b=load, out=l1);
    Or(a=l1,    b=inc, out=l2);

    Register(in=rnew, load=l2, out=new, out=out);

Note that both these cases work fine, and result in the PC HDL implementation passing the tests, but I wonder if the second case would result in a more performant PC.

Best,
Tommy
Reply | Threaded
Open this post in threaded view
|

Re: load value of register in PC

cadet1620
Administrator
TommyM wrote
    Register(in=rnew, load=true, out=new, out=out);

My question is whether this is bad practice. It's easily fixable by doing a double OR on the input flags of the PC.
This is OK. It basically changes the register into a DFF16. It is not uncommon in real hardware to use more complex parts for simpler functions.

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: load value of register in PC

reflectionalist
In reply to this post by TommyM
TommyM wrote
...

This would write to the register every clock cycle of the PC.

E.g:

    Register(in=rnew, load=true, out=new, out=out);

My question is whether this is bad practice.
...

but I wonder if the second case would result in a more performant PC.
I think a running processor will always have one of the three PC control bits set.  Consequently, the PC will be written in every cycle anyway.  So I guess the one-liner will probably not cause any performance penalty.  Someone please correct me in case I am wrong.