[SOLVED] bit-select or part-select is not allowed in a assign statement for non-net

Status
Not open for further replies.

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
 

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?
 
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
 

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