NCO

wave61

A simple verison of a numerically controlled oscillator is implemented, and a 600Hz sine wave is generated. The red trace shows the MSB to the D/A converter.

//--------- 16-bit phase accumulator ---------------------
reg [15:0] phase_acc;
reg [15:0] phase_delta;

always @ (posedge clk_myown or negedge res_n)
begin
  if ( res_n == 1'b0 ) begin
     phase_acc   <= 16'h0000;
     phase_delta <= 16'h0040;
  end
  else if (daword_up == 1'b1) begin // 48kHz
     phase_delta <= (1'b0)? {5'b0_0000, rx_data, 3'b000} : 16'b0000_0011_0011_0011;
     phase_acc <= phase_acc + phase_delta;
     sound_index <= phase_acc[15:7];
  end
end

The Line 12 shows that the frequency control word (FCW), phase_delta, can be given via a serial interface.