[HDLBits] Edgecapture

For each bit in a 32-bit vector, capture when the input signal changes from 1 in one clock cycle to 0 the next. "Capture" means that the output will remain 1 until the register is reset (synchronous reset).

Each output bit behaves like a SR flip-flop: The output bit should be set (to 1) the cycle after a 1 to 0 transition occurs. The output bit should be reset (to 0) at the positive clock edge when reset is high. If both of the above events occur at the same time, reset has precedence. In the last 4 cycles of the example waveform below, the 'reset' event occurs one cycle earlier than the 'set' event, so there is no conflict here.

In the example waveform below, reset, in[1] and out[1] are shown again separately for clarity.

复制代码
module top_module (
    input clk,
    input reset,
    input [31:0] in,
    output [31:0] out
);
    reg [31:0] old;
    always@(posedge clk) old<=in;
    always@(posedge clk) begin
        if(reset)
            out<=32'b0;
        else
            out<=old&(~in)|out;
        //这里需要或上一个out才能保持
    end
endmodule
相关推荐
燎原星火*15 小时前
FMC接口定义
fpga开发
CHY_12815 小时前
JESD204B 协议解析(4)Subclass2 时序分析
嵌入式硬件·fpga开发·jesd204
FPGA_无线通信15 小时前
FPGA rgmii/gmii
fpga开发
FPGA_无线通信15 小时前
PCIe H2C DMA中Tag 乱序重排算法
fpga开发
1560820721921 小时前
PCIE-403 Pro VU13P+47DR信号处理板
fpga开发·信号处理
156082072192 天前
基于7VX690T FPGA实现万兆TCP/IP资源和性能测试
网络协议·tcp/ip·fpga开发
nuoxin1142 天前
GSV1011-富利威-HDMI芯片选型
arm开发·驱动开发·fpga开发·ffmpeg·射频工程
ChipCamp2 天前
FPGA开发入门----1. Mux的三种写法,RTL的认知大提升!
fpga开发·时序逻辑·组合逻辑
XINVRY-FPGA3 天前
XCVP1802-2MSILSVC4072 AMD Xilinx Versal Premium Adaptive SoC FPGA
人工智能·嵌入式硬件·fpga开发·数据挖掘·云计算·硬件工程·fpga
9527华安3 天前
国产安路FPGA开发设计培训课程,提供开发板+工程源码+视频教程+技术支持
fpga开发·fpga·安路·视频教程·培训·安路fpga