mirror of
https://github.com/myhdl/myhdl.git
synced 2024-12-14 07:44:38 +08:00
53 lines
859 B
Verilog
53 lines
859 B
Verilog
// File: gray_inc_reg.v
|
|
// Generated by MyHDL 1.0dev
|
|
// Date: Thu Jun 23 19:06:43 2016
|
|
|
|
|
|
`timescale 1ns/10ps
|
|
|
|
module gray_inc_reg (
|
|
graycnt,
|
|
enable,
|
|
clock,
|
|
reset
|
|
);
|
|
|
|
|
|
output [7:0] graycnt;
|
|
reg [7:0] graycnt;
|
|
input enable;
|
|
input clock;
|
|
input reset;
|
|
|
|
wire [7:0] graycnt_comb;
|
|
reg [7:0] gray_inc_1_bincnt;
|
|
|
|
|
|
|
|
always @(posedge clock, negedge reset) begin: GRAY_INC_REG_GRAY_INC_1_INC_1_SEQ
|
|
if (reset == 0) begin
|
|
gray_inc_1_bincnt <= 0;
|
|
end
|
|
else begin
|
|
if (enable) begin
|
|
gray_inc_1_bincnt <= (gray_inc_1_bincnt + 1);
|
|
end
|
|
end
|
|
end
|
|
|
|
|
|
|
|
assign graycnt_comb = ((gray_inc_1_bincnt >>> 1) ^ gray_inc_1_bincnt);
|
|
|
|
|
|
always @(posedge clock, negedge reset) begin: GRAY_INC_REG_REG_0
|
|
if (reset == 0) begin
|
|
graycnt <= 0;
|
|
end
|
|
else begin
|
|
graycnt <= graycnt_comb;
|
|
end
|
|
end
|
|
|
|
endmodule
|