1 //-----------------------------------------------------------------------------
2 // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
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.
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 // The way that we connect things in low-frequency simulation mode. In this
18 // case just pass everything through to the ARM, which can bit-bang this
19 // (because it is so slow).
21 // Jonathan Westhues, April 2006
22 //-----------------------------------------------------------------------------
47 // No logic, straight through.
48 assign pwr_oe3
= 1'b0;
49 assign pwr_oe1
= ssp_dout
;
50 assign pwr_oe2
= ssp_dout
;
51 assign pwr_oe4
= ssp_dout
;
52 assign ssp_clk
= cross_lo
;
55 assign debug
= ssp_frame
;
57 // Divide the clock to be used for the ADC
58 reg [7:0] pck_divider
;
61 always @(posedge pck0
)
63 if(pck_divider
== divisor
[7:0])
66 clk_state
= !clk_state
;
70 pck_divider
<= pck_divider
+ 1;
74 assign adc_clk
= ~clk_state
;
76 // Toggle the output with hysteresis
77 // Set to high if the ADC value is above 200
78 // Set to low if the ADC value is below 64
83 always @(posedge pck0
)
85 if((pck_divider
== 8'd7) && !clk_state
) begin
86 is_high
= (adc_d
>= 8'd191);
87 is_low
= (adc_d
<= 8'd64);
91 always @(posedge is_high
or posedge is_low
)
99 assign ssp_frame
= output_state
;