3 // AD9510 Register Map (from datasheet Rev. A)
5 /* INSTRUCTION word format (16 bits)
6 * 15 Read = 1, Write = 0
7 * 14:13 W1/W0, Number of bytes 00 - 1, 01 - 2, 10 - 3, 11 - stream
11 /* ADDR Contents Value (hex)
12 * 00 Serial Config Port 10 (def) -- MSB first, SDI/SDO separate
20 * 40-43 LVDS/CMOS Outs
21 * 45 Clock select, power down
30 input aux_clk, // 25MHz, for before fpga clock is active
31 input clk_fpga, // real 100 MHz FPGA clock
32 output [1:0] clk_en, // controls source of reference clock
33 output [1:0] clk_sel, // controls source of reference clock
34 input clk_func, // FIXME needs to be some kind of out SYNC or reset to 9510
35 input clk_status, // Monitor PLL or SYNC status
37 output sen, // Enable for the AD9510
38 output sclk, // FIXME these need to be shared
43 wire read = 1'b0; // Always write for now
44 wire [1:0] w = 2'b00; // Always send 1 byte at a time
46 assign clk_sel = 2'b00; // Both outputs from External Ref (SMA)
47 assign clk_en = 2'b11; // Both outputs enabled
58 6'd00 : addr_data = {13'h00,8'h10}; // Serial setup
59 6'd01 : addr_data = {13'h45,8'h00}; // CLK2 drives distribution, everything on
60 6'd02 : addr_data = {13'h3D,8'h80}; // Turn on output 1, normal levels
61 6'd03 : addr_data = {13'h4B,8'h80}; // Bypass divider 1 (div by 1)
62 6'd04 : addr_data = {13'h08,8'h47}; // POS PFD, Dig LK Det, Charge Pump normal
63 6'd05 : addr_data = {13'h09,8'h70}; // Max Charge Pump current
64 6'd06 : addr_data = {13'h0A,8'h04}; // Normal operation, Prescalar Div by 2, PLL On
65 6'd07 : addr_data = {13'h0B,8'h00}; // RDIV MSB (6 bits)
66 6'd08 : addr_data = {13'h0C,8'h01}; // RDIV LSB (8 bits), Div by 1
67 6'd09 : addr_data = {13'h0D,8'h00}; // Everything normal, Dig Lock Det
68 6'd10 : addr_data = {13'h07,8'h00}; // Disable LOR detect - LOR causes failure...
69 6'd11 : addr_data = {13'h04,8'h00}; // A Counter = Don't Care
70 6'd12 : addr_data = {13'h05,8'h00}; // B Counter MSB = 0
71 6'd13 : addr_data = {13'h06,8'h05}; // B Counter LSB = 5
72 default : addr_data = {13'h5A,8'h01}; // Register Update
73 endcase // case(entry)
75 wire [5:0] lastentry = 6'd15;
76 wire done = (counter == 8'd49);
78 always @(posedge aux_clk)
86 else if(done && (entry<lastentry))
88 entry <= #1 entry + 6'd1;
92 always @(posedge aux_clk)
101 command <= #1 {read,w,addr_data};
103 else if( |counter && ~done )
105 counter <= #1 counter + 7'd1;
107 command <= {command[22:0],1'b0};
111 assign sen = (done | counter == 8'd0); // CSB is high when we're not doing anything
112 assign sclk = ~counter[0];
113 assign sdo = command[23];
115 endmodule // clock_control