add flipflop

This commit is contained in:
Jose Luis Montañes Ojados
2026-03-01 01:21:07 +01:00
parent 8050e9a473
commit 1525373c61
3 changed files with 70 additions and 1 deletions

17
flip_flop/flip_flop.v Normal file
View File

@@ -0,0 +1,17 @@
/*
Flip-Flop D y registro
*/
module register #(parameter N = 8)(
input clk,
input rst,
input en,
input [N-1:0] d,
output reg [N-1:0] q
);
always @(posedge clk or posedge rst) begin
if (rst) q <= 0;
else if (en) q <= d;
end
endmodule