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,
18 input pck0, ck_1356meg, ck_1356megb;
19 output pwr_lo, pwr_hi, pwr_oe1, pwr_oe2, pwr_oe3, pwr_oe4;
23 output ssp_frame, ssp_din, ssp_clk;
24 input cross_hi, cross_lo;
28 // No logic, straight through.
29 assign pwr_oe3 = 1'b0;
30 assign pwr_oe1 = ssp_dout;
31 assign pwr_oe2 = ssp_dout;
32 assign pwr_oe4 = ssp_dout;
33 assign ssp_clk = cross_lo;
36 assign dbg = ssp_frame;
38 // Divide the clock to be used for the ADC
39 reg [7:0] pck_divider;
42 always @(posedge pck0)
44 if(pck_divider == divisor[7:0])
47 clk_state = !clk_state;
51 pck_divider <= pck_divider + 1;
55 assign adc_clk = ~clk_state;
57 // Toggle the output with hysteresis
58 // Set to high if the ADC value is above 200
59 // Set to low if the ADC value is below 64
64 always @(posedge pck0)
66 if((pck_divider == 8'd7) && !clk_state) begin
67 is_high = (adc_d >= 8'd200);
68 is_low = (adc_d <= 8'd64);
72 always @(posedge is_high or posedge is_low)
80 assign ssp_frame = output_state;