2022-09-29 16:23:17 -05:00
|
|
|
/////////////////////////////////////////
|
|
|
|
// Functionality: Use clock to gate the output of an AND2 gate
|
|
|
|
// This is to test if LUTs can be mapped as wires
|
|
|
|
// Author: Xifan Tang
|
|
|
|
////////////////////////////////////////
|
|
|
|
`timescale 1ns / 1ps
|
|
|
|
|
|
|
|
module clk_gate(
|
2022-09-29 17:32:31 -05:00
|
|
|
rst_i,
|
2022-09-29 16:23:17 -05:00
|
|
|
clk_i,
|
|
|
|
data_i,
|
|
|
|
data_o);
|
2022-09-29 17:32:31 -05:00
|
|
|
input wire rst_i;
|
2022-09-29 16:23:17 -05:00
|
|
|
input wire clk_i;
|
|
|
|
input wire data_i;
|
|
|
|
output wire data_o;
|
|
|
|
reg q;
|
|
|
|
|
|
|
|
always @(posedge clk_i) begin
|
2022-09-29 17:32:31 -05:00
|
|
|
if (rst_i) begin
|
|
|
|
q <= 0;
|
|
|
|
end else begin
|
|
|
|
q <= 1;
|
|
|
|
end
|
2022-09-29 16:23:17 -05:00
|
|
|
end
|
|
|
|
assign data_o = data_i & q;
|
|
|
|
|
|
|
|
endmodule
|