首页 > 其他 > 详细

Blocking & Nonblocking module

时间:2014-10-02 22:24:54      阅读:374      评论:0      收藏:0      [点我收藏+]

/***************************************************

/  Blocking and Nonblocking circuit and Simulation

/  Using level sensitive event

/  Programing by seongki

***************************************************/

module Blocking (in_A,in_B,in_C,in_D,out_A,out_B,out_C,out_D);

input [3:0] in_A,in_B,in_C,in_D;

output [3:0] out_A,out_B,out_C,out_D;

reg [3:0] out_A,out_B,out_C,out_D;

 

always@(in_A or in_B or in_C or in_D)

  begin

    out_C=in_C; out_B=in_B; out_A=in_A; out_D=in_D;

    out_A=out_D; out_B=out_A; out_C=out_B; out_D=out_D;

  end

endmodule

 

// testbench

`timescale 1ns/1ns

module tb_Blocking;

reg [3:0] in_A,in_B,in_C,in_D;

wire [3:0] out_A,out_B,out_C,out_D;

 

Blocking test1(in_A,in_B,in_C,in_D,out_A,out_B,out_C,out_D);

initial

  begin

    in_A = 5;

    in_B = 3;

    in_C = 10;

    in_D = 2; #250

    $stop;

  end

endmodule

bubuko.com,布布扣

/****************************************************************/

module NonBlocking (in_A,in_B,in_C,in_D,out_A,out_B,out_C,out_D);

input [3:0] in_A,in_B,in_C,in_D;

output [3:0] out_A,out_B,out_C,out_D;

reg [3:0] out_A,out_B,out_C,out_D;

 

always@(in_A or in_B or in_C or in_D)

  begin

    out_C=in_C; out_B=in_B; out_A=in_A; out_D=in_D;

    out_A<=out_D; out_B<=out_A; out_C<=out_B; out_D<=out_D;

  end

endmodule

// testbench

`timescale 1ns/1ns

module tb_nonBlocking;

reg [3:0] in_A,in_B,in_C,in_D;

wire [3:0] out_A,out_B,out_C,out_D;

 

NonBlocking test2(in_A,in_B,in_C,in_D,out_A,out_B,out_C,out_D);

initial

  begin

    in_A = 5;

    in_B = 3;

    in_C = 10;

    in_D = 2; #250

  $stop;

  end

endmodule

bubuko.com,布布扣

 

 

PS: Blocking & Nonblocking? ?? ??.

??? edge sensitive event? ?????.

 

 

Blocking & Nonblocking module

原文:http://www.cnblogs.com/capark/p/4004464.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!