From b7ea846c40f193110623c4c9d07c8bc85df1ae9f Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 17 Sep 2018 14:57:12 +0200 Subject: [PATCH] ad_ip_jesd204_tpl_dac: Use perfect shuffle helper module Replace the open-coded instances of a perfect shuffle in the DAC framer with the new helper module. Using the helper module gives well defined semantics and hopefully makes the code easier to understand. There are no changes in behavior. Signed-off-by: Lars-Peter Clausen --- library/axi_ad9144/Makefile | 1 + library/axi_ad9144/axi_ad9144_hw.tcl | 1 + library/axi_ad9152/Makefile | 1 + library/axi_ad9152/axi_ad9152_hw.tcl | 1 + .../jesd204/ad_ip_jesd204_tpl_dac/Makefile | 1 + .../ad_ip_jesd204_tpl_dac_framer.v | 34 +++++++++---------- .../ad_ip_jesd204_tpl_dac_hw.tcl | 1 + .../ad_ip_jesd204_tpl_dac_ip.tcl | 1 + 8 files changed, 23 insertions(+), 18 deletions(-) diff --git a/library/axi_ad9144/Makefile b/library/axi_ad9144/Makefile index 8c481a4fd..ebb5d6cda 100644 --- a/library/axi_ad9144/Makefile +++ b/library/axi_ad9144/Makefile @@ -22,6 +22,7 @@ ALTERA_DEPS += ../common/ad_dds_2.v ALTERA_DEPS += ../common/ad_dds_cordic_pipe.v ALTERA_DEPS += ../common/ad_dds_sine.v ALTERA_DEPS += ../common/ad_dds_sine_cordic.v +ALTERA_DEPS += ../common/ad_perfect_shuffle.v ALTERA_DEPS += ../common/ad_rst.v ALTERA_DEPS += ../common/up_axi.v ALTERA_DEPS += ../common/up_clock_mon.v diff --git a/library/axi_ad9144/axi_ad9144_hw.tcl b/library/axi_ad9144/axi_ad9144_hw.tcl index dbb56ddfe..48ff9157b 100644 --- a/library/axi_ad9144/axi_ad9144_hw.tcl +++ b/library/axi_ad9144/axi_ad9144_hw.tcl @@ -21,6 +21,7 @@ ad_ip_files axi_ad9144 [list \ $ad_hdl_dir/library/common/ad_dds_2.v \ $ad_hdl_dir/library/common/ad_dds_1.v \ $ad_hdl_dir/library/common/ad_dds.v \ + $ad_hdl_dir/library/common/ad_perfect_shuffle.v \ $ad_hdl_dir/library/common/ad_rst.v \ $ad_hdl_dir/library/common/up_axi.v \ $ad_hdl_dir/library/common/up_xfer_cntrl.v \ diff --git a/library/axi_ad9152/Makefile b/library/axi_ad9152/Makefile index 3fdd19abf..3cb4c79cc 100644 --- a/library/axi_ad9152/Makefile +++ b/library/axi_ad9152/Makefile @@ -22,6 +22,7 @@ ALTERA_DEPS += ../common/ad_dds_2.v ALTERA_DEPS += ../common/ad_dds_cordic_pipe.v ALTERA_DEPS += ../common/ad_dds_sine.v ALTERA_DEPS += ../common/ad_dds_sine_cordic.v +ALTERA_DEPS += ../common/ad_perfect_shuffle.v ALTERA_DEPS += ../common/ad_rst.v ALTERA_DEPS += ../common/up_axi.v ALTERA_DEPS += ../common/up_clock_mon.v diff --git a/library/axi_ad9152/axi_ad9152_hw.tcl b/library/axi_ad9152/axi_ad9152_hw.tcl index 884346282..912f1de59 100644 --- a/library/axi_ad9152/axi_ad9152_hw.tcl +++ b/library/axi_ad9152/axi_ad9152_hw.tcl @@ -20,6 +20,7 @@ ad_ip_files axi_ad9152 [list \ $ad_hdl_dir/library/common/ad_dds_2.v \ $ad_hdl_dir/library/common/ad_dds_1.v \ $ad_hdl_dir/library/common/ad_dds.v \ + $ad_hdl_dir/library/common/ad_perfect_shuffle.v \ $ad_hdl_dir/library/common/ad_rst.v \ $ad_hdl_dir/library/common/up_axi.v \ $ad_hdl_dir/library/common/up_xfer_cntrl.v \ diff --git a/library/jesd204/ad_ip_jesd204_tpl_dac/Makefile b/library/jesd204/ad_ip_jesd204_tpl_dac/Makefile index 2b9d10adb..f4832ebf9 100644 --- a/library/jesd204/ad_ip_jesd204_tpl_dac/Makefile +++ b/library/jesd204/ad_ip_jesd204_tpl_dac/Makefile @@ -11,6 +11,7 @@ GENERIC_DEPS += ../../common/ad_dds_2.v GENERIC_DEPS += ../../common/ad_dds_cordic_pipe.v GENERIC_DEPS += ../../common/ad_dds_sine.v GENERIC_DEPS += ../../common/ad_dds_sine_cordic.v +GENERIC_DEPS += ../../common/ad_perfect_shuffle.v GENERIC_DEPS += ../../common/ad_rst.v GENERIC_DEPS += ../../common/up_axi.v GENERIC_DEPS += ../../common/up_clock_mon.v diff --git a/library/jesd204/ad_ip_jesd204_tpl_dac/ad_ip_jesd204_tpl_dac_framer.v b/library/jesd204/ad_ip_jesd204_tpl_dac/ad_ip_jesd204_tpl_dac_framer.v index b5dfa1307..f52f08db9 100644 --- a/library/jesd204/ad_ip_jesd204_tpl_dac/ad_ip_jesd204_tpl_dac_framer.v +++ b/library/jesd204/ad_ip_jesd204_tpl_dac/ad_ip_jesd204_tpl_dac_framer.v @@ -117,26 +117,24 @@ module ad_ip_jesd204_tpl_dac_framer #( end /* Slice channel and pack it into frames */ - for (i = 0; i < NUM_CHANNELS; i = i + 1) begin: g_frame_data_outer - for (j = 0; j < FRAMES_PER_BEAT; j = j + 1) begin: g_frame_data_inner - localparam w = BITS_PER_CHANNEL_PER_FRAME; - localparam dst_lsb = (i + j * NUM_CHANNELS) * w; - localparam src_lsb = (j + i * FRAMES_PER_BEAT) * w; - - assign frame_data_s[dst_lsb+:w] = dac_data_msb[src_lsb+:w]; - end - end + ad_perfect_shuffle #( + .NUM_GROUPS (NUM_CHANNELS), + .WORDS_PER_GROUP (FRAMES_PER_BEAT), + .WORD_WIDTH (BITS_PER_CHANNEL_PER_FRAME) + ) i_channels_to_frames ( + .data_in (dac_data_msb), + .data_out (frame_data_s) + ); /* Slice frame and pack it into lanes */ - for (i = 0; i < FRAMES_PER_BEAT; i = i + 1) begin: g_link_data_msb_outer - for (j = 0; j < NUM_LANES; j = j + 1) begin: g_link_data_msb_inner - localparam w = BITS_PER_LANE_PER_FRAME; - localparam dst_lsb = (i + j * FRAMES_PER_BEAT) * w; - localparam src_lsb = (j + i * NUM_LANES) * w; - - assign link_data_msb_s[dst_lsb+:w] = frame_data_s[src_lsb+:w]; - end - end + ad_perfect_shuffle #( + .NUM_GROUPS (FRAMES_PER_BEAT), + .WORDS_PER_GROUP (NUM_LANES), + .WORD_WIDTH (BITS_PER_LANE_PER_FRAME) + ) i_frames_to_lanes ( + .data_in (frame_data_s), + .data_out (link_data_msb_s) + ); /* Reorder octets LSB first */ for (i = 0; i < LINK_DATA_WIDTH; i = i + 8) begin: g_link_data diff --git a/library/jesd204/ad_ip_jesd204_tpl_dac/ad_ip_jesd204_tpl_dac_hw.tcl b/library/jesd204/ad_ip_jesd204_tpl_dac/ad_ip_jesd204_tpl_dac_hw.tcl index a8a85c832..59df6301f 100644 --- a/library/jesd204/ad_ip_jesd204_tpl_dac/ad_ip_jesd204_tpl_dac_hw.tcl +++ b/library/jesd204/ad_ip_jesd204_tpl_dac/ad_ip_jesd204_tpl_dac_hw.tcl @@ -35,6 +35,7 @@ ad_ip_files ad_ip_jesd204_tpl_dac [list \ $ad_hdl_dir/library/common/ad_dds_2.v \ $ad_hdl_dir/library/common/ad_dds_1.v \ $ad_hdl_dir/library/common/ad_dds.v \ + $ad_hdl_dir/library/common/ad_perfect_shuffle.v \ $ad_hdl_dir/library/common/ad_rst.v \ $ad_hdl_dir/library/common/up_axi.v \ $ad_hdl_dir/library/common/up_xfer_cntrl.v \ diff --git a/library/jesd204/ad_ip_jesd204_tpl_dac/ad_ip_jesd204_tpl_dac_ip.tcl b/library/jesd204/ad_ip_jesd204_tpl_dac/ad_ip_jesd204_tpl_dac_ip.tcl index 17e011623..abd54d900 100644 --- a/library/jesd204/ad_ip_jesd204_tpl_dac/ad_ip_jesd204_tpl_dac_ip.tcl +++ b/library/jesd204/ad_ip_jesd204_tpl_dac/ad_ip_jesd204_tpl_dac_ip.tcl @@ -33,6 +33,7 @@ adi_ip_files ad_ip_jesd204_tpl_dac [list \ "$ad_hdl_dir/library/common/ad_dds_2.v" \ "$ad_hdl_dir/library/common/ad_dds_1.v" \ "$ad_hdl_dir/library/common/ad_dds.v" \ + "$ad_hdl_dir/library/common/ad_perfect_shuffle.v" \ "$ad_hdl_dir/library/common/ad_rst.v" \ "$ad_hdl_dir/library/common/up_axi.v" \ "$ad_hdl_dir/library/common/up_xfer_cntrl.v" \