Skip to content

Instantly share code, notes, and snippets.

@houmei
Created May 8, 2013 16:46
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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