1Bit Register Comparison issue

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

1Bit Register Comparison issue

sharmaankush347
I hv been using this code for 1 bit register but I am getting comparison failure ,
Kindly suggest me what should I change or Improve.

                   Mux (a=in, b=true, sel=false, out=out1mux);
                   DFF( in=out1mux, out=out1dff);
                   Mux( a=out1dff, b=in, sel=load, out=out2mux);
                   DFF( in=out2mux, out=out2dff);
                   Mux( a=out2dff, b=in, sel=load, out=out3mux);
                   DFF( in=out3mux, out=out);
 Same problem comes if I remove last set of Mux and DFF chips and modify pins.
Reply | Threaded
Open this post in threaded view
|

Re: 1Bit Register Comparison issue

WBahn
Administrator
It's a 1-bit register. It stores a single bit. You have three DFFs, which means that you are storing three bits of information.

You also have Mux parts with the sel line hardcoded to a fixed value, which means that the Mux serves no purpose.

Give those items some thought.
Reply | Threaded
Open this post in threaded view
|

Re: 1Bit Register Comparison issue

sharmaankush347
Main target is to handle input at time t=0, how may I handle that issue with just one set of mux and DFF
Reply | Threaded
Open this post in threaded view
|

Re: 1Bit Register Comparison issue

WBahn
Administrator
What issue are you trying to address at t=0 specifically?

Just implement the behavior that the new output will be the input at the prior time if the load signal at the prior time was HI, otherwise the new output will be the prior output.

Don't overthink it.

The behavior at t=0 is NOT defined.
Reply | Threaded
Open this post in threaded view
|

Re: 1Bit Register Comparison issue

sharmaankush347
Oh yeah! I GOT It . Trick was itself in DFF , I just needed different outpin from the DFF.

On Wed, 19 Aug, 2020, 08:23 WBahn [via Nand2Tetris Questions and Answers Forum], <[hidden email]> wrote:
What issue are you trying to address at t=0 specifically?

Just implement the behavior that the new output will be the input at the prior time if the load signal at the prior time was HI, otherwise the new output will be the prior output.

Don't overthink it.

The behavior at t=0 is NOT defined.



If you reply to this email, your message will be added to the discussion below:
http://nand2tetris-questions-and-answers-forum.32033.n3.nabble.com/1Bit-Register-Comparison-issue-tp4035014p4035023.html
To unsubscribe from 1Bit Register Comparison issue, click here.
NAML