1 //-----------------------------------------------------------------------------
2 // The way that we connect things in low-frequency simulation mode. In this
3 // case just pass everything through to the ARM, which can bit-bang this
4 // (because it is so slow).
6 // Jonathan Westhues, April 2006
7 //-----------------------------------------------------------------------------
10 pck0, ck_1356meg, ck_1356megb,
11 pwr_lo, pwr_hi, pwr_oe1, pwr_oe2, pwr_oe3, pwr_oe4,
13 ssp_frame, ssp_din, ssp_dout, ssp_clk,
19 input pck0, ck_1356meg, ck_1356megb;
20 output pwr_lo, pwr_hi, pwr_oe1, pwr_oe2, pwr_oe3, pwr_oe4;
24 output ssp_frame, ssp_din, ssp_clk;
25 input cross_hi, cross_lo;
30 // Divide the clock to be used for the ADC
31 reg [7:0] pck_divider;
35 assign tag_modulation = ssp_dout & !lf_field;
36 wire reader_modulation;
37 assign reader_modulation = !ssp_dout & lf_field & clk_state;
39 // No logic, straight through.
40 assign pwr_oe1 = 1'b0; // not used in LF mode
41 assign pwr_oe2 = tag_modulation;
42 assign pwr_oe3 = tag_modulation;
43 assign pwr_oe4 = tag_modulation;
44 assign ssp_clk = cross_lo;
45 assign pwr_lo = reader_modulation;
47 assign dbg = ssp_frame;
49 always @(posedge pck0)
51 if(pck_divider == divisor[7:0])
54 clk_state = !clk_state;
58 pck_divider <= pck_divider + 1;
62 assign adc_clk = ~clk_state;
64 // Toggle the output with hysteresis
65 // Set to high if the ADC value is above 200
66 // Set to low if the ADC value is below 64
71 always @(posedge pck0)
73 if((pck_divider == 8'd7) && !clk_state) begin
74 is_high = (adc_d >= 8'd190);
75 is_low = (adc_d <= 8'd70);
79 always @(posedge is_high or posedge is_low)
87 assign ssp_frame = output_state;