Jun 3, 2014 #1 N 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: Jun 3, 2014
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!
Jun 3, 2014 #2 ads-ee Super Moderator Staff member Joined Sep 10, 2013 Messages 7,944 Helped 1,823 Reputation 3,656 Reaction score 1,808 Trophy points 1,393 Location USA Activity points 60,209 nervecell_23 said: 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! Click to expand... You mean a parameter (Generic is VHDL). assign some_signal = {width_paramter{1'b1}};
nervecell_23 said: 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! Click to expand... You mean a parameter (Generic is VHDL). assign some_signal = {width_paramter{1'b1}};
Jun 3, 2014 #3 N 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 ads-ee said: You mean a parameter (Generic is VHDL). assign some_signal = {width_paramter{1'b1}}; Click to expand... Right, exactly!
ads-ee said: You mean a parameter (Generic is VHDL). assign some_signal = {width_paramter{1'b1}}; Click to expand... Right, exactly!
Jun 3, 2014 #4 D dave_59 Advanced Member level 3 Joined Dec 15, 2011 Messages 843 Helped 366 Reputation 736 Reaction score 361 Trophy points 1,353 Location Fremont, CA, USA Activity points 7,478 Code: assign some_signal = ~0; also works when you do not have a width parameter avail.
Jun 4, 2014 #5 L layowblue Advanced Member level 4 Joined Mar 21, 2014 Messages 115 Helped 19 Reputation 38 Reaction score 18 Trophy points 18 Activity points 791 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
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
Jun 4, 2014 #6 ads-ee Super Moderator Staff member Joined Sep 10, 2013 Messages 7,944 Helped 1,823 Reputation 3,656 Reaction score 1,808 Trophy points 1,393 Location USA Activity points 60,209 layowblue said: 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? Click to expand... 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.
layowblue said: 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? Click to expand... 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.