Zeroing an input

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

Zeroing an input

ngdrummer
Hey, so I'm taking a course at a local college and we're using your website as the framework for the course! I'm currently working on my ALU and I've run into the issue of how to completely zero an input.

at first I tried:
Mux16(a=x, b=0, sel=zx, out=postzx);

which I got the error stating  I needed a "pin name", so I went with this:
Mux16(a=x, b=false, sel=zx, out=postzx);

And now it "compiles" fine (meaning the simulator will open it without errors) but I get an error when running the test script when zx is set to value 1, meaning when it's supposed to actually zero the values. Is there another way to zero all the values that I'm missing?

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Zeroing an input

ngdrummer
Nevermind, false worked, turned out to be another problem with my code that was generating the error.
Reply | Threaded
Open this post in threaded view
|

Re: Zeroing an input

cadet1620
Administrator
In reply to this post by ngdrummer
[Your second post just came in as I'm typing this; I'll post it anyway, for the benefit of future readers.]
ngdrummer wrote
Mux16(a=x, b=false, sel=zx, out=postzx);

And now it "compiles" fine (meaning the simulator will open it without errors) but I get an error when running the test script when zx is set to value 1, meaning when it's supposed to actually zero the values. Is there another way to zero all the values that I'm missing?
This is a correct way to select between 'x' and zero. The error is somewhere else in your circuit.

The ALU can be hard to debug because the computation and status flag outputs all need to be correct, and errors in the status circuitry can make it hard to concentrate on getting the computation correct.  See this post for an ALU test that ignores the status flags an lets you get the computation working. Once that test passes, you can run the ALU.tst script and debug your status flags.

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

Re: Zeroing an input

ngdrummer
Thanks Mark!

I'm glad to find out these forums are still super active, that was a quick response! Also, finally got my ALU working properly, though  took me 18 gates, most of which are 16bit, so optimization is pretty bogus on my end, but that's okay, first step of getting it to work completed!
Reply | Threaded
Open this post in threaded view
|

Re: Zeroing an input

cadet1620
Administrator
18 gates isn't too bad.  If you email me your HDL, I'll send you back a couple different versions I've written.

--Mark