FPGA: rename all ssp frame set/clr definition.
This commit is contained in:
1 parent
36bfb81538
commit
2b0514923d
4 files changed
+36
-36
No files matched your search
+10
-10
@@ -115,15 +115,15 @@ always @(posedge adc_clk)
|
||||
// TIMODE(FRAME_H) ~speed -> 9'd(512-64) speed -> 8'd(256-32)
|
||||
// TIMODE(FRAME_L) ~speed -> 9'b0 speed -> 8'b0
|
||||
`ifdef WITH_TIMODE
|
||||
`define FRAME_SET_L 9'd448
|
||||
`define FRAME_SET_H 8'd224
|
||||
`define FRAME_CLR_L 9'd0
|
||||
`define FRAME_CLR_H 8'd0
|
||||
`define HI_FLITE_FRAME_SET_L 9'd448
|
||||
`define HI_FLITE_FRAME_SET_H 8'd224
|
||||
`define HI_FLITE_FRAME_CLR_L 9'd0
|
||||
`define HI_FLITE_FRAME_CLR_H 8'd0
|
||||
`else
|
||||
`define FRAME_SET_L 9'd31
|
||||
`define FRAME_SET_H 8'd15
|
||||
`define FRAME_CLR_L 9'b1011111 // 95 = 96 - 1
|
||||
`define FRAME_CLR_H 8'b101111 // 47 = 48 - 1
|
||||
`define HI_FLITE_FRAME_SET_L 9'd31
|
||||
`define HI_FLITE_FRAME_SET_H 8'd15
|
||||
`define HI_FLITE_FRAME_CLR_L 9'b1011111 // 95 = 96 - 1
|
||||
`define HI_FLITE_FRAME_CLR_H 8'b101111 // 47 = 48 - 1
|
||||
`endif
|
||||
|
||||
always @(negedge adc_clk)
|
||||
@@ -141,11 +141,11 @@ begin
|
||||
ssp_clk <= 1'b0;
|
||||
//create frame pulses. TBH, I still don't know what they do exactly, but they are crucial for ARM->FPGA transfer. If the frame is in the beginning of the byte, transfer slows to a crawl for some reason
|
||||
// took me a day to figure THAT out.
|
||||
if(( (~speed) && (ssp_cnt[8:0] == `FRAME_SET_L)) || (speed && ssp_cnt[7:0] == `FRAME_SET_H))
|
||||
if(( (~speed) && (ssp_cnt[8:0] == `HI_FLITE_FRAME_SET_L)) || (speed && ssp_cnt[7:0] == `HI_FLITE_FRAME_SET_H))
|
||||
begin
|
||||
ssp_frame <= 1'b1;
|
||||
end
|
||||
if(( (~speed) && (ssp_cnt[8:0] == `FRAME_CLR_L)) || (speed && ssp_cnt[7:0] == `FRAME_CLR_H))
|
||||
if(( (~speed) && (ssp_cnt[8:0] == `HI_FLITE_FRAME_CLR_L)) || (speed && ssp_cnt[7:0] == `HI_FLITE_FRAME_CLR_H))
|
||||
begin
|
||||
ssp_frame <= 1'b0;
|
||||
end
|
||||
|
||||
+12
-12
@@ -494,15 +494,15 @@ end
|
||||
// generate a ssp clock and ssp frame signal for the synchronous transfer from/to the ARM
|
||||
|
||||
`ifdef WITH_TIMODE
|
||||
`define FRAME_SET_8B 6'd56
|
||||
`define FRAME_CLR_8B 6'd0
|
||||
`define FRAME_SET_16B 7'd112
|
||||
`define FRAME_CLR_16B 7'd0
|
||||
`define HI_ISO14443A_FRAME_SET_8B 6'd56
|
||||
`define HI_ISO14443A_FRAME_CLR_8B 6'd0
|
||||
`define HI_ISO14443A_FRAME_SET_16B 7'd112
|
||||
`define HI_ISO14443A_FRAME_CLR_16B 7'd0
|
||||
`else
|
||||
`define FRAME_SET_8B 6'd0
|
||||
`define FRAME_CLR_8B 6'd8
|
||||
`define FRAME_SET_16B 7'd7
|
||||
`define FRAME_CLR_16B 7'd23
|
||||
`define HI_ISO14443A_FRAME_SET_8B 6'd0
|
||||
`define HI_ISO14443A_FRAME_CLR_8B 6'd8
|
||||
`define HI_ISO14443A_FRAME_SET_16B 7'd7
|
||||
`define HI_ISO14443A_FRAME_CLR_16B 7'd23
|
||||
`endif
|
||||
|
||||
always @(negedge adc_clk)
|
||||
@@ -517,10 +517,10 @@ begin
|
||||
|
||||
//ssp模式6D0,TI模式6D56,TI帧开始信号开始:最后一个ssp_clk拉高(64-8)的时候就拉高
|
||||
// ssp_frame rising edge indicates start of frame
|
||||
if(negedge_cnt[5:0] == `FRAME_SET_8B)
|
||||
if(negedge_cnt[5:0] == `HI_ISO14443A_FRAME_SET_8B)
|
||||
ssp_frame <= 1'b1;
|
||||
//ssp模式6D8,TI模式6D0,TI帧开始信号结束:在第一次ssp_clk拉高的时候就拉低(清除上一个周期拉高)
|
||||
if(negedge_cnt[5:0] == `FRAME_CLR_8B)
|
||||
if(negedge_cnt[5:0] == `HI_ISO14443A_FRAME_CLR_8B)
|
||||
ssp_frame <= 1'b0;
|
||||
end
|
||||
else
|
||||
@@ -531,9 +531,9 @@ begin
|
||||
if(negedge_cnt[3:0] == 4'd8) // Low level for 8 cycles (falling edge at cycle 8)
|
||||
ssp_clk <= 1'b0;
|
||||
|
||||
if(negedge_cnt[6:0] == `FRAME_SET_16B) // ssp_frame rising edge indicates start of frame, sampled on falling edge of ssp_clk
|
||||
if(negedge_cnt[6:0] == `HI_ISO14443A_FRAME_SET_16B) // ssp_frame rising edge indicates start of frame, sampled on falling edge of ssp_clk
|
||||
ssp_frame <= 1'b1;
|
||||
if(negedge_cnt[6:0] == `FRAME_CLR_16B)
|
||||
if(negedge_cnt[6:0] == `HI_ISO14443A_FRAME_CLR_16B)
|
||||
ssp_frame <= 1'b0;
|
||||
end
|
||||
end
|
||||
|
||||
+6
-6
@@ -369,11 +369,11 @@ begin
|
||||
end
|
||||
|
||||
`ifdef WITH_TIMODE // In TI mode, the frame signal goes high during the last `ssp_clk` pulse (at the 60th clock cycle, i.e., 64-4).
|
||||
`define FRAME_SET 6'd60
|
||||
`define FRAME_CLR 6'd0
|
||||
`define HI_READER_FRAME_SET 6'd60
|
||||
`define HI_READER_FRAME_CLR 6'd0
|
||||
`else
|
||||
`define FRAME_SET 6'd1
|
||||
`define FRAME_CLR 6'd3
|
||||
`define HI_READER_FRAME_SET 6'd1
|
||||
`define HI_READER_FRAME_CLR 6'd3
|
||||
`endif
|
||||
|
||||
// ssp clock and frame signal for communication to and from ARM, not SPI TI-MODE
|
||||
@@ -396,10 +396,10 @@ begin
|
||||
|
||||
// set ssp_frame signal for corr_i_cnt = 1..3
|
||||
// (send one frame with 16 Bits)
|
||||
if (corr_i_cnt == `FRAME_SET)
|
||||
if (corr_i_cnt == `HI_READER_FRAME_SET)
|
||||
ssp_frame <= 1'b1;
|
||||
|
||||
if (corr_i_cnt == `FRAME_CLR)
|
||||
if (corr_i_cnt == `HI_READER_FRAME_CLR)
|
||||
ssp_frame <= 1'b0;
|
||||
end
|
||||
|
||||
|
||||
+8
-8
@@ -112,11 +112,11 @@ end
|
||||
// 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
|
||||
`define HI_SIMULATE_FRAME_SET_212K 4'd14
|
||||
`define HI_SIMULATE_FRAME_CLR_212K 4'd0
|
||||
`else
|
||||
`define FRAME_SET_212K 4'd1
|
||||
`define FRAME_CLR_212K 4'd5
|
||||
`define HI_SIMULATE_FRAME_SET_212K 4'd1
|
||||
`define HI_SIMULATE_FRAME_CLR_212K 4'd5
|
||||
`endif
|
||||
|
||||
// Produce the byte framing signal; the phase of this signal
|
||||
@@ -125,16 +125,16 @@ always @(negedge adc_clk)
|
||||
begin
|
||||
if (mod_type == `FPGA_HF_SIMULATOR_MODULATE_212K)
|
||||
begin
|
||||
if (ssp_clk_divider[8:5] == `FRAME_SET_212K)
|
||||
if (ssp_clk_divider[8:5] == `HI_SIMULATE_FRAME_SET_212K)
|
||||
ssp_frame <= 1'b1;
|
||||
if (ssp_clk_divider[8:5] == `FRAME_CLR_212K)
|
||||
if (ssp_clk_divider[8:5] == `HI_SIMULATE_FRAME_CLR_212K)
|
||||
ssp_frame <= 1'b0;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if (ssp_clk_divider[7:4] == `FRAME_SET_212K)
|
||||
if (ssp_clk_divider[7:4] == `HI_SIMULATE_FRAME_SET_212K)
|
||||
ssp_frame <= 1'b1;
|
||||
if (ssp_clk_divider[7:4] == `FRAME_CLR_212K)
|
||||
if (ssp_clk_divider[7:4] == `HI_SIMULATE_FRAME_CLR_212K)
|
||||
ssp_frame <= 1'b0;
|
||||
end
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user