-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCounter-test2.v
More file actions
50 lines (46 loc) · 1.09 KB
/
Counter-test2.v
File metadata and controls
50 lines (46 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer: John Beale
//
// Create Date: 19:08:12 01/24/2015
// Design Name:
// Module Name: count2
// Project Name:
// Target Devices: Spartan-6 XC6SLX9-FTG256
// Tool versions:
// Description: simple counter
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module count2
#( parameter WIDTH = 29 )
(
input wire clk50,
// input wire ena1,
output reg [7:0] LEDS,
output reg PORTF10
);
reg [WIDTH:0] cnt;
wire clk; // clock signal
clkgen clkgen_inst (
.CLK_IN1(clk50), // external 50 MHz clock from pin
.CLK_OUT1(clk) ); // new clock signal
//always @(posedge CLK_OUT1)
always @(posedge clk)
begin
// if (ena1) begin
cnt <= cnt+1;
// end
LEDS[7] <= cnt[WIDTH];
LEDS[6] <= cnt[(WIDTH-1)];
LEDS[5] <= cnt[(WIDTH-2)];
LEDS[4:0] <= cnt[26:22];
PORTF10 <= cnt[21];
end
endmodule