[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
相关推荐
tiantianuser30 分钟前
RDMA设计50: 如何验证网络嗅探功能?
网络·fpga开发·rdma·高速传输·cmac·roce v2
Lzy金壳bing40 分钟前
基于Vivado平台对Xilinx-7K325t FPGA芯片进行程序在线更新升级
fpga开发·vivado·xilinx
unicrom_深圳市由你创科技1 小时前
医疗设备专用图像处理板卡定制
图像处理·人工智能·fpga开发
tiantianuser2 小时前
RDMA设计52:构建RoCE v2 高速数据传输系统板级测试平台
fpga开发·rdma·高速传输·cmac·roce v2
luoganttcc14 小时前
Taalas 将人工智能模型蚀刻到晶体管上,以提升推理能力
人工智能·fpga开发
国科安芯15 小时前
医疗成像设备系统电源芯片国产替代可行性研究
网络·单片机·嵌入式硬件·fpga开发·硬件架构
不是AI16 小时前
【电路仿真】【Logisim】二、7408 TTL
单片机·fpga开发
江蘇的蘇17 小时前
基于FPGA开发应用SATA硬盘
fpga开发
LCMICRO-133108477461 天前
长芯微LDM63085完全P2P替代ADM2483,是一款基于数字隔离技术的高可靠性的半双工隔离RS-485收发器
单片机·嵌入式硬件·fpga开发·硬件工程·dsp开发
博览鸿蒙1 天前
芯片设计过程中常见的挑战有哪些?
fpga开发