fpga: x400: Adjust SPI engine strobes alignment

Modify behavior of clock crossing between radio_clk and radio_clk_2x.
This ensures strobe signals are always asserted for a single
radio_clk_2x cycle and when radio_clk is low.


Original-commit: adb352a2ad81d7c6d70ec5880a787b6bab7d19ba
This commit is contained in:
Javier Valenzuela
2022-03-04 09:41:24 -06:00
committed by Wade Fife
parent 8630f2616c
commit 56b8f83341
4 changed files with 14 additions and 9 deletions
+10 -5
View File
@@ -342,13 +342,18 @@ module x4xx_gpio_spi #(
// Register set_stb for use in 2x domain.
reg set_stb_2x = 1'b0;
reg ctrlport_clk_phase = 1'b0;
reg ctrlport_clk_phase = 1'b1;
always @ (posedge ctrlport_clk_2x) begin
// Assert strobe only during a single 2x cycle of the
// 1x pulse.
set_stb_2x <= ctrlport_clk_phase & set_stb;
ctrlport_clk_phase <= ~ctrlport_clk_phase;
if (ctrlport_rst) begin
ctrlport_clk_phase <= 1'b1;
set_stb_2x <= 1'b0;
end else begin
// Assert strobe only during a single 2x cycle of the
// 1x pulse, when 1x clock is low.
set_stb_2x <= ctrlport_clk_phase & set_stb;
ctrlport_clk_phase <= ~ctrlport_clk_phase;
end
end
simple_spi_core #(