Using binary number as replicator in the replication operator

Status
Not open for further replies.

fragnen

Full Member level 4
Joined
Apr 3, 2019
Messages
211
Helped
0
Reputation
0
Reaction score
1
Trophy points
18
Activity points
1,490
Can m be binary numbers in the replication operator which is shown below? Here m is the replicator.

{m{variable for replicating}}

For example, in the below example a is replicated by 4'b0100. So m in below example is 4'b0100. Is it valid to write synrhesizble rtl code with the m in binary as shown below?

wire [3:0] x;
wire a;
assign x = { 4'b0100{a}};

Normally we see m to be in decimal in synthsizable rtl code that uses replication operator. So this question being asked.
 
Last edited:

In case of doubt review Verilog language reference manual. It requires a "non-negative, non-x, and non-z constant expression" for the concatenation constant but no specific number format.

The answer is yes.
 

    fragnen

    Points: 2
    Helpful Answer Positive Rating
In case of doubt review Verilog language reference manual. It requires a "non-negative, non-x, and non-z constant expression" for the concatenation constant but no specific number format.

The answer is yes.
Does it mean that even an expression can work as replicator?
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…