先看题目

其实简而言之就是检测输入数据从0到1的变化,若是检测到输入从0变化为1,则输出该位的对应位为1.
解题思路是用到一个使用一个寄存器保存上个时钟输入的值,若上个时钟输入为0,当前时钟输入为1,则输出为1.
module top_module (
input clk,
input [7:0] in,
output [7:0] pedge
);
wire [7:0] temp;
always@(posedge clk)begin
temp <= in;
pedge <= ~temp∈
end
endmodule