博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

代码分析与仿真

Posted on 2017-11-29 11:10  沉默改良者  阅读(212)  评论(0编辑  收藏  举报

代码分析与仿真

1.

module top(
    input wire clk,
    input wire reset,
    input wire video_cap_buffer_empty
);

reg [2 :0] video_cap_buffer_empty_d ;
always @ (posedge clk)
begin
    video_cap_buffer_empty_d <= {video_cap_buffer_empty_d[1:0], video_cap_buffer_empty} ;
end

reg    video_cap_buffer_not_empty ;
always @ (posedge clk or posedge reset)
    if (reset)
      video_cap_buffer_not_empty <= 1'b0 ;
    else
      video_cap_buffer_not_empty <= video_cap_buffer_empty_d[2] & ~video_cap_buffer_empty_d[1] ;


/*-------------------------------------------------------------------------
add_force {/top/clk} -radix hex {0 0ns} {1 50000ps} -repeat_every 100000ps
add_force {/top/reset} -radix hex {1 0ns} {0 100000ps}
add_force {/top/video_cap_buffer_empty} -radix hex {0 0ns} {1 550000ps} {0 650000ps}

仿真结果为: