This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // terasIC DE0 topmodule skeleton | |
| // onboard I/O 3-button,10-sw,10-LED,4-7SEG | |
| // | |
| module Skeleton(clk,btn,sw,led,hled0,hled1,hled2,hled3,lcd_bl); | |
| input clk; | |
| input [2:0] btn; | |
| input [9:0] sw; | |
| output [9:0] led; | |
| output [7:0] hled0; | |
| output [7:0] hled1; | |
| output [7:0] hled2; | |
| output [7:0] hled3; | |
| output lcd_bl; | |
| assign led=(btn[2]==1'b1) ? sw: ~sw; // button2 press, then invert all LED | |
| assign hled0[7:0]=(btn[1:0]==2'b11) ? ~sw[7:0]: 8'b11111111; // 7segment digit xxx0 | |
| assign hled1[7:0]=(btn[1:0]==2'b10) ? ~sw[7:0]: 8'b11111111; // 7segment digit xx0x press button 0 | |
| assign hled2[7:0]=(btn[1:0]==2'b01) ? ~sw[7:0]: 8'b11111111; // 7segment digit x0xx press button 1 | |
| assign hled3[7:0]=(btn[1:0]==2'b00) ? ~sw[7:0]: 8'b11111111; // 7segment digit 0xxx press button 1,0 | |
| assign lcd_bl=sw[9]; // optiona LCD backlight | |
| endmodule | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment