Alwaysblock2

2023. 6. 10. 20:03FPGA/HDLBits

728x90

Problem Statement

Build an XOR gate three ways, using an assign statement, a combinational always block, and a clocked always block. Note that the clocked always block produces a different circuit from the other two: There is a flip-flop so the output is delayed.

// synthesis verilog_input_version verilog_2001
module top_module(
    input clk,
    input a,
    input b,
    output wire out_assign,
    output reg out_always_comb,
    output reg out_always_ff   );

    assign out_assign = a^b;
    
    always @(*) 
        out_always_comb = a^b;
    
    always @(posedge clk) 
        out_always_ff = a^b;
    
endmodule

'FPGA > HDLBits' 카테고리의 다른 글

Always if2  (0) 2023.06.10
Always if  (0) 2023.06.10
Alwaysblock1  (0) 2023.06.10
Module addsub  (0) 2023.06.10
Module cseladd  (0) 2023.06.10