공부방/Verilog_HBLBits

Always if2_ CPU_overheated

맘스터치보단파파이스 2024. 5. 13. 15:44

// synthesis verilog_input_version verilog_2001
module top_module (
    input      cpu_overheated,
    output reg shut_off_computer,
    input      arrived,
    input      gas_tank_empty,
    output reg keep_driving  ); //

    always @(*) begin
        if (cpu_overheated)
           shut_off_computer = 1;
        else
            shut_off_computer = 0;
    end

    always @(*) begin
        if (~arrived) 
           keep_driving = ~gas_tank_empty;


        else if(arrived)begin
            keep_driving = gas_tank_empty; 
            if((gas_tank_empty == 1)|| (cpu_overheated==1)) keep_driving = 0;
        end     
    end
    

endmodule

// synthesis verilog_input_version verilog_2001
module top_module (
    input      cpu_overheated,
    output reg shut_off_computer,
    input      arrived,
    input      gas_tank_empty,
    output reg keep_driving  ); //

    always @(*) begin
        if (cpu_overheated)
           shut_off_computer = 1;
        else
            shut_off_computer = 0;
    end

    always @(*) begin
        if (~arrived) 
           keep_driving = ~gas_tank_empty;


        else if(arrived)begin
            keep_driving = gas_tank_empty; 
            if((gas_tank_empty == 1)&& (cpu_overheated==1)) keep_driving = 0;
        end     
    end
    

endmodule

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

 

Always if2 - HDLBits

 

hdlbits.01xz.net

 

'공부방 > Verilog_HBLBits' 카테고리의 다른 글

case z  (0) 2024.05.13
9X1 MUX _ out = '1  (0) 2024.05.10
CONCAT_REG  (0) 2024.04.03
HDLBITS_start  (0) 2024.04.02