`include "lo_read.v"\r
-\r
/*\r
pck0 - input main 24Mhz clock (PLL / 4)\r
[7:0] adc_d - input data from A/D converter\r
reg pck0;\r
reg [7:0] adc_d;\r
reg lo_is_125khz;\r
+ reg [15:0] divisor;\r
\r
wire pwr_lo;\r
wire adc_clk;\r
wire ssp_frame;\r
wire ssp_din;\r
wire ssp_clk;\r
- wire ssp_dout;\r
+ reg ssp_dout;\r
wire pwr_hi;\r
wire pwr_oe1;\r
wire pwr_oe2;\r
wire cross_hi;\r
wire dbg;\r
\r
- lo_read #(5,200) dut(\r
+ lo_read #(5,10) dut(\r
.pck0(pck0),\r
.ck_1356meg(ck_1356meg),\r
.ck_1356megb(ck_1356megb),\r
.cross_hi(cross_hi),\r
.cross_lo(cross_lo),\r
.dbg(dbg),\r
- .lo_is_125khz(lo_is_125khz)\r
+ .lo_is_125khz(lo_is_125khz),\r
+ .divisor(divisor)\r
);\r
\r
- integer idx, i;\r
+ integer idx, i, adc_val=8;\r
\r
// main clock\r
always #5 pck0 = !pck0;\r
\r
- //new A/D value available from ADC on positive edge\r
task crank_dut;\r
begin\r
@(posedge adc_clk) ;\r
- adc_d = $random;\r
+ adc_d = adc_val;\r
+ adc_val = (adc_val *2) + 53;\r
end\r
endtask\r
\r
// init inputs\r
pck0 = 0;\r
adc_d = 0;\r
-\r
- // simulate 4 A/D cycles at 134Khz\r
- lo_is_125khz=0;\r
- for (i = 0 ; i < 4 ; i = i + 1) begin\r
- crank_dut;\r
- end\r
+ ssp_dout = 0;\r
+ lo_is_125khz = 1;\r
+ divisor = 255; //min 16, 95=125Khz, max 255\r
\r
// simulate 4 A/D cycles at 125Khz\r
- lo_is_125khz=1;\r
- for (i = 0 ; i < 4 ; i = i + 1) begin\r
+ for (i = 0 ; i < 8 ; i = i + 1) begin\r
crank_dut;\r
end\r
$finish;\r
end\r
- \r
endmodule // main\r