//======================================================= // This code is generated by Terasic System Builder //======================================================= module PwmCtrl(RST_N, CLK, LED0); input RST_N, CLK; output LED0; reg[27:0] counter0; always @(negedge RST_N or posedge CLK) begin if(RST_N == 1'b0) begin counter0 <= 0; end else begin counter0 <= counter0 + 1; end end assign LED0 = counter0[26]; endmodule
module DE0_NANO( //////////// CLOCK ////////// CLOCK_50, //////////// LED ////////// LED, //////////// KEY ////////// KEY );
//======================================================= // PARAMETER declarations //=======================================================
//======================================================= // PORT declarations //=======================================================
//////////// CLOCK ////////// input CLOCK_50; //////////// LED ////////// output [7:0] LED; //////////// KEY ////////// input [1:0] KEY;
//======================================================= // REG/WIRE declarations //=======================================================
//======================================================= // Structural coding //======================================================= PwmCtrl pwm(KEY[0], CLOCK_50, LED[0]); endmodule |