0

Hi in Verilog what is the significance of this operation:

wire signal_A = |signal_B;

Is this possible with other logic operators?

1
  • It is a reduction OR: It OR-es all bit of B together. Thus A is high if at least one bit in B is high, A is low if all bits of B are low. Yes, you can use & or ^ too. Commented Jul 16, 2018 at 16:55

2 Answers 2

2

It's just a short-cut for

wire signal_A;
assign  signal_A = |signal_B;

IMHO, Verilog is full of unnecessary shortcuts making it more difficult to read and maintain.

Sign up to request clarification or add additional context in comments.

Comments

0

I should have been more explicit in the question.

But the answer is that this is used for logic on 2 varying width signals

wire signal_A;
wire [N:0] signal_B;

assign signal_A = |signal_B;

This is equivalent to

assign signal_A = signal_B[0] | ... | signal_B[N];

So not as verbose and explicit as VHDL, but quicker.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.