Showing posts with label Embedded. Show all posts
Showing posts with label Embedded. Show all posts

Monday, December 27, 2010

Barrel Shifter


Barrel shifter at behavioural level:


module barr_shf (data , amount ,type, out);
input [3:0] data;
input [1:0] amount , type;
output reg [3:0] out;
always @ (type or amount or out or data)
case (type)  
0: out = data >> amount;   
1: out = data << amount;