Skip to content

Instantly share code, notes, and snippets.

@houmei
Created January 24, 2013 11:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
// 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