Add Lab work No2
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
/////////////////////////////
|
||||
// Author - Imants Pulkstenis
|
||||
// Date - 24.03.2020
|
||||
// Project name - Lab work No2 - Counter
|
||||
// Module name - counter module
|
||||
//
|
||||
// Detailed module description:
|
||||
//
|
||||
// This module counts form 0000 to ffff
|
||||
// in hex
|
||||
//
|
||||
//
|
||||
// Revision:
|
||||
// A - initial design
|
||||
// B -
|
||||
//
|
||||
//
|
||||
/////////////////////////////
|
||||
|
||||
module counter (
|
||||
input clk,
|
||||
input reset,
|
||||
output [15:0] counter);
|
||||
|
||||
always@(posedge clk) begin
|
||||
if (reset == 'b1) begin
|
||||
r_counter <= 'b0;
|
||||
end
|
||||
else begin
|
||||
r_counter <= r_counter + 1;
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
reg [15:0] r_counter = 'b0;
|
||||
|
||||
assign counter = r_counter;
|
||||
|
||||
endmodule
|
||||
Reference in New Issue
Block a user