2015-10-28 04:47:21 +08:00
|
|
|
module hi_sniffer(
|
2020-07-02 17:47:46 +08:00
|
|
|
ck_1356meg,
|
2015-10-28 04:47:21 +08:00
|
|
|
pwr_lo, pwr_hi, pwr_oe1, pwr_oe2, pwr_oe3, pwr_oe4,
|
|
|
|
adc_d, adc_clk,
|
2020-07-02 17:47:46 +08:00
|
|
|
ssp_frame, ssp_din, ssp_clk
|
2015-10-28 04:47:21 +08:00
|
|
|
);
|
2020-07-02 17:47:46 +08:00
|
|
|
input ck_1356meg;
|
2015-10-28 04:47:21 +08:00
|
|
|
output pwr_lo, pwr_hi, pwr_oe1, pwr_oe2, pwr_oe3, pwr_oe4;
|
|
|
|
input [7:0] adc_d;
|
|
|
|
output adc_clk;
|
|
|
|
output ssp_frame, ssp_din, ssp_clk;
|
|
|
|
|
|
|
|
// We are only snooping, all off.
|
2017-10-24 03:56:47 +08:00
|
|
|
assign pwr_hi = 1'b0;
|
2015-11-02 18:41:25 +08:00
|
|
|
assign pwr_lo = 1'b0;
|
2015-10-28 04:47:21 +08:00
|
|
|
assign pwr_oe1 = 1'b0;
|
|
|
|
assign pwr_oe2 = 1'b0;
|
|
|
|
assign pwr_oe3 = 1'b0;
|
|
|
|
assign pwr_oe4 = 1'b0;
|
|
|
|
|
|
|
|
reg ssp_frame;
|
|
|
|
reg [7:0] adc_d_out = 8'd0;
|
2015-11-02 18:41:25 +08:00
|
|
|
reg [2:0] ssp_cnt = 3'd0;
|
2015-10-28 04:47:21 +08:00
|
|
|
|
2017-10-24 03:56:47 +08:00
|
|
|
assign adc_clk = ck_1356meg;
|
|
|
|
assign ssp_clk = ~ck_1356meg;
|
2015-10-28 04:47:21 +08:00
|
|
|
|
2015-11-02 18:41:25 +08:00
|
|
|
always @(posedge ssp_clk)
|
2015-10-28 04:47:21 +08:00
|
|
|
begin
|
2015-11-02 18:41:25 +08:00
|
|
|
if(ssp_cnt[2:0] == 3'd7)
|
|
|
|
ssp_cnt[2:0] <= 3'd0;
|
|
|
|
else
|
|
|
|
ssp_cnt <= ssp_cnt + 1;
|
2015-10-28 04:47:21 +08:00
|
|
|
|
2015-11-02 18:41:25 +08:00
|
|
|
if(ssp_cnt[2:0] == 3'b000) // set frame length
|
2015-10-28 04:47:21 +08:00
|
|
|
begin
|
2017-10-24 03:56:47 +08:00
|
|
|
adc_d_out[7:0] <= adc_d;
|
2015-11-02 18:41:25 +08:00
|
|
|
ssp_frame <= 1'b1;
|
2015-10-28 04:47:21 +08:00
|
|
|
end
|
2015-11-02 18:41:25 +08:00
|
|
|
else
|
2015-10-28 04:47:21 +08:00
|
|
|
begin
|
2015-11-02 18:41:25 +08:00
|
|
|
adc_d_out[7:0] <= {1'b0, adc_d_out[7:1]};
|
|
|
|
ssp_frame <= 1'b0;
|
2015-10-28 04:47:21 +08:00
|
|
|
end
|
|
|
|
|
2015-11-02 18:41:25 +08:00
|
|
|
end
|
2015-10-28 04:47:21 +08:00
|
|
|
|
2015-11-02 18:41:25 +08:00
|
|
|
assign ssp_din = adc_d_out[0];
|
2015-10-28 04:47:21 +08:00
|
|
|
|
|
|
|
endmodule
|