Not the output ALU

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

Not the output ALU

dmoeller
To not the output of the ALU if no==1, can i call not like this:
Not (in=out out=NegOut);

?
Reply | Threaded
Open this post in threaded view
|

Re: Not the output ALU

cadet1620
Administrator
dmoeller wrote
To not the output of the ALU if no==1, can i call not like this:
Not (in=out out=NegOut);
You need to use Not16 since you are dealing with 16-bit wide data.

This is another case of an if-then-else structure that you need to write using a Mux16.

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

Re: Not the output ALU

dmoeller
I know that.

Mux16(a=out, b=Not(in=out, out=NotOut), sel=no, out=NotOut);

Can I do it like this?
Reply | Threaded
Open this post in threaded view
|

Re: Not the output ALU

cadet1620
Administrator
dmoeller wrote
Mux16 (a=out, b=Not(in=out, out=notOut), sel=no, out=NotOut);
HDL is not a programming language. The parts are not "functions" that return values.

HDL is a description of a wiring diagram. You need to write each part individually and the wires that connect the parts all need to have names.
Your 'no' handling need to be something like
Somepart (..., out=fnOut);
Not (in=fnOut, out=NotFnOut);
Mux16(a=fnOut, b=notFnOut, sel=no, out=out, out=..., out=..., ...);
HDL does not allow connections from outputs named in the OUTPUT line to internal parts. The extra out= connections let you make signals that you need to generate the zr and ng outputs.

--Mark