How to use a multi-bit version of a gate?

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

How to use a multi-bit version of a gate?

cygnus
Hi,

Is there any other way for setting all the bits or a section of a bus to a particular input other than setting each of them manually?

i.e can I do something like this in HDL?

And16(a[0..5] = in[0..5], b[0..5] = in[0..5], out[0..5] = out[0..5]);

 
Reply | Threaded
Open this post in threaded view
|

Re: How to use a multi-bit version of a gate?

cadet1620
Administrator
Primal wrote
Hi,

Is there any other way for setting all the bits or a section of a bus to a particular input other than setting each of them manually?

i.e can I do something like this in HDL?

And16(a[0..5] = in[0..5], b[0..5] = in[0..5], out[0..5] = out[0..5]);
Your syntax is good if 'in' and 'out' are buses at lest 6 bits wide.  See Appendix A 'buses' section.

Typical use is to process entire buses at once as in:
    CHIP AndOr16 {
        IN  a[16], b[16], c[16];
        OUT out[16];
        PARTS:
        And16(a=a, b=b, out=x);
        Or16(a=x, b=c, out=out);
    }    

--Mark