3 // USRP - Universal Software Radio Peripheral
5 // Copyright (C) 2003 Matt Ettus
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 2 of the License, or
10 // (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301 USA
24 // Basic Phase accumulator for DDS
27 module phase_acc (clk,reset,enable,strobe,serial_addr,serial_data,serial_strobe,phase);
28 parameter FREQADDR = 0;
29 parameter PHASEADDR = 0;
30 parameter resolution = 32;
32 input clk, reset, enable, strobe;
33 input [6:0] serial_addr;
34 input [31:0] serial_data;
37 output reg [resolution-1:0] phase;
38 wire [resolution-1:0] freq;
40 setting_reg #(FREQADDR) sr_rxfreq0(.clock(clk),.reset(1'b0),.strobe(serial_strobe),.addr(serial_addr),.in(serial_data),.out(freq));
45 else if(serial_strobe & (serial_addr == PHASEADDR))
46 phase <= #1 serial_data;
47 else if(enable & strobe)
48 phase <= #1 phase + freq;
50 endmodule // phase_acc