shifting

R

raghu

Guest
consider a bit sequence 11001010. Is it possible using an operator in
verilog to shift only a part of the bit sequence i.e first 3 bits 110
<<1, kepping other bits unchanged ? The output should be 10001010.

Thanks a lot in advance.

Regards,
Raghu
 
On 10 Jul 2006 04:36:27 -0700, raghu
<raghujindia@gmail.com> wrote:

consider a bit sequence 11001010. Is it possible using an operator in
verilog to shift only a part of the bit sequence i.e first 3 bits 110
1, kepping other bits unchanged ? The output should be 10001010.
Why not?

reg [7:0] sequence;
....
sequence = 8'b11001010;
$display("Before shift: %b", sequence);
sequence[7:5] = sequence[7:5] << 1;
$display("After shift: %b", sequence);
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.bromley@MYCOMPANY.com
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 

Welcome to EDABoard.com

Sponsor

Back
Top