Assigning a single bit to 16 bit bus efficiently

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

Assigning a single bit to 16 bit bus efficiently

BLOB
I am writing ALU code and I need to do this:

I have a single bit input called zx, I need to assign the value of zx to all of the 16 bit buses of input of And16... In other words, I need the a[0..15] of And16 to have the same values which is equal to zx..

I KNOW I CAN ASSIGN THEM INDIVIDUALLY BUT I NEED AN EFFICIENT WAY OF ASSIGNING ALL THE 16 BIT PINS TO SAME VALUE OF zx...

PLZ TELL ME THE SYNTAX TO ACHIEVE THIS :(
Reply | Threaded
Open this post in threaded view
|

Re: Assigning a single bit to 16 bit bus efficiently

cadet1620
Administrator
BLOB wrote
I am writing ALU code and I need to do this:

I have a single bit input called zx, I need to assign the value of zx to all of the 16 bit buses of input of And16... In other words, I need the a[0..15] of And16 to have the same values which is equal to zx..

I KNOW I CAN ASSIGN THEM INDIVIDUALLY BUT I NEED AN EFFICIENT WAY OF ASSIGNING ALL THE 16 BIT PINS TO SAME VALUE OF zx...

PLZ TELL ME THE SYNTAX TO ACHIEVE THIS :(
There isn't an easy way to do this.  You can use a mux to make a 16-bit signal from a 1-bit signal
    Mux16 (sel=zx, a=false, b=true, out=zx16);
and then use zx16 as an input to your And16.

But think about it a bit more.  Can you use the mux by itself to do what you want?

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: Assigning a single bit to 16 bit bus efficiently

BLOB
Thanx... I will try to implement Mux in ALU