[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
相关推荐
碎碎思17 小时前
不用 JTAG 也能刷 FPGA:TinyFPGA-Bootloader 让比特流加载更简单
fpga开发
贝塔实验室20 小时前
Altium Designer 6.0 初学教程-在Altium Designer 中对PCB 进行板层设置及内电层进行分割
嵌入式硬件·fpga开发·编辑器·硬件工程·信息与通信·信号处理·pcb工艺
ThreeYear_s20 小时前
【FPGA+DSP系列】——MATLAB simulink单相PWM全控整流电路基础版
开发语言·matlab·fpga开发
forgeda20 小时前
赛灵思FPGA的市场份额,要从2025年的55%,进一步提升到2030年的70%,凭什么?
ai·fpga开发
怀民民民20 小时前
关于ADC
单片机·嵌入式硬件·fpga开发·adc·学习总结·模数转化
太爱学习了20 小时前
步进电机sin曲线加速及FPGA实现
fpga开发·步进电机
尤老师FPGA20 小时前
LVDS系列33:Xilinx 7系 ADC LVDS接口参考设计(四)
fpga开发
FPGA_无线通信20 小时前
FPGA PCIE 包解析
fpga开发
Aaron158820 小时前
通用的通感控算存一体化平台设计方案
linux·人工智能·算法·fpga开发·硬件工程·射频工程·基带工程
知南x21 小时前
【Socket消息传递】(1) 嵌入式设备间Socket通信传输图片
linux·fpga开发