Language/Verilog & SV

[Verilog] Sequential/parallel block

VIR&US 2025. 1. 28. 00:43
반응형

목차

    Sequential block(순차블록): begin-end

    • Declaration of data, local parameter, parameter, let, and statements
    • r은 순차적으로 #d마다 변화합니다.
    parameter d = 50;
    reg [7:0] r; // a waveform controlled
     
    begin // by sequential delay
            #d r = ’h35;
            #d r = ’hE2;
            #d r = ’h00;
            #d r = ’hF7;
            #d -> end_wave;// trigger an event
            // called end_wave
    end

     

    Parallel block(병렬블록): fork-join

    • The timing controls in a fork-join block do not have to be ordered sequentially in time
    • 순차블록과 달리 fork-join 구문 내 모든 문장의  # 딜레이가 동시에 시작합니다.
    fork
            #50 r = ’h35;
            #100 r = ’hE2;
            #150 r = ’h00;
            #200 r = ’hF7;
            #250 -> end_wave;
    join
    
    // joining of events
    begin
            fork
                   @Aevent;
                   @Bevent;
            join
            areg = breg; // will start after
    end // the 2 events done
    728x90
    반응형