Initial commit

This commit is contained in:
2025-11-06 10:08:01 +08:00
commit 0bded5b86e
1033 changed files with 55966 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2024/11/27 04:01:26
// Design Name:
// Module Name: AsyncDFlipFlop_tb
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module AsyncDFlipFlop_tb;
reg D, clk, rst, set;
wire Q;
AsyncDFlipFlop uut (
.D(D),
.clk(clk),
.rst(rst),
.set(set),
.Q(Q)
);
initial begin
clk = 0;
forever #10 clk = ~clk;
end
initial begin
D = 0; rst = 0; set = 0; #15;
// Reset test
rst = 1; #20;
rst = 0; #20;
// Set test
set = 1; #20;
set = 0; #20;
// Data input test
D = 1; #30;
D = 0; #30;
$stop;
end
endmodule

View File

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