Verilog non-blocking vs blocking assignments

2018. 3. 10. 01:56NoC & SoC Design

1.non-blocking assignments.

module add(a, b, y, sel, clk);
input a, b;
output y;
input sel;
input clk;

reg y;
reg k;


always @(posedge clk)begin
   if(sel == 0)begin
       k <= a;
       y <= k;
    end
    else if(sel == 1)begin
       k <= b;
       y <= k;
    end
    else
     y <= 1'b0;
end


endmodule 



2.blocking assignments.


module add(a, b, y, sel, clk);
input a, b;
output y;
input sel;
input clk;

reg y;
reg k;


always @(posedge clk)begin
   if(sel == 0)begin
       k = a;
       y = k;
    end
    else if(sel == 1)begin
       k = b;
       y = k;
    end
    else
     y = 1'b0;
end


endmodule 



'NoC & SoC Design' 카테고리의 다른 글

RISC-V  (0) 2019.04.02
Synopsys ZeBu  (0) 2018.12.18
AMBA AXI  (0) 2018.11.07
Clock Domain Crossing  (0) 2018.03.10
Isolation Cell  (0) 2018.03.10