Got struck in converting a pin to 8 pins

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

Got struck in converting a pin to 8 pins

ganesshk
This is what I am trying to achieve. My input is a single pin 'a'. And my output is out[8]. Whatever is in 'a', is should be in all the 8 pins of 'out'. How to do it?

Or in the PARTS sections declaring a temporary array of pins like 'out[8]' will also be helpful. I have tried to find this but in vain.

Thanks for your help.

Ganessh.
Reply | Threaded
Open this post in threaded view
|

Re: Got struck in converting a pin to 8 pins

cadet1620
Administrator
ganesshk wrote
This is what I am trying to achieve. My input is a single pin 'a'. And my output is out[8]. Whatever is in 'a', is should be in all the 8 pins of 'out'. How to do it?

Or in the PARTS sections declaring a temporary array of pins like 'out[8]' will also be helpful. I have tried to find this but in vain.
Arrays of wires are called buses. There's a section about them in Appendix A.5.3.

You don't declare an internal bus, you simply create it by connecting it to an output. Normally it is created the same width as the bus it is connected to, but you can create a bus that is narrower than the bus it's connected to.

There is no direct way to connect a single wire to a bus, but you can do it using a Mux16:
    Mux16(sel=w1, a=false, b=true, out[0..7]=w8);
will create the 8-bit bus "w8" with all bites set to "w1". Note wow "true" and "false" work with buses.

--Mark