Replicate 1 bit 16 times to give a 16 bit bus?

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

Replicate 1 bit 16 times to give a 16 bit bus?

rick2047
In my ALU design, I have used a certain logic which has to replicate a certain bit 16 times to make a 16 bit bus. Now this is trivial to do in the hardware, I just have to connect that one bit to 16 pins (not exactly considering the power problems, and that too can be solved by using a buffer). But I just cannot understand how to do this in the HDL.

Any suggestions?
Reply | Threaded
Open this post in threaded view
|

Re: Replicate 1 bit 16 times to give a 16 bit bus?

mgroat
I did it by creating an HDL file to take one pin input and replicate it as a sixteen pin output.  I'm hoping to find a more 'correct' way to do it before I get too far into it, but that should work as a last resort.
Reply | Threaded
Open this post in threaded view
|

Re: Replicate 1 bit 16 times to give a 16 bit bus?

culchie
If 'a' is a 16 bit input pin :

'a=false' inputs 0000000000000000
'a=true' inputs  1111111111111111
Reply | Threaded
Open this post in threaded view
|

Re: Replicate 1 bit 16 times to give a 16 bit bus?

cadet1620
Administrator
In reply to this post by rick2047
There were a couple times I wanted to expand a 1-bit signal into a 16-bit bus and came up with this one line, but rather inefficient, solution by thinking about strange ways to use the chips already made:

    Mux16(a=false, b=true, sel=1-bit-signal, out=16-bit-bus);

This is mostly just a cute trick, though.  It would be better to write a chip named something like Bus16 to do this job more efficiently.  It also makes the HDL more readable!