Permalink
Browse files

simple broken counter example

  • Loading branch information...
kmod committed Jul 17, 2013
1 parent e63055b commit 9c627b8074ac3ebc781cb0fe9aab9cfafaf8a387
Showing with 12 additions and 6 deletions.
  1. +5 −5 Nexys3_Master.ucf
  2. +7 −1 fpga.v
View
@@ -145,11 +145,11 @@ NET "sw<7>" LOC = "T5" | IOSTANDARD = "LVCMOS33"; #Bank = MISC, Pin
## Buttons
#NET "btn<0>" LOC = "B8" | IOSTANDARD = "LVCMOS33"; #Bank = 0, Pin name = IO_L33P, Sch name = BTNS
#NET "btn<1>" LOC = "A8" | IOSTANDARD = "LVCMOS33"; #Bank = 0, Pin name = IO_L33N, Sch name = BTNU
#NET "btn<2>" LOC = "C4" | IOSTANDARD = "LVCMOS33"; #Bank = 0, Pin name = IO_L1N_VREF, Sch name = BTNL
#NET "btn<3>" LOC = "C9" | IOSTANDARD = "LVCMOS33"; #Bank = 0, Pin name = IO_L34N_GCLK18, Sch name = BTND
#NET "btn<4>" LOC = "D9" | IOSTANDARD = "LVCMOS33"; #Bank = 0, Pin name = IO_L34P_GCLK19, Sch name = BTNR
NET "btn<0>" LOC = "B8" | IOSTANDARD = "LVCMOS33"; #Bank = 0, Pin name = IO_L33P, Sch name = BTNS
NET "btn<1>" LOC = "A8" | IOSTANDARD = "LVCMOS33"; #Bank = 0, Pin name = IO_L33N, Sch name = BTNU
NET "btn<2>" LOC = "C4" | IOSTANDARD = "LVCMOS33"; #Bank = 0, Pin name = IO_L1N_VREF, Sch name = BTNL
NET "btn<3>" LOC = "C9" | IOSTANDARD = "LVCMOS33"; #Bank = 0, Pin name = IO_L34N_GCLK18, Sch name = BTND
NET "btn<4>" LOC = "D9" | IOSTANDARD = "LVCMOS33"; #Bank = 0, Pin name = IO_L34P_GCLK19, Sch name = BTNR
## VGA Connector
View
8 fpga.v
@@ -22,6 +22,7 @@
module fpga(
input wire input_clk,
input wire [7:0] sw,
input wire [4:0] btn,
output wire [7:0] led,
output wire [7:0] seg,
output wire [3:0] an
@@ -32,5 +33,10 @@ module fpga(
assign led = sw;
sseg #(.N(16)) sseg(.clk(clk), .in({sw, sw}), .c(seg), .an(an));
reg [15:0] ctr;
always @(posedge clk) begin
if (btn[0]) ctr <= ctr + 1'b1;
end
sseg #(.N(16)) sseg(.clk(clk), .in(ctr), .c(seg), .an(an));
endmodule

0 comments on commit 9c627b8

Please sign in to comment.