mtveezy
mtveezy

Reputation: 711

Promote one-bit wire to 64-bit bus

I have a 64-bit bus, and I would like to & every bit of the bus with a one-bit wire. What's the best way to do this? I would like to do something like below, but it doesn't seem to work as expected.

logic [63:0] bus, other_bus;
logic signal;
...
bus = other_bus & signal;

Upvotes: 2

Views: 2660

Answers (2)

Sourabh
Sourabh

Reputation: 674

you can also try this :- for (i=0,i<=63;i++) begin:ANDLoop bus[i] = other_bus[i] & signal; end:ANDLoop

Upvotes: -2

toolic
toolic

Reputation: 62037

Replicate signal 64 times. Refer to the IEEE Std 1800-2012, section 11.4.12.1 "Replication operator":

bus = other_bus & {64{signal}};

Upvotes: 8

Related Questions