Found how to use the DDR output in the Anlogic FPGA. Within the Tang Dynasty IDE an ODDR IP has to be generated. This gives a verilog module for a DDR output with the ability to hook on the needed signals.
For now just did it for the DAC control signals and the output on the scope looks to be spike free. At least on the Hantek DSO2D10. (This one starts the quickest and makes no noise)
Have to find a way to use this ODDR IP in a bus manner because having to hook up this module to every DAC data pin takes a lot of code. Maybe there is some way to use macro's for this? Not sure if it is needed though, since it is already using the DFF of the IO block for these signals. But as BrianHG pointed out the DDR logic might be faster.
In this top level code it needs the four module connections near the end to hook up the control signals. I checked with the schematic viewer and it is using the AL_PHY_PAD for the ODDR logic.
//---------------------------------------------------------------------------
//Main module for connections with the outside world
module FA201_Lichee_nano
(
//Input signals
input wire i_xtal, //50 MHz clock
input wire i_mcu_data_strobe, //Active low going pulse from the mcu to strobe the data
input wire i_mcu_control_srobe, //Active low going pulse from the mcu to strobe the control
input wire i_mcu_read_write_select, //Read 0 / write 1
//Bi-directional parallel data bus to / from the mcu
inout wire [7:0] io_mcu_data,
//Output signals
output o_dac1_clk,
output o_dac1_wrt,
output o_dac2_clk,
output o_dac2_wrt,
output wire [13:0] o_dac1_d,
output wire [13:0] o_dac2_d
);
//---------------------------------------------------------------------------
//Internal wires
wire core_clock;
wire [47:0] channel1_negative_signal_step;
wire [47:0] channel1_positive_signal_step;
wire [47:0] channel2_negative_signal_step;
wire [47:0] channel2_positive_signal_step;
//---------------------------------------------------------------------------
//Connection with the sub modules
pll_clock pll
(
.refclk (i_xtal),
.reset (1'b0),
.clk0_out (core_clock)
);
mcu_interface mcu
(
.i_main_clk (core_clock),
.i_data_strobe (i_mcu_data_strobe),
.i_control_strobe (i_mcu_control_srobe),
.i_read_write_select (i_mcu_read_write_select),
.io_data (io_mcu_data),
.o_channel1_negative_signal_step (channel1_negative_signal_step),
.o_channel1_positive_signal_step (channel1_positive_signal_step),
.o_channel2_negative_signal_step (channel2_negative_signal_step),
.o_channel2_positive_signal_step (channel2_positive_signal_step)
);
awg dac1
(
.i_main_clock (core_clock),
.i_negative_signal_step (channel1_negative_signal_step),
.i_positive_signal_step (channel1_positive_signal_step),
.o_dac_d (o_dac1_d)
);
awg dac2
(
.i_main_clock (core_clock),
.i_negative_signal_step (channel2_negative_signal_step),
.i_positive_signal_step (channel2_positive_signal_step),
.o_dac_d (o_dac2_d)
);
output_ddr dac1_wrt
(
.clk (core_clock),
.rst (1'b0),
.d1 (1'b0),
.d2 (1'b1),
.q (o_dac1_wrt)
);
output_ddr dac1_clk
(
.clk (core_clock),
.rst (1'b0),
.d1 (1'b1),
.d2 (1'b0),
.q (o_dac1_clk)
);
output_ddr dac2_wrt
(
.clk (core_clock),
.rst (1'b0),
.d1 (1'b0),
.d2 (1'b1),
.q (o_dac2_wrt)
);
output_ddr dac2_clk
(
.clk (core_clock),
.rst (1'b0),
.d1 (1'b1),
.d2 (1'b0),
.q (o_dac2_clk)
);
endmodule
//---------------------------------------------------------------------------
It did drop the max frequency a bit.
Timing group statistics:
Clock constraints:
Clock Name Min Period Max Freq Skew Fanout TNS
core_clock (125.000MHz) 5.528ns 180.897MHz 0.078ns 227 0.000ns