blob: 92ad895aa4714ccaa65133a810d2a8ebb82640a2 (
plain)
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
|
//-----------------------------------------------------
// Design Name : up_counter_load
// File Name : up_counter_load.v
// Function : Up counter with load
// Coder : Deepak Kumar Tala
//-----------------------------------------------------
module up_counter_load (
out , // Output of the counter
data , // Parallel load for the counter
load , // Parallel load enable
enable , // Enable counting
clk , // clock input
reset // reset input
);
//----------Output Ports--------------
output [7:0] out;
//------------Input Ports--------------
input [7:0] data;
input load, enable, clk, reset;
//------------Internal Variables--------
reg [7:0] out;
//-------------Code Starts Here-------
always @(posedge clk)
if (reset) begin
out <= 8'b0 ;
end else if (load) begin
out <= data;
end else if (enable) begin
out <= out + 1;
end
endmodule
|