[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
相关推荐
豆包公子13 小时前
虚拟机配置共享文件&烧录FPGA bit文件
fpga开发
c-u-r-ry3015 小时前
pll/mmcm输入时钟配置页面警告
经验分享·fpga开发
逻辑诗篇17 小时前
硬核算力集结!TMS320C6678、XC7K690T等、匠行科技SBC819模拟信号采集处理板,解锁高端测控新标杆
科技·fpga开发
狂奔蜗牛(bradley)19 小时前
FPGA基础知识:深度剖析异步复位同步释放
fpga开发
发发就是发1 天前
USB系统架构概述:从一次诡异的枚举失败说起
驱动开发·单片机·嵌入式硬件·算法·fpga开发
Shang180989357262 天前
T31ZX 君正/INGENIC智能视频处理器T31ZX可提供软硬件资料T31Z采用先进的低功耗设计
嵌入式硬件·fpga开发·音视频·t31zx智能视频处理器
通信小呆呆2 天前
各具神通——Vivado中不同系列的IP核差异详解
网络协议·tcp/ip·fpga开发
做一个快乐的小傻瓜2 天前
XCKU5P引脚约束
fpga开发
水云桐程序员3 天前
FPGA开发需要的环境配置
fpga开发
LCMICRO-133108477463 天前
长芯微LPS6288完全P2P替代TPS61288,是一款具有 15A 开关电流的全集成同步升压转换器
stm32·单片机·嵌入式硬件·fpga开发·硬件工程·同步升压转换器