본문 바로가기
전자공학/디지털회로

[Verilog] Latches and Flip-floops

by 17Hyuk 2022. 12. 22.

https://hdlbits.01xz.net/wiki/Problem_sets

 

Problem sets - HDLBits

 

hdlbits.01xz.net

 

 

Dff8

module top_module (
    input clk,
    input [7:0] d,
    output [7:0] q
);

    always @(posedge clk) begin
    	q <= d;
    end

endmodule

 

 

Dff8r

Synchronous reset

module top_module (
    input clk,
    input reset,            // Synchronous reset
    input [7:0] d,
    output [7:0] q
);
    
    always @(posedge clk) begin
        if(reset)
            q <= 8'h00;
        else
            q <= d;
    end
    
endmodule

 

 

Dff8ar

Asynchronous reset

module top_module (
    input clk,
    input areset,   // active high asynchronous reset
    input [7:0] d,
    output [7:0] q
);

    always @(posedge areset, posedge clk) begin
        if(areset)
            q <= 8'h00;
        else
            q <= d;
    end

endmodule

 

'전자공학 > 디지털회로' 카테고리의 다른 글

[Verilog] Counter  (0) 2022.12.26
[Verilog] Gate-Level에서 D Latch & D Flip-Flop  (0) 2022.12.25
[Verilog] Arithmetic Circuit  (0) 2022.12.21
[Verilog] Multiplexer  (1) 2022.12.21
[Verilog] Basic Gate  (0) 2022.12.20

댓글