1 //-----------------------------------------------------------------------------
4 //-----------------------------------------------------------------------------
8 adc_d
, trace_enable
, major_mode
,
9 ssp_frame
, ssp_din
, ssp_clk
14 input [2:0] major_mode
;
15 output ssp_frame
, ssp_din
, ssp_clk
;
19 always @(negedge ck_1356megb
)
21 clock_cnt
<= clock_cnt
+ 1;
24 // sample at 13,56MHz / 8. The highest signal frequency (subcarrier) is 848,5kHz, i.e. in this case we oversample by a factor of 2
25 reg [2:0] sample_clock
;
26 always @(negedge ck_1356megb
)
28 if (sample_clock
== 3'd7)
31 sample_clock
<= sample_clock
+ 1;
36 reg [11:0] start_addr
;
37 reg [2:0] previous_major_mode
;
40 always @(negedge ck_1356megb
)
42 previous_major_mode
<= major_mode
;
43 if (major_mode
== `FPGA_MAJOR_MODE_HF_GET_TRACE)
45 write_enable1
<= 1'b0;
46 write_enable2
<= 1'b0;
47 if (previous_major_mode
!= `FPGA_MAJOR_MODE_HF_GET_TRACE) // just switched into GET_TRACE mode
49 if (clock_cnt
== 7'd0)
57 else if (major_mode
!= `FPGA_MAJOR_MODE_OFF)
63 write_enable1
<= 1'b1;
64 write_enable2
<= 1'b0;
68 write_enable1
<= 1'b0;
69 write_enable2
<= 1'b1;
71 if (sample_clock
== 3'b000)
76 write_enable1
<= 1'b1;
77 write_enable2
<= 1'b0;
85 write_enable1
<= 1'b0;
86 write_enable2
<= 1'b0;
90 else // major_mode == `FPGA_MAJOR_MODE_OFF
92 write_enable1
<= 1'b0;
93 write_enable2
<= 1'b0;
94 if (previous_major_mode
!= `FPGA_MAJOR_MODE_OFF && previous_major_mode != `FPGA_MAJOR_MODE_HF_GET_TRACE) // just switched off
101 reg [7:0] D_out1
, D_out2
;
102 reg [7:0] ram1
[2047:0];
103 reg [7:0] ram2
[1023:0];
105 always @(negedge ck_1356megb
)
109 ram1
[addr
[10:0]] <= adc_d
;
113 D_out1
<= ram1
[addr
[10:0]];
116 ram2
[addr
[9:0]] <= adc_d
;
120 D_out2
<= ram2
[addr
[9:0]];
124 // SSC communication to ARM
129 always @(negedge ck_1356megb
)
131 if(clock_cnt
[3:0] == 4'd0) // update shift register every 16 clock cycles
133 if(clock_cnt
[6:4] == 3'd0) // either load new value
135 if (addr
[11] == 1'b0)
140 else // or shift left
141 shift_out
[7:1] <= shift_out
[6:0];
144 ssp_clk
<= ~clock_cnt
[3]; // ssp_clk frequency = 13,56MHz / 16 = 847,5 kHz
146 if(clock_cnt
[6:4] == 3'b000) // set ssp_frame for 0...31
153 assign ssp_din
= shift_out
[7];