1
0
mirror of https://github.com/myhdl/myhdl.git synced 2024-12-14 07:44:38 +08:00

41 lines
617 B
Coq
Raw Normal View History

2016-05-23 15:56:00 +02:00
// File: inc.v
// Generated by MyHDL 1.0dev
// Date: Sun May 22 18:46:37 2016
2010-07-02 13:24:04 +02:00
2008-11-22 22:40:25 +01:00
`timescale 1ns/10ps
2016-05-23 15:56:00 +02:00
module inc (
2008-11-22 22:40:25 +01:00
count,
enable,
clock,
reset
);
2010-07-02 13:24:04 +02:00
// Incrementer with enable.
//
// count -- output
// enable -- control input, increment when 1
// clock -- clock input
// reset -- asynchronous reset input
2008-11-22 22:40:25 +01:00
output [7:0] count;
reg [7:0] count;
input enable;
input clock;
input reset;
2016-05-23 15:56:00 +02:00
always @(posedge clock, negedge reset) begin: INC_SEQ
2012-12-21 14:36:07 +01:00
if (reset == 0) begin
2008-11-22 22:40:25 +01:00
count <= 0;
end
else begin
if (enable) begin
2012-12-21 15:06:18 +01:00
count <= (count + 1);
2008-11-22 22:40:25 +01:00
end
end
end
endmodule