40 lines
762 B
Verilog
40 lines
762 B
Verilog
`timescale 1ns / 1ps
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
// Company:
|
|
// Engineer:
|
|
//
|
|
// Create Date: 2024/11/24 20:35:59
|
|
// Design Name:
|
|
// Module Name: SyncDFlipFlop
|
|
// Project Name:
|
|
// Target Devices:
|
|
// Tool Versions:
|
|
// Description:
|
|
//
|
|
// Dependencies:
|
|
//
|
|
// Revision:
|
|
// Revision 0.01 - File Created
|
|
// Additional Comments:
|
|
//
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
module SyncDFlipFlop (
|
|
input wire D,
|
|
input wire clk,
|
|
input wire rst,
|
|
input wire set,
|
|
output reg Q
|
|
);
|
|
always @(posedge clk) begin
|
|
if (rst)
|
|
Q <= 0; // Reset Q clear
|
|
else if (set)
|
|
Q <= 1; // Set Q = 1
|
|
else
|
|
Q <= D;
|
|
end
|
|
endmodule
|
|
|