Using function as parameter?

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

Using function as parameter?

Hey guys,

I'm not finding this question on this forum or on Google. Do chips have "return values"? In other words, can you use a function as a parameter?


Something like this is typical and works:

     Not(in=b, out=notb);
     And(a=a, b=notb, out=o1);

Is it possible to consolidate in this form?

     And(a=a, b=Not(in=b, out=notb), out=o1);

The Hardware Simulator doesn't seem to like this notation. I see on Page 15 of Chapter 1 that the sample Xor implementation can be Xor(a, b) = Or(And(a, Not(b)), And(Not(a),(b)) but I think the authors are just describing it conceptually, rather than implying a similar structure can be used in their HDL.

Reply | Threaded
Open this post in threaded view

Re: Using function as parameter?

You are correct.

HDL does not allow nesting of Parts in its commands.  The notation "Or( And(..." is just that -- an unambiguous way to write logic expressions in text.

HDL is described in Appendix A.