How to get ng in ALU?

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

How to get ng in ALU?

BLOB
This is a simple problem but having problem with syntax...

In ALU, if out[15] is equal to 0, then ng is also zero else it is 1 right?

So, To get ng output, I made And Gate like this
And (a=out[15], b=out[15], out=ng);

But, I am getting some error telling "Can't connect gates output to pin to part...... " (cant read the full error msg)

Why am i getting this error and how to fix this?
Reply | Threaded
Open this post in threaded view
|

Re: How to get ng in ALU?

BLOB
Solved it...

I read the Hardware construction survival kit and in the last part it was mentioned.

Reply | Threaded
Open this post in threaded view
|

Re: How to get ng in ALU?

cadet1620
Administrator
In reply to this post by BLOB
BLOB wrote
This is a simple problem but having problem with syntax...

In ALU, if out[15] is equal to 0, then ng is also zero else it is 1 right?

So, To get ng output, I made And Gate like this
And (a=out[15], b=out[15], out=ng);

But, I am getting some error telling "Can't connect gates output to pin to part...... " (cant read the full error msg)

Why am i getting this error and how to fix this?
HDL does not allow you to connect pins named in OUTPUT statements to part inputs, only to outputs. What you need to do is connect the output of one of the parts in your ALU to ng.

Somewhere in your HDL you connect a part's out to the ALU's out:
    SomePart (..., out=out);
On this part you can connect several things to the part's out:
    SomePart (..., out=out, out[15]=ng, ...);
You will also want to add some other connections to this part's out so that you can compute zr.

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

Re: How to get ng in ALU?

BLOB
Finally... My ALU is complete.. I was getting comparison error because I used And16 instead of Add16... Took some time to realize that... :)
Reply | Threaded
Open this post in threaded view
|

Re: How to get ng in ALU?

ismithers
I had read the survival guide but had forgotten parts of it, so thanks for this post as it helped me. :)