Forum Discussion
Altera_Forum
Honored Contributor
17 years agoLED/Debouncing problems
Hello All, I am trying to test LED/debouncing logic for basic gates. Following is my code module ledtesting ( input clock, input A, input B, output C, output D, output E, out...
Altera_Forum
Honored Contributor
17 years agoHey Kaz,
Thanks for your help in debugging the issue. It was actually a simple bug in my design. The push-buttons and the leds are at active low, while the logic i am trying to implement is active high so i had to convert the signals from debounce to active high, do my basic gates and then convert to active low to output at the leds. Thus i changed my code to lways @ (posedge slowclock) begin debounce1[3:1] = debounce1[2:0]; debounce1[0] = A; out1 = debounce1 == 4'h0 ? 1'b1 : 1'b0; debounce2[3:1] = debounce2[2:0]; debounce2[0] = B; out2 = debounce2 == 4'h0 ? 1'b1 : 1'b0; end assign C_c = (out1 & out2); assign D_c = (out1 | out2); assign E_c = ~(out1 & out2); assign F_c = ~(out1 | out2); assign C = ~C_c; assign D = ~D_c; assign E = ~E_c; assign F = ~F_c; and it worked. Thanks a ton for your help in debugging my issue. -Vinay