title: Verilog: Adding individual bits of a register (combinational logic, register width is parameterizable)
body: <p>I am trying to come up with a way to add individual bits of a register. 
  eg, <code>if regA = 111000 then regB = 3</code> (Sum of bits of <code>regA</code>).
  1) Is there any synthesizable function/operator in Verilog or SystemVerilog which I can directly use to do this operation?</p>
  
  <p>If not, then maybe the problem is a little interesting, especially because the operation has to be done in one clock cycle (pure combinational logic) and the register width is parameterizable.</p>
  
  <p>2) In case there is no inbuilt Verilog or SystemVerilog operator then what can be done?</p>
  
  <p>Thanks,
  Ujjwal</p>