Kavya
Kavya

Reputation: 21

What is the difference between 2'b0 and 2'd0?

I was tying a port to zero in my design. What is the difference between 2'b0 and 2'd0 in Verilog?

What does b and d actually mean?

Upvotes: 2

Views: 5054

Answers (1)

dave_59
dave_59

Reputation: 42698

b and d are the base radix of the numeric literal; binary and decimial respectively. They are equivalent values in your case. In both literals, you are specifying 2-bit width values, with both bits having a '0' value. 2'b11 and 2'd3 would also be equivalent, with both bits having a '1' value.

Note that you can also write '0 which is a fill literal that expands to the width of the port.

Upvotes: 5

Related Questions