[SOLVED] Set all bits to 1 in Verilog

Status
Not open for further replies.

nervecell_23

Member level 1
Joined
Apr 26, 2013
Messages
38
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,565
For a signal whose word-length is a PARAMETER, how to set all its bits to 1 in Verilog?

Using '1 is not supported in some synthesis tool because it's a systemVerilog feature...

Thanks!
 
Last edited:

For a signal whose word-length is a GENERIC, how to set all its bits to 1 in Verilog?

Using '1 is not supported in some synthesis tool because it's a systemVerilog feature...

Thanks!
You mean a parameter (Generic is VHDL).

assign some_signal = {width_paramter{1'b1}};
 
Dave, how about :
assign some_signal = -'b1;

Also, if the signal width is more than 32, will the "~0" assignment still apply? If yes, how does verilog actually parse the code and resolve it?

Thanks
Leo
 
Also, if the signal width is more than 32, will the "~0" assignment still apply? If yes, how does verilog actually parse the code and resolve it?

I tried it with Vivado's simulator, which is only Verilog 2001 complient and yes it worked with a 128-bit signal. I don't think Verilog cares how may bits you put in a bit vector. In the case of integer Verilog is only defined for 32-bits.
 
Reactions: tahirsengine

    tahirsengine

    Points: 2
    Helpful Answer Positive Rating
    V

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…