SHARE
TWEET

Untitled

a guest Apr 18th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. `timescale 1ns / 1ps
  2. //////////////////////////////////////////////////////////////////////////////////
  3. // Company:
  4. // Engineer:
  5. //
  6. // Create Date:    14:21:16 04/18/2019
  7. // Design Name:
  8. // Module Name:    barrel_shifter
  9. // Project Name:
  10. // Target Devices:
  11. // Tool versions:
  12. // Description:
  13. //
  14. // Dependencies:
  15. //
  16. // Revision:
  17. // Revision 0.01 - File Created
  18. // Additional Comments:
  19. //
  20. //////////////////////////////////////////////////////////////////////////////////
  21. module barrel_shifter(
  22.     input [3:0] a,
  23.     input [1:0] sel,
  24.     output [3:0] out
  25.     );
  26.  
  27. wire[3:0] muxl0_i,muxl1_i,mux_l;
  28. assign muxl0_i={1'b0,a[3],a[2],a[1]};
  29. assign muxl1_i={1'b0,1'b0,mux_l[3],mux_l[2]};
  30.  
  31. genvar i;
  32. generate
  33.     for(i=0;i<4;i=i+1)
  34.         begin
  35.             mux2_1 l1(.a(muxl0_i[i]),.b(a[i]),.sel(sel[0]),.out(mux_l[i]));
  36.             mux2_1 l2(.a(muxl1_i[i]),.b(mux_l[i]),.sel(sel[1]),.out(out[i]));
  37.         end
  38. endgenerate
  39. endmodule
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top