axi_ad9162: Fix code alignment, no functional changes

main
Istvan Csomortani 2018-03-14 09:25:46 +00:00 committed by István Csomortáni
parent fe2b43ddd9
commit d81f605ae9
3 changed files with 242 additions and 271 deletions

View File

@ -40,15 +40,15 @@ module axi_ad9162 #(
parameter ID = 0, parameter ID = 0,
parameter DAC_DATAPATH_DISABLE = 0) ( parameter DAC_DATAPATH_DISABLE = 0) (
// jesd interface // jesd interface
// tx_clk is (line-rate/40) // tx_clk is (line-rate/40)
input tx_clk, input tx_clk,
output tx_valid, output tx_valid,
output [255:0] tx_data, output [255:0] tx_data,
input tx_ready, input tx_ready,
// dma interface // dma interface
output dac_clk, output dac_clk,
output dac_valid, output dac_valid,
@ -57,7 +57,7 @@ module axi_ad9162 #(
input dac_dovf, input dac_dovf,
input dac_dunf, input dac_dunf,
// axi interface // axi interface
input s_axi_aclk, input s_axi_aclk,
input s_axi_aresetn, input s_axi_aresetn,
@ -81,105 +81,97 @@ module axi_ad9162 #(
output [ 1:0] s_axi_rresp, output [ 1:0] s_axi_rresp,
input s_axi_rready); input s_axi_rready);
// internal clocks and resets
wire dac_rst;
wire up_clk;
wire up_rstn;
// internal signals
wire [255:0] dac_data_s;
wire up_wreq_s;
wire [ 13:0] up_waddr_s;
wire [ 31:0] up_wdata_s;
wire up_wack_s;
wire up_rreq_s;
wire [ 13:0] up_raddr_s;
wire [ 31:0] up_rdata_s;
wire up_rack_s;
// signal name changes
assign up_clk = s_axi_aclk;
assign up_rstn = s_axi_aresetn;
// defaults
assign tx_valid = 1'b1;
// internal clocks and resets // device interface
wire dac_rst; axi_ad9162_if i_if (
wire up_clk; .tx_clk (tx_clk),
wire up_rstn; .tx_data (tx_data),
.dac_clk (dac_clk),
.dac_rst (dac_rst),
.dac_data (dac_data_s));
// internal signals // core
wire [255:0] dac_data_s; axi_ad9162_core #(
wire up_wreq_s; .ID (ID),
wire [ 13:0] up_waddr_s; .DATAPATH_DISABLE (DAC_DATAPATH_DISABLE))
wire [ 31:0] up_wdata_s; i_core (
wire up_wack_s; .dac_clk (dac_clk),
wire up_rreq_s; .dac_rst (dac_rst),
wire [ 13:0] up_raddr_s; .dac_data (dac_data_s),
wire [ 31:0] up_rdata_s; .dac_valid (dac_valid),
wire up_rack_s; .dac_enable (dac_enable),
.dac_ddata (dac_ddata),
.dac_dovf (dac_dovf),
.dac_dunf (dac_dunf),
.up_rstn (up_rstn),
.up_clk (up_clk),
.up_wreq (up_wreq_s),
.up_waddr (up_waddr_s),
.up_wdata (up_wdata_s),
.up_wack (up_wack_s),
.up_rreq (up_rreq_s),
.up_raddr (up_raddr_s),
.up_rdata (up_rdata_s),
.up_rack (up_rack_s));
// signal name changes // up bus interface
assign up_clk = s_axi_aclk; up_axi i_up_axi (
assign up_rstn = s_axi_aresetn; .up_rstn (up_rstn),
.up_clk (up_clk),
// defaults .up_axi_awvalid (s_axi_awvalid),
.up_axi_awaddr (s_axi_awaddr),
assign tx_valid = 1'b1; .up_axi_awready (s_axi_awready),
.up_axi_wvalid (s_axi_wvalid),
// device interface .up_axi_wdata (s_axi_wdata),
.up_axi_wstrb (s_axi_wstrb),
axi_ad9162_if i_if ( .up_axi_wready (s_axi_wready),
.tx_clk (tx_clk), .up_axi_bvalid (s_axi_bvalid),
.tx_data (tx_data), .up_axi_bresp (s_axi_bresp),
.dac_clk (dac_clk), .up_axi_bready (s_axi_bready),
.dac_rst (dac_rst), .up_axi_arvalid (s_axi_arvalid),
.dac_data (dac_data_s)); .up_axi_araddr (s_axi_araddr),
.up_axi_arready (s_axi_arready),
// core .up_axi_rvalid (s_axi_rvalid),
.up_axi_rresp (s_axi_rresp),
axi_ad9162_core #( .up_axi_rdata (s_axi_rdata),
.ID (ID), .up_axi_rready (s_axi_rready),
.DATAPATH_DISABLE (DAC_DATAPATH_DISABLE)) .up_wreq (up_wreq_s),
i_core ( .up_waddr (up_waddr_s),
.dac_clk (dac_clk), .up_wdata (up_wdata_s),
.dac_rst (dac_rst), .up_wack (up_wack_s),
.dac_data (dac_data_s), .up_rreq (up_rreq_s),
.dac_valid (dac_valid), .up_raddr (up_raddr_s),
.dac_enable (dac_enable), .up_rdata (up_rdata_s),
.dac_ddata (dac_ddata), .up_rack (up_rack_s));
.dac_dovf (dac_dovf),
.dac_dunf (dac_dunf),
.up_rstn (up_rstn),
.up_clk (up_clk),
.up_wreq (up_wreq_s),
.up_waddr (up_waddr_s),
.up_wdata (up_wdata_s),
.up_wack (up_wack_s),
.up_rreq (up_rreq_s),
.up_raddr (up_raddr_s),
.up_rdata (up_rdata_s),
.up_rack (up_rack_s));
// up bus interface
up_axi i_up_axi (
.up_rstn (up_rstn),
.up_clk (up_clk),
.up_axi_awvalid (s_axi_awvalid),
.up_axi_awaddr (s_axi_awaddr),
.up_axi_awready (s_axi_awready),
.up_axi_wvalid (s_axi_wvalid),
.up_axi_wdata (s_axi_wdata),
.up_axi_wstrb (s_axi_wstrb),
.up_axi_wready (s_axi_wready),
.up_axi_bvalid (s_axi_bvalid),
.up_axi_bresp (s_axi_bresp),
.up_axi_bready (s_axi_bready),
.up_axi_arvalid (s_axi_arvalid),
.up_axi_araddr (s_axi_araddr),
.up_axi_arready (s_axi_arready),
.up_axi_rvalid (s_axi_rvalid),
.up_axi_rresp (s_axi_rresp),
.up_axi_rdata (s_axi_rdata),
.up_axi_rready (s_axi_rready),
.up_wreq (up_wreq_s),
.up_waddr (up_waddr_s),
.up_wdata (up_wdata_s),
.up_wack (up_wack_s),
.up_rreq (up_rreq_s),
.up_raddr (up_raddr_s),
.up_rdata (up_rdata_s),
.up_rack (up_rack_s));
endmodule endmodule

