Skip to content

Instantly share code, notes, and snippets.

@houmei
Created May 8, 2013 16:46
Show Gist options
  • Select an option

  • Save houmei/5541783 to your computer and use it in GitHub Desktop.

Select an option

Save houmei/5541783 to your computer and use it in GitHub Desktop.
barrel shifter byte-shift then bit-shift QuartusII DE0 target 207LE/284.41MHz
module sll64_byte (indata,val_nnnnxxx,outdata);
input [63:0] indata;
input [3:0] val_nnnnxxx; // shift
output [63:0] outdata;
assign outdata=indata<<(val_nnnnxxx<<3);
endmodule
module sll64_8bit (indata,val,outdata);
input [63:0] indata;
input [2:0] val; // shift 0-7
output [63:0] outdata;
assign outdata=indata<<val;
endmodule
module sll64_8_8 (indata,val,outdata);
input [63:0] indata;
input [63:0] val;
output [63:0] outdata;
wire [63:0] byteout;
sll64_byte sllbyte(indata,val[6:3],byteout);
// sll64_8bit sll8bit(byteout,val[2:0],outdata);
lpm_clshifa sll8bit(byteout,val[2:0],outdata); // ALTERA Megafunction
endmodule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment