Answers For HDLbits - Verilog Language_Procedures

链接https://hdlbits.01xz.net/wiki/Alwaysblock1

 

(1)Alwaysblock1

module top_module(
    input a, 
    input b,
    output wire out_assign,
    output reg out_alwaysblock
);
	assign out_assign = a & b;
	always @(*)
        out_alwaysblock = a & b ;
endmodule

 

(2)Alwaysblock2

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

 

(3)Always if

module top_module(
    input a,
    input b,
    input sel_b1,
    input sel_b2,
    output wire out_assign,
    output reg out_always   ); 
    
    assign out_assign = sel_b1? sel_b2? b:a :a;

    always@(*)
        if(sel_b1&sel_b2)
            out_always = b;
        else
            out_always = a;
endmodule

 

(4)待续

上一篇:MSSQL·阻止保存要求重新创建表的更改配置


下一篇:php – 每隔30分钟计算一次数据库上的重复记录