View File

@ -40,13 +40,13 @@ module axi_ad9162_core #(
parameter ID = 0, parameter ID = 0,
parameter DATAPATH_DISABLE = 0) ( parameter DATAPATH_DISABLE = 0) (
// dac interface // dac interface
input dac_clk, input dac_clk,
output dac_rst, output dac_rst,
output [255:0] dac_data, output [255:0] dac_data,
// dma interface // dma interface
output dac_valid, output dac_valid,
output dac_enable, output dac_enable,
@ -54,7 +54,7 @@ module axi_ad9162_core #(
input dac_dovf, input dac_dovf,
input dac_dunf, input dac_dunf,
// processor interface // processor interface
input up_rstn, input up_rstn,
input up_clk, input up_clk,
@ -67,111 +67,99 @@ module axi_ad9162_core #(
output reg [ 31:0] up_rdata, output reg [ 31:0] up_rdata,
output reg up_rack); output reg up_rack);
// internal signals
wire dac_sync_s;
wire dac_datafmt_s;
wire [ 31:0] up_rdata_0_s;
wire up_rack_0_s;
wire up_wack_0_s;
wire [ 31:0] up_rdata_s;
wire up_rack_s;
wire up_wack_s;
// dac valid
assign dac_valid = 1'b1;
// processor read interface
always @(negedge up_rstn or posedge up_clk) begin
if (up_rstn == 0) begin
up_rdata <= 'd0;
up_rack <= 'd0;
// internal registers up_wack <= 'd0;
end else begin
up_rdata <= up_rdata_s | up_rdata_0_s;
// internal signals up_rack <= up_rack_s | up_rack_0_s;
up_wack <= up_wack_s | up_wack_0_s;
wire dac_sync_s;
wire dac_datafmt_s;
wire [ 31:0] up_rdata_0_s;
wire up_rack_0_s;
wire up_wack_0_s;
wire [ 31:0] up_rdata_s;
wire up_rack_s;
wire up_wack_s;
// dac valid
assign dac_valid = 1'b1;
// processor read interface
always @(negedge up_rstn or posedge up_clk) begin
if (up_rstn == 0) begin
up_rdata <= 'd0;
up_rack <= 'd0;
up_wack <= 'd0;
end else begin
up_rdata <= up_rdata_s | up_rdata_0_s;
up_rack <= up_rack_s | up_rack_0_s;
up_wack <= up_wack_s | up_wack_0_s;
end
end end
end
// dac channel // dac channel
axi_ad9162_channel #( axi_ad9162_channel #(
.CHANNEL_ID (0), .CHANNEL_ID (0),
.DATAPATH_DISABLE (DATAPATH_DISABLE)) .DATAPATH_DISABLE (DATAPATH_DISABLE))
i_channel_0 ( i_channel_0 (
.dac_clk (dac_clk), .dac_clk (dac_clk),
.dac_rst (dac_rst), .dac_rst (dac_rst),
.dac_enable (dac_enable), .dac_enable (dac_enable),
.dac_data (dac_data), .dac_data (dac_data),
.dma_data (dac_ddata), .dma_data (dac_ddata),
.dac_data_sync (dac_sync_s), .dac_data_sync (dac_sync_s),
.dac_dds_format (dac_datafmt_s), .dac_dds_format (dac_datafmt_s),
.up_rstn (up_rstn), .up_rstn (up_rstn),
.up_clk (up_clk), .up_clk (up_clk),
.up_wreq (up_wreq), .up_wreq (up_wreq),
.up_waddr (up_waddr), .up_waddr (up_waddr),
.up_wdata (up_wdata), .up_wdata (up_wdata),
.up_wack (up_wack_0_s), .up_wack (up_wack_0_s),
.up_rreq (up_rreq), .up_rreq (up_rreq),
.up_raddr (up_raddr), .up_raddr (up_raddr),
.up_rdata (up_rdata_0_s), .up_rdata (up_rdata_0_s),
.up_rack (up_rack_0_s)); .up_rack (up_rack_0_s));
// dac common processor interface // dac common processor interface
up_dac_common #(.ID(ID)) i_up_dac_common ( up_dac_common #(.ID(ID)) i_up_dac_common (
.mmcm_rst (), .mmcm_rst (),
.dac_clk (dac_clk), .dac_clk (dac_clk),
.dac_rst (dac_rst), .dac_rst (dac_rst),
.dac_sync (dac_sync_s), .dac_sync (dac_sync_s),
.dac_frame (), .dac_frame (),
.dac_clksel (), .dac_clksel (),
.dac_par_type (), .dac_par_type (),
.dac_par_enb (), .dac_par_enb (),
.dac_r1_mode (), .dac_r1_mode (),
.dac_datafmt (dac_datafmt_s), .dac_datafmt (dac_datafmt_s),
.dac_datarate (), .dac_datarate (),
.dac_status (1'b1), .dac_status (1'b1),
.dac_status_ovf (dac_dovf), .dac_status_ovf (dac_dovf),
.dac_status_unf (dac_dunf), .dac_status_unf (dac_dunf),
.dac_clk_ratio (32'd16), .dac_clk_ratio (32'd16),
.up_dac_ce (), .up_dac_ce (),
.up_drp_sel (), .up_drp_sel (),
.up_drp_wr (), .up_drp_wr (),
.up_drp_addr (), .up_drp_addr (),
.up_drp_wdata (), .up_drp_wdata (),
.up_drp_rdata (32'd0), .up_drp_rdata (32'd0),
.up_drp_ready (1'd0), .up_drp_ready (1'd0),
.up_drp_locked (1'd1), .up_drp_locked (1'd1),
.up_usr_chanmax (), .up_usr_chanmax (),
.dac_usr_chanmax (8'd0), .dac_usr_chanmax (8'd0),
.up_dac_gpio_in (32'd0), .up_dac_gpio_in (32'd0),
.up_dac_gpio_out (), .up_dac_gpio_out (),
.up_rstn (up_rstn), .up_rstn (up_rstn),
.up_clk (up_clk), .up_clk (up_clk),
.up_wreq (up_wreq), .up_wreq (up_wreq),
.up_waddr (up_waddr), .up_waddr (up_waddr),
.up_wdata (up_wdata), .up_wdata (up_wdata),
.up_wack (up_wack_s), .up_wack (up_wack_s),
.up_rreq (up_rreq), .up_rreq (up_rreq),
.up_raddr (up_raddr), .up_raddr (up_raddr),
.up_rdata (up_rdata_s), .up_rdata (up_rdata_s),
.up_rack (up_rack_s)); .up_rack (up_rack_s));
endmodule endmodule

