mirror of
https://github.com/myhdl/myhdl.git
synced 2024-12-14 07:44:38 +08:00
45a769d82d
--HG-- branch : 0.8-dev
45 lines
651 B
Verilog
45 lines
651 B
Verilog
// File: Inc.v
|
|
// Generated by MyHDL 0.8dev
|
|
// Date: Fri Dec 21 15:02:38 2012
|
|
|
|
|
|
`timescale 1ns/10ps
|
|
|
|
module Inc (
|
|
count,
|
|
enable,
|
|
clock,
|
|
reset
|
|
);
|
|
// Incrementer with enable.
|
|
//
|
|
// count -- output
|
|
// enable -- control input, increment when 1
|
|
// clock -- clock input
|
|
// reset -- asynchronous reset input
|
|
// n -- counter max value
|
|
|
|
output [7:0] count;
|
|
reg [7:0] count;
|
|
input enable;
|
|
input clock;
|
|
input reset;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
always @(posedge clock, negedge reset) begin: INC_INCLOGIC
|
|
if (reset == 0) begin
|
|
count <= 0;
|
|
end
|
|
else begin
|
|
if (enable) begin
|
|
count <= (count + 1);
|
|
end
|
|
end
|
|
end
|
|
|
|
endmodule
|