Apr 24, 2022 #1 stackprogramer Full Member level 3 Joined Jul 22, 2015 Messages 181 Helped 0 Reputation 0 Reaction score 1 Trophy points 1,298 Activity points 2,668 How can I initialize a reg array in Verilog...Any offer? Code: reg m_shift_value[3:0]; initial begin //Initial registers assign {m_shift_value[3],m_shift_value[2],m_shift_value[1],m_shift_value[0]} = {0, 32, 64, 96}; end
How can I initialize a reg array in Verilog...Any offer? Code: reg m_shift_value[3:0]; initial begin //Initial registers assign {m_shift_value[3],m_shift_value[2],m_shift_value[1],m_shift_value[0]} = {0, 32, 64, 96}; end
Apr 24, 2022 #2 FvM Super Moderator Staff member Joined Jan 22, 2008 Messages 52,441 Helped 14,754 Reputation 29,790 Reaction score 14,108 Trophy points 1,393 Location Bochum, Germany Activity points 298,196 Why are you using assign statement in an initial block where you should use = ? How are assigning decimal literals to a bit array that can only take 0 and 1 values? Upvote 0 Downvote
Why are you using assign statement in an initial block where you should use = ? How are assigning decimal literals to a bit array that can only take 0 and 1 values?
Apr 24, 2022 #3 stackprogramer Full Member level 3 Joined Jul 22, 2015 Messages 181 Helped 0 Reputation 0 Reaction score 1 Trophy points 1,298 Activity points 2,668 Thanks very much so I concluded that I should use this method for initializing the reg array... I should use assign for wires... Code: initial begin reg m=0; for (k = 0; k < 4 - 1; k = k + 1) begin m_shift_value[k] = m; m=m+32; end end Upvote 0 Downvote
Thanks very much so I concluded that I should use this method for initializing the reg array... I should use assign for wires... Code: initial begin reg m=0; for (k = 0; k < 4 - 1; k = k + 1) begin m_shift_value[k] = m; m=m+32; end end