]>
Commit | Line | Data |
---|---|---|
30f2a7d3 | 1 | `include "lo_read_org.v"\r |
6658905f | 2 | `include "lo_read.v"\r |
6658905f | 3 | /*\r |
4 | pck0 - input main 24Mhz clock (PLL / 4)\r | |
5 | [7:0] adc_d - input data from A/D converter\r | |
6 | lo_is_125khz - input freq selector (1=125Khz, 0=136Khz)\r | |
7 | \r | |
8 | pwr_lo - output to coil drivers (ssp_clk / 8)\r | |
9 | adc_clk - output A/D clock signal\r | |
10 | ssp_frame - output SSS frame indicator (goes high while the 8 bits are shifted)\r | |
11 | ssp_din - output SSP data to ARM (shifts 8 bit A/D value serially to ARM MSB first)\r | |
12 | ssp_clk - output SSP clock signal 1Mhz/1.09Mhz (pck0 / 2*(11+lo_is_125khz) )\r | |
13 | \r | |
14 | ck_1356meg - input unused\r | |
15 | ck_1356megb - input unused\r | |
16 | ssp_dout - input unused\r | |
17 | cross_hi - input unused\r | |
18 | cross_lo - input unused\r | |
19 | \r | |
20 | pwr_hi - output unused, tied low\r | |
21 | pwr_oe1 - output unused, undefined\r | |
22 | pwr_oe2 - output unused, undefined\r | |
23 | pwr_oe3 - output unused, undefined\r | |
24 | pwr_oe4 - output unused, undefined\r | |
25 | dbg - output alias for adc_clk\r | |
26 | */\r | |
27 | \r | |
28 | module testbed_lo_read;\r | |
29 | reg pck0;\r | |
30 | reg [7:0] adc_d;\r | |
31 | reg lo_is_125khz;\r | |
30f2a7d3 | 32 | reg [15:0] divisor;\r |
6658905f | 33 | \r |
34 | wire pwr_lo;\r | |
35 | wire adc_clk;\r | |
36 | wire ck_1356meg;\r | |
37 | wire ck_1356megb;\r | |
38 | wire ssp_frame;\r | |
39 | wire ssp_din;\r | |
40 | wire ssp_clk;\r | |
41 | wire ssp_dout;\r | |
42 | wire pwr_hi;\r | |
43 | wire pwr_oe1;\r | |
44 | wire pwr_oe2;\r | |
45 | wire pwr_oe3;\r | |
46 | wire pwr_oe4;\r | |
47 | wire cross_lo;\r | |
48 | wire cross_hi;\r | |
49 | wire dbg;\r | |
50 | \r | |
30f2a7d3 | 51 | lo_read_org #(5,10) dut1(\r |
6658905f | 52 | .pck0(pck0),\r |
30f2a7d3 | 53 | .ck_1356meg(ack_1356meg),\r |
54 | .ck_1356megb(ack_1356megb),\r | |
55 | .pwr_lo(apwr_lo),\r | |
56 | .pwr_hi(apwr_hi),\r | |
57 | .pwr_oe1(apwr_oe1),\r | |
58 | .pwr_oe2(apwr_oe2),\r | |
59 | .pwr_oe3(apwr_oe3),\r | |
60 | .pwr_oe4(apwr_oe4),\r | |
6658905f | 61 | .adc_d(adc_d),\r |
62 | .adc_clk(adc_clk),\r | |
30f2a7d3 | 63 | .ssp_frame(assp_frame),\r |
64 | .ssp_din(assp_din),\r | |
65 | .ssp_dout(assp_dout),\r | |
66 | .ssp_clk(assp_clk),\r | |
67 | .cross_hi(across_hi),\r | |
68 | .cross_lo(across_lo),\r | |
69 | .dbg(adbg),\r | |
6658905f | 70 | .lo_is_125khz(lo_is_125khz)\r |
71 | );\r | |
72 | \r | |
30f2a7d3 | 73 | lo_read #(5,10) dut2(\r |
74 | .pck0(pck0),\r | |
75 | .ck_1356meg(bck_1356meg),\r | |
76 | .ck_1356megb(bck_1356megb),\r | |
77 | .pwr_lo(bpwr_lo),\r | |
78 | .pwr_hi(bpwr_hi),\r | |
79 | .pwr_oe1(bpwr_oe1),\r | |
80 | .pwr_oe2(bpwr_oe2),\r | |
81 | .pwr_oe3(bpwr_oe3),\r | |
82 | .pwr_oe4(bpwr_oe4),\r | |
83 | .adc_d(adc_d),\r | |
84 | .adc_clk(badc_clk),\r | |
85 | .ssp_frame(bssp_frame),\r | |
86 | .ssp_din(bssp_din),\r | |
87 | .ssp_dout(bssp_dout),\r | |
88 | .ssp_clk(bssp_clk),\r | |
89 | .cross_hi(bcross_hi),\r | |
90 | .cross_lo(bcross_lo),\r | |
91 | .dbg(bdbg),\r | |
92 | .lo_is_125khz(lo_is_125khz),\r | |
93 | .divisor(divisor)\r | |
94 | );\r | |
95 | \r | |
96 | integer idx, i, adc_val=8;\r | |
6658905f | 97 | \r |
98 | // main clock\r | |
99 | always #5 pck0 = !pck0;\r | |
100 | \r | |
6658905f | 101 | task crank_dut;\r |
102 | begin\r | |
103 | @(posedge adc_clk) ;\r | |
30f2a7d3 | 104 | adc_d = adc_val;\r |
105 | adc_val = (adc_val *2) + 53;\r | |
6658905f | 106 | end\r |
107 | endtask\r | |
108 | \r | |
109 | initial begin\r | |
110 | \r | |
111 | // init inputs\r | |
112 | pck0 = 0;\r | |
113 | adc_d = 0;\r | |
30f2a7d3 | 114 | lo_is_125khz = 1;\r |
115 | divisor=255; //min 19, 95=125Khz, max 255\r | |
6658905f | 116 | \r |
117 | // simulate 4 A/D cycles at 125Khz\r | |
30f2a7d3 | 118 | for (i = 0 ; i < 8 ; i = i + 1) begin\r |
6658905f | 119 | crank_dut;\r |
120 | end\r | |
121 | $finish;\r | |
122 | end\r | |
6658905f | 123 | endmodule // main\r |