View File

@ -37,65 +37,56 @@
module axi_ad9162_if ( module axi_ad9162_if (
// jesd interface // jesd interface
// tx_clk is (line-rate/40) // tx_clk is (line-rate/40)
input tx_clk, input tx_clk,
output reg [255:0] tx_data, output reg [255:0] tx_data,
// dac interface // dac interface
output dac_clk, output dac_clk,
input dac_rst, input dac_rst,
input [255:0] dac_data); input [255:0] dac_data);
// reorder data for the jesd links
assign dac_clk = tx_clk;
always @(posedge tx_clk) begin
tx_data[255:248] <= dac_data[247:240];
tx_data[247:240] <= dac_data[183:176];
tx_data[239:232] <= dac_data[119:112];
// internal registers tx_data[231:224] <= dac_data[ 55: 48];
tx_data[223:216] <= dac_data[255:248];
tx_data[215:208] <= dac_data[191:184];
// reorder data for the jesd links tx_data[207:200] <= dac_data[127:120];
tx_data[199:192] <= dac_data[ 63: 56];
assign dac_clk = tx_clk; tx_data[191:184] <= dac_data[231:224];
tx_data[183:176] <= dac_data[167:160];
always @(posedge tx_clk) begin tx_data[175:168] <= dac_data[103: 96];
tx_data[255:248] <= dac_data[247:240]; tx_data[167:160] <= dac_data[ 39: 32];
tx_data[247:240] <= dac_data[183:176]; tx_data[159:152] <= dac_data[239:232];
tx_data[239:232] <= dac_data[119:112]; tx_data[151:144] <= dac_data[175:168];
tx_data[231:224] <= dac_data[ 55: 48]; tx_data[143:136] <= dac_data[111:104];
tx_data[223:216] <= dac_data[255:248]; tx_data[135:128] <= dac_data[ 47: 40];
tx_data[215:208] <= dac_data[191:184]; tx_data[127:120] <= dac_data[215:208];
tx_data[207:200] <= dac_data[127:120]; tx_data[119:112] <= dac_data[151:144];
tx_data[199:192] <= dac_data[ 63: 56]; tx_data[111:104] <= dac_data[ 87: 80];
tx_data[191:184] <= dac_data[231:224]; tx_data[103: 96] <= dac_data[ 23: 16];
tx_data[183:176] <= dac_data[167:160]; tx_data[ 95: 88] <= dac_data[223:216];
tx_data[175:168] <= dac_data[103: 96]; tx_data[ 87: 80] <= dac_data[159:152];
tx_data[167:160] <= dac_data[ 39: 32]; tx_data[ 79: 72] <= dac_data[ 95: 88];
tx_data[159:152] <= dac_data[239:232]; tx_data[ 71: 64] <= dac_data[ 31: 24];
tx_data[151:144] <= dac_data[175:168]; tx_data[ 63: 56] <= dac_data[199:192];
tx_data[143:136] <= dac_data[111:104]; tx_data[ 55: 48] <= dac_data[135:128];
tx_data[135:128] <= dac_data[ 47: 40]; tx_data[ 47: 40] <= dac_data[ 71: 64];
tx_data[127:120] <= dac_data[215:208]; tx_data[ 39: 32] <= dac_data[ 7: 0];
tx_data[119:112] <= dac_data[151:144]; tx_data[ 31: 24] <= dac_data[207:200];
tx_data[111:104] <= dac_data[ 87: 80]; tx_data[ 23: 16] <= dac_data[143:136];
tx_data[103: 96] <= dac_data[ 23: 16]; tx_data[ 15: 8] <= dac_data[ 79: 72];
tx_data[ 95: 88] <= dac_data[223:216]; tx_data[ 7: 0] <= dac_data[ 15: 8];
tx_data[ 87: 80] <= dac_data[159:152]; end
tx_data[ 79: 72] <= dac_data[ 95: 88];
tx_data[ 71: 64] <= dac_data[ 31: 24];
tx_data[ 63: 56] <= dac_data[199:192];
tx_data[ 55: 48] <= dac_data[135:128];
tx_data[ 47: 40] <= dac_data[ 71: 64];
tx_data[ 39: 32] <= dac_data[ 7: 0];
tx_data[ 31: 24] <= dac_data[207:200];
tx_data[ 23: 16] <= dac_data[143:136];
tx_data[ 15: 8] <= dac_data[ 79: 72];
tx_data[ 7: 0] <= dac_data[ 15: 8];
end
endmodule endmodule