]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - fpga/hi_read_rx_xcorr.v
Add capability to correlate against subcarriers of 212kHz (argument FPGA_HF_READER_RX...
[proxmark3-svn] / fpga / hi_read_rx_xcorr.v
index 253f5080032814c641b518c595ccfb96e5e49c8f..9d012f422e8cb8451ae56dd753c3a18d242b0efc 100644 (file)
@@ -10,7 +10,7 @@ module hi_read_rx_xcorr(
     ssp_frame, ssp_din, ssp_dout, ssp_clk,\r
     cross_hi, cross_lo,\r
     dbg,\r
-    xcorr_is_848, snoop\r
+    xcorr_is_848, snoop, xcorr_quarter_freq\r
 );\r
     input pck0, ck_1356meg, ck_1356megb;\r
     output pwr_lo, pwr_hi, pwr_oe1, pwr_oe2, pwr_oe3, pwr_oe4;\r
@@ -20,7 +20,7 @@ module hi_read_rx_xcorr(
     output ssp_frame, ssp_din, ssp_clk;\r
     input cross_hi, cross_lo;\r
     output dbg;\r
-    input xcorr_is_848, snoop;\r
+    input xcorr_is_848, snoop, xcorr_quarter_freq;\r
 \r
 // Carrier is steady on through this, unless we're snooping.\r
 assign pwr_hi = ck_1356megb & (~snoop);\r
@@ -36,17 +36,37 @@ reg fc_div_2;
 always @(posedge ck_1356meg)\r
     fc_div_2 = ~fc_div_2;\r
 \r
+reg fc_div_4;\r
+always @(posedge fc_div_2)\r
+    fc_div_4 = ~fc_div_4;\r
+\r
+reg fc_div_8;\r
+always @(posedge fc_div_4)\r
+    fc_div_8 = ~fc_div_8;\r
+\r
 reg adc_clk;\r
 \r
-always @(xcorr_is_848 or fc_div_2 or ck_1356meg)\r
-    if(xcorr_is_848)\r
-        // The subcarrier frequency is fc/16; we will sample at fc, so that \r
-        // means the subcarrier is 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 ...\r
-        adc_clk <= ck_1356meg;\r
+always @(xcorr_is_848 or xcorr_quarter_freq or ck_1356meg)\r
+    if(~xcorr_quarter_freq)\r
+    begin\r
+           if(xcorr_is_848)\r
+               // The subcarrier frequency is fc/16; we will sample at fc, so that \r
+               // means the subcarrier is 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 ...\r
+               adc_clk <= ck_1356meg;\r
+           else\r
+               // The subcarrier frequency is fc/32; we will sample at fc/2, and\r
+               // the subcarrier will look identical.\r
+               adc_clk <= fc_div_2;\r
+    end\r
     else\r
-        // The subcarrier frequency is fc/32; we will sample at fc/2, and\r
-        // the subcarrier will look identical.\r
-        adc_clk <= fc_div_2;\r
+    begin\r
+           if(xcorr_is_848)\r
+               // The subcarrier frequency is fc/64\r
+               adc_clk <= fc_div_4;\r
+           else\r
+               // The subcarrier frequency is fc/128\r
+               adc_clk <= fc_div_8;\r
+       end\r
 \r
 // When we're a reader, we just need to do the BPSK demod; but when we're an\r
 // eavesdropper, we also need to pick out the commands sent by the reader,\r
Impressum, Datenschutz