FPGA: hi_simulate.v merged.

This commit is contained in:
dxl committed 2026-10-10 09:41:25 +08:00
1 parent 9d0d58ca4b
commit 31b0ece921
1 file changed
+15 -4
+15 -4
View File
@@ -108,22 +108,33 @@ begin
ssp_clk <= ~ssp_clk_divider[4];
end
// Since the 212k clock is generated by ssp_clk_divider[5], a full cycle here involves 16 bits—effectively 8 clock periods.
// This means an 8-bit transfer; in SSP mode, the frame signal is driven high at bit 1 (clock rising edge) and low at bit 5 (clock falling edge).
// To switch to TI mode, this must be changed to the rising edge of the final cycle: driving high at bit 14 (rising edge) and low at bit 0 (falling edge).
`ifdef WITH_TIMODE
`define FRAME_SET_212K 4'd14
`define FRAME_CLR_212K 4'd0
`else
`define FRAME_SET_212K 4'd1
`define FRAME_CLR_212K 4'd5
`endif
// Produce the byte framing signal; the phase of this signal
// is arbitrary, because it's just a bit stream in this module.
always @(negedge adc_clk)
begin
if (mod_type == `FPGA_HF_SIMULATOR_MODULATE_212K)
begin
if (ssp_clk_divider[8:5] == 4'd1)
if (ssp_clk_divider[8:5] == `FRAME_SET_212K)
ssp_frame <= 1'b1;
if (ssp_clk_divider[8:5] == 4'd5)
if (ssp_clk_divider[8:5] == `FRAME_CLR_212K)
ssp_frame <= 1'b0;
end
else
begin
if (ssp_clk_divider[7:4] == 4'd1)
if (ssp_clk_divider[7:4] == `FRAME_SET_212K)
ssp_frame <= 1'b1;
if (ssp_clk_divider[7:4] == 4'd5)
if (ssp_clk_divider[7:4] == `FRAME_CLR_212K)
ssp_frame <= 1'b0;
end
end