I write this module to arithmetic shift to left and right in verilog
From our discussion in comments, it seems the problem is operator precedence. According to this, + has higher precedence than &lt;&lt;&lt;, so your expression will calculate (A &lt;&lt;&lt; (2 + B)) &gt;&gt;&gt; 1 rather than what you might expect. 

This can be solved by adding parentheses to ensure the expected order of operations.