litex/verilog/minimac3/psync.v
Sebastien Bourdeauducq d64b64501a minimac3: move psync
2013-04-25 18:36:45 +02:00

31 lines
376 B
Verilog

module psync(
input clk1,
input i,
input clk2,
output o
);
reg level;
always @(posedge clk1)
if(i)
level <= ~level;
reg level1;
reg level2;
reg level3;
always @(posedge clk2) begin
level1 <= level;
level2 <= level1;
level3 <= level2;
end
assign o = level2 ^ level3;
initial begin
level <= 1'b0;
level1 <= 1'b0;
level2 <= 1'b0;
level3 <= 1'b0;
end
endmodule