MIFARE Plus 4b UID: fix signature check
[RRG-proxmark3.git] / fpga / hi_sniffer.v
blob8cfb0fe9ae442e832f860b1c35a266ee8873afc2
1 //-----------------------------------------------------------------------------
2 // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // See LICENSE.txt for the text of the license.
15 //-----------------------------------------------------------------------------
17 module hi_sniffer(
18 input ck_1356meg,
19 input [7:0] adc_d,
21 output ssp_din,
22 output reg ssp_frame,
23 output ssp_clk,
24 output adc_clk,
25 output pwr_lo,
26 output pwr_hi,
27 output pwr_oe1,
28 output pwr_oe2,
29 output pwr_oe3,
30 output pwr_oe4
33 // We are only snooping, all off.
34 assign pwr_hi = 1'b0;
35 assign pwr_lo = 1'b0;
36 assign pwr_oe1 = 1'b0;
37 assign pwr_oe2 = 1'b0;
38 assign pwr_oe3 = 1'b0;
39 assign pwr_oe4 = 1'b0;
41 //reg ssp_frame;
42 reg [7:0] adc_d_out = 8'd0;
43 reg [2:0] ssp_cnt = 3'd0;
45 assign adc_clk = ck_1356meg;
46 assign ssp_clk = ~ck_1356meg;
47 assign ssp_din = adc_d_out[0];
49 always @(posedge ssp_clk)
50 begin
51 ssp_cnt <= ssp_cnt + 1;
53 if(ssp_cnt[2:0] == 3'b000) // set frame length
54 begin
55 adc_d_out[7:0] <= adc_d;
56 ssp_frame <= 1'b1;
57 end
58 else
59 begin
60 // shift value right one bit
61 adc_d_out[7:0] <= {1'b0, adc_d_out[7:1]};
62 ssp_frame <= 1'b0;
63 end
65 end
66 endmodule