Advertisement
akatla

UnB PIL 0017

Mar 21st, 2021
1,463
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. `timescale 1ns / 1ps
  2. //////////////////////////////////////////////////////////////////////////////////
  3. // Company:
  4. // Engineer:        LSV
  5. //
  6. // Create Date:    12:05:11 26/11/2018
  7. // Design Name:      Clock project
  8. // Module Name:    Clock_one
  9. // Project Name:   Simple clock with voice alarm!
  10. // Target Devices: SPARTAN-6
  11. // Tool versions:
  12. // Description:    Try to create clock and be cool and have a fun
  13. // working with FPGA! :)
  14. // Dependencies:  
  15. //
  16. // Revision:
  17. // Revision 0.01 - File Created
  18. // Additional Comments:
  19. //
  20. //////////////////////////////////////////////////////////////////////////////////
  21. module UnBounceBB(
  22. input  iclk,
  23. input  iin ,
  24. output iout
  25. );
  26.  
  27. parameter STAGE = 10;
  28.  
  29. wire  [STAGE-1:0] chain_nxt;
  30. wire  deb_nxt;
  31. reg   [STAGE-1:0] chain;
  32. reg   deb;
  33.  
  34. assign iout = deb;
  35. assign chain_nxt = {chain[STAGE-2:0], iin};
  36. assign deb_nxt   = &chain[STAGE-1:1] ? 1'b1 : ~(|chain[STAGE-1:1]) ? 1'b0 : deb;
  37.  
  38. always @(posedge iclk)
  39.     begin
  40.         chain <= chain_nxt;
  41.         deb   <= deb_nxt;
  42.     end
  43.  
  44. endmodule
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement