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?

jsalaz1989
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?

Eg.

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.


Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Using function as parameter?

cadet1620
Administrator
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.

--Mark