buttons.v 566 B

123456789101112131415161718192021222324252627
  1. `timescale 1ns / 1ps
  2. module buttons(
  3. input CLK,
  4. input BTN1,
  5. input BTN2,
  6. input BTN3,
  7. input BTN_N,
  8. output reg [15:0] duty_val
  9. );
  10. wire [3:0]butts={BTN_N,BTN3,BTN2,BTN1};
  11. reg [3:0]butts_buf;
  12. //b1111111111111100 - ciemne
  13. always @(posedge CLK) begin
  14. case(butts)
  15. 4'b0001: duty_val <= 16'b0000000000000000;
  16. 4'b0010: duty_val <= 16'b0000000000000000;
  17. 4'b0100: duty_val <= 16'b0000000000000000;
  18. 4'b1000: duty_val <= 16'b1000000000000000;
  19. default: duty_val <= 16'b0000000000000000;
  20. endcase
  21. butts_buf<=butts;
  22. end
  23. endmodule