Archived
Optimize project dir structure, add dl814_k7 proj.
This commit is contained in:
@@ -0,0 +1,311 @@
|
||||
`timescale 1ns / 1ps
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Company:
|
||||
// Engineer:
|
||||
// _ _ ____
|
||||
// | | ___ ___| |__ / ___| __ _ ___
|
||||
// _ | |/ _ \/ __| '_ \ | | _ / _` |/ _ \
|
||||
// | |_| | (_) \__ \ | | | | |_| | (_| | (_) |
|
||||
// \___/ \___/|___/_| |_| \____|\__,_|\___/
|
||||
//
|
||||
// Create Date: 2022/07/01 17:37:27
|
||||
// Last Modified Date: 2023/03/06 11:26
|
||||
// Design Name:
|
||||
// Module Name: ad9361_rx_map_cmos_dual
|
||||
// Project Name:
|
||||
// Target Devices:
|
||||
// Tool Versions:
|
||||
// Description:
|
||||
//
|
||||
// Dependencies:
|
||||
//
|
||||
// Revision:
|
||||
// Revision 0.01 - File Created
|
||||
// Additional Comments:
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
module ad9361_rx_map_cmos_dual
|
||||
(
|
||||
input clk_2x_in ,
|
||||
input clk_in_rst ,
|
||||
|
||||
input rx_data_clk , // sync to output data
|
||||
input rx_data_clk_rst ,
|
||||
|
||||
input rx_fifo_rst , // async fifo reset
|
||||
|
||||
input rx_frame ,
|
||||
input [11:0] rx_data ,
|
||||
|
||||
output [11:0] rx_ch1_i ,
|
||||
output [11:0] rx_ch1_q ,
|
||||
output [11:0] rx_ch2_i ,
|
||||
output [11:0] rx_ch2_q
|
||||
);
|
||||
|
||||
genvar m;
|
||||
|
||||
// rx data
|
||||
wire [11:0] rx_data_i, rx_data_q;
|
||||
|
||||
generate
|
||||
for (m=0; m<12; m=m+1) begin : rx_data_iddr
|
||||
|
||||
IDDR #(
|
||||
.DDR_CLK_EDGE ("SAME_EDGE_PIPELINED" ),
|
||||
.INIT_Q1 (1'b0 ),
|
||||
.INIT_Q2 (1'b0 ),
|
||||
.SRTYPE ("ASYNC" )
|
||||
) i_rx_data_iddr (
|
||||
.CE (1'b1 ),
|
||||
.R (1'b0 ),
|
||||
.S (1'b0 ),
|
||||
.C (clk_2x_in ),
|
||||
.D (rx_data[m] ),
|
||||
.Q1 (rx_data_i[m] ),
|
||||
.Q2 (rx_data_q[m] )
|
||||
);
|
||||
|
||||
end
|
||||
endgenerate
|
||||
|
||||
// rx frame
|
||||
wire rx_frame_i;
|
||||
wire rx_frame_q;
|
||||
|
||||
IDDR #(
|
||||
.DDR_CLK_EDGE ("SAME_EDGE_PIPELINED" ),
|
||||
.INIT_Q1 (1'b0 ),
|
||||
.INIT_Q2 (1'b0 ),
|
||||
.SRTYPE ("ASYNC" )
|
||||
) i_rx_frame_iddr (
|
||||
.CE (1'b1 ),
|
||||
.R (1'b0 ),
|
||||
.S (1'b0 ),
|
||||
.C (clk_2x_in ),
|
||||
.D (rx_frame ),
|
||||
.Q1 (rx_frame_i ),
|
||||
.Q2 (rx_frame_q )
|
||||
);
|
||||
|
||||
// divide rx_data to dual channel
|
||||
reg [11:0] rx1_data_i = 'b0;
|
||||
reg [11:0] rx1_data_q = 'b0;
|
||||
reg [11:0] rx2_data_i = 'b0;
|
||||
reg [11:0] rx2_data_q = 'b0;
|
||||
|
||||
wire rx_fifo_wr_en;
|
||||
reg rx_fifo_rd_en = 'b0;
|
||||
|
||||
wire rx_fifo_empty_1;
|
||||
wire rx_fifo_empty_2;
|
||||
wire rx_fifo_empty_3;
|
||||
wire rx_fifo_empty_4;
|
||||
|
||||
assign rx_fifo_wr_en = rx_frame_i; // align data & write enable
|
||||
|
||||
always @ (posedge clk_2x_in) begin
|
||||
if (clk_in_rst) begin
|
||||
rx1_data_i <= 'b0;
|
||||
rx2_data_i <= 'b0;
|
||||
end
|
||||
else if(rx_frame_i) begin
|
||||
rx1_data_i <= rx_data_i;
|
||||
end
|
||||
else begin
|
||||
rx2_data_i <= rx_data_i;
|
||||
end
|
||||
end
|
||||
|
||||
always @ (posedge clk_2x_in) begin
|
||||
if (clk_in_rst) begin
|
||||
rx1_data_q <= 'b0;
|
||||
rx2_data_q <= 'b0;
|
||||
end
|
||||
else if(rx_frame_q) begin
|
||||
rx1_data_q <= rx_data_q;
|
||||
end
|
||||
else begin
|
||||
rx2_data_q <= rx_data_q;
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge rx_data_clk) begin
|
||||
if (rx_data_clk_rst) begin
|
||||
rx_fifo_rd_en <= 'b0;
|
||||
end
|
||||
else begin
|
||||
rx_fifo_rd_en <= &{~rx_fifo_empty_1, ~rx_fifo_empty_2, ~rx_fifo_empty_3, ~rx_fifo_empty_4};
|
||||
end
|
||||
end
|
||||
|
||||
ad9361_fifo u_rx_fifo_ch1_i
|
||||
(
|
||||
.rst (rx_fifo_rst ), // input wire rst
|
||||
.wr_clk (clk_2x_in ), // input wire wr_clk
|
||||
.rd_clk (rx_data_clk ), // input wire rd_clk
|
||||
.din (rx1_data_i ), // input wire [11 : 0] din
|
||||
.wr_en (rx_fifo_wr_en ), // input wire wr_en
|
||||
.rd_en (rx_fifo_rd_en ), // input wire rd_en
|
||||
.dout (rx_ch1_i ), // output wire [11 : 0] dout
|
||||
.full ( ), // output wire full
|
||||
.empty (rx_fifo_empty_1) // output wire empty
|
||||
);
|
||||
|
||||
ad9361_fifo u_rx_fifo_ch1_q
|
||||
(
|
||||
.rst (rx_fifo_rst ), // input wire rst
|
||||
.wr_clk (clk_2x_in ), // input wire wr_clk
|
||||
.rd_clk (rx_data_clk ), // input wire rd_clk
|
||||
.din (rx1_data_q ), // input wire [11 : 0] din
|
||||
.wr_en (rx_fifo_wr_en ), // input wire wr_en
|
||||
.rd_en (rx_fifo_rd_en ), // input wire rd_en
|
||||
.dout (rx_ch1_q ), // output wire [11 : 0] dout
|
||||
.full ( ), // output wire full
|
||||
.empty (rx_fifo_empty_2) // output wire empty
|
||||
);
|
||||
|
||||
ad9361_fifo u_rx_fifo_ch2_i
|
||||
(
|
||||
.rst (rx_fifo_rst ), // input wire rst
|
||||
.wr_clk (clk_2x_in ), // input wire wr_clk
|
||||
.rd_clk (rx_data_clk ), // input wire rd_clk
|
||||
.din (rx2_data_i ), // input wire [11 : 0] din
|
||||
.wr_en (rx_fifo_wr_en ), // input wire wr_en
|
||||
.rd_en (rx_fifo_rd_en ), // input wire rd_en
|
||||
.dout (rx_ch2_i ), // output wire [11 : 0] dout
|
||||
.full ( ), // output wire full
|
||||
.empty (rx_fifo_empty_3) // output wire empty
|
||||
);
|
||||
|
||||
ad9361_fifo u_rx_fifo_ch2_q
|
||||
(
|
||||
.rst (rx_fifo_rst ), // input wire rst
|
||||
.wr_clk (clk_2x_in ), // input wire wr_clk
|
||||
.rd_clk (rx_data_clk ), // input wire rd_clk
|
||||
.din (rx2_data_q ), // input wire [11 : 0] din
|
||||
.wr_en (rx_fifo_wr_en ), // input wire wr_en
|
||||
.rd_en (rx_fifo_rd_en ), // input wire rd_en
|
||||
.dout (rx_ch2_q ), // output wire [11 : 0] dout
|
||||
.full ( ), // output wire full
|
||||
.empty (rx_fifo_empty_4) // output wire empty
|
||||
);
|
||||
|
||||
endmodule
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Company:
|
||||
// Engineer:
|
||||
// _ _ ____
|
||||
// | | ___ ___| |__ / ___| __ _ ___
|
||||
// _ | |/ _ \/ __| '_ \ | | _ / _` |/ _ \
|
||||
// | |_| | (_) \__ \ | | | | |_| | (_| | (_) |
|
||||
// \___/ \___/|___/_| |_| \____|\__,_|\___/
|
||||
//
|
||||
// Create Date: 2023/02/25 14:56:59
|
||||
// Design Name:
|
||||
// Module Name: tb_ad9361_rx_map_cmos_dual
|
||||
// Project Name:
|
||||
// Target Devices:
|
||||
// Tool Versions:
|
||||
// Description:
|
||||
//
|
||||
// Dependencies:
|
||||
//
|
||||
// Revision:
|
||||
// Revision 0.01 - File Created
|
||||
// Additional Comments:
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// module tb_ad9361_rx_map_cmos_dual;
|
||||
|
||||
// reg rx_data_clk = 1'b1;
|
||||
// reg clk_2x_in = 1'b1;
|
||||
// reg clk_4x_in = 1'b1;
|
||||
// reg rst = 1'b1;
|
||||
|
||||
// wire clk_in_rst, rx_data_clk_rst;
|
||||
// assign clk_in_rst = rst;
|
||||
// assign rx_data_clk_rst = rst;
|
||||
|
||||
// reg rx_frame;
|
||||
// reg [11:0] rx_data;
|
||||
// reg rx_fifo_rst = 1'b0;
|
||||
|
||||
// wire [11:0] rx_ch1_i, rx_ch1_q, rx_ch2_i, rx_ch2_q;
|
||||
|
||||
// ad9361_rx_map_cmos_dual u_ad9361_rx_map_cmos_dual
|
||||
// (
|
||||
// .clk_2x_in (clk_2x_in ),// input clk_2x_in
|
||||
// .clk_in_rst (clk_in_rst ),// input clk_in_rst
|
||||
|
||||
// .rx_data_clk (rx_data_clk ),// input rx_data_clk
|
||||
// .rx_data_clk_rst (rx_data_clk_rst ),// input rx_data_clk_rst
|
||||
|
||||
// .rx_fifo_rst (rx_fifo_rst ),// input rx_fifo_rst
|
||||
|
||||
// .rx_frame (rx_frame ),// input rx_frame
|
||||
// .rx_data (rx_data ),// input [11:0] rx_data
|
||||
|
||||
// .rx_ch1_i (rx_ch1_i ),// output [11:0] rx_ch1_i
|
||||
// .rx_ch1_q (rx_ch1_q ),// output [11:0] rx_ch1_q
|
||||
// .rx_ch2_i (rx_ch2_i ),// output [11:0] rx_ch2_i
|
||||
// .rx_ch2_q (rx_ch2_q ) // output [11:0] rx_ch2_q
|
||||
// );
|
||||
|
||||
// initial begin
|
||||
// #102 rst = 1'b0;
|
||||
// #10000 rx_fifo_rst = 1'b1;
|
||||
// #100 rx_fifo_rst = 1'b0;
|
||||
// end
|
||||
|
||||
// always #5 clk_4x_in = ~clk_4x_in;
|
||||
|
||||
// always begin
|
||||
// #3;
|
||||
// clk_2x_in = ~clk_2x_in;
|
||||
// #7;
|
||||
// end
|
||||
|
||||
// always begin
|
||||
// #6;
|
||||
// rx_data_clk = ~rx_data_clk;
|
||||
// #14;
|
||||
// end
|
||||
|
||||
// reg [1:0] rx_cnt;
|
||||
|
||||
// always @(posedge clk_4x_in) begin
|
||||
// if (rst) begin
|
||||
// rx_cnt <= 'b0;
|
||||
// end
|
||||
// else begin
|
||||
// rx_cnt <= rx_cnt + 1'b1;
|
||||
// end
|
||||
// end
|
||||
|
||||
// always @(posedge clk_4x_in) begin
|
||||
// if (rst) begin
|
||||
// rx_frame <= 'b0;
|
||||
// rx_data <= 'b0;
|
||||
// end
|
||||
// else begin
|
||||
// rx_data <= rx_data + 12'd1;
|
||||
|
||||
// case (rx_cnt[1])
|
||||
// 1'b0: begin
|
||||
// rx_frame <= 1'b1;
|
||||
// end
|
||||
// 1'd1: begin
|
||||
// rx_frame <= 1'b0;
|
||||
// end
|
||||
// endcase
|
||||
// end
|
||||
// end
|
||||
|
||||
// endmodule
|
||||
@@ -0,0 +1,214 @@
|
||||
`timescale 1ns / 1ps
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Company:
|
||||
// Engineer:
|
||||
// _ _ ____
|
||||
// | | ___ ___| |__ / ___| __ _ ___
|
||||
// _ | |/ _ \/ __| '_ \ | | _ / _` |/ _ \
|
||||
// | |_| | (_) \__ \ | | | | |_| | (_| | (_) |
|
||||
// \___/ \___/|___/_| |_| \____|\__,_|\___/
|
||||
//
|
||||
// Create Date: 2022/07/01 17:37:27
|
||||
// Last Modified Date: 2023/03/03 13:01
|
||||
// Design Name:
|
||||
// Module Name: ad9361_rx_map_cmos_single
|
||||
// Project Name:
|
||||
// Target Devices:
|
||||
// Tool Versions:
|
||||
// Description:
|
||||
//
|
||||
// Dependencies:
|
||||
//
|
||||
// Revision:
|
||||
// Revision 0.01 - File Created
|
||||
// Additional Comments:
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
module ad9361_rx_map_cmos_single
|
||||
(
|
||||
input clk_in ,
|
||||
input clk_in_rst ,
|
||||
|
||||
input rx_data_clk ,
|
||||
input rx_data_clk_rst ,
|
||||
|
||||
input rx_fifo_rst ,
|
||||
|
||||
input rx_frame ,
|
||||
input [11:0] rx_data ,
|
||||
|
||||
output [11:0] rx_data_i ,
|
||||
output [11:0] rx_data_q
|
||||
);
|
||||
|
||||
genvar m;
|
||||
|
||||
// rx data
|
||||
wire [11:0] rx_raw_i, rx_raw_q;
|
||||
|
||||
generate
|
||||
for (m=0; m<12; m=m+1) begin : rx_data_iddr
|
||||
|
||||
IDDR #(
|
||||
.DDR_CLK_EDGE ("SAME_EDGE_PIPELINED" ),
|
||||
.INIT_Q1 (1'b0 ),
|
||||
.INIT_Q2 (1'b0 ),
|
||||
.SRTYPE ("ASYNC" )
|
||||
) i_rx_data_iddr (
|
||||
.CE (1'b1 ),
|
||||
.R (1'b0 ),
|
||||
.S (1'b0 ),
|
||||
.C (clk_in ),
|
||||
.D (rx_data[m] ),
|
||||
.Q1 (rx_raw_i[m] ),
|
||||
.Q2 (rx_raw_q[m] )
|
||||
);
|
||||
|
||||
end
|
||||
endgenerate
|
||||
|
||||
|
||||
// divide rx_data to dual channel
|
||||
reg rx_fifo_wr_en = 1'b0;
|
||||
reg rx_fifo_rd_en = 'b0;
|
||||
|
||||
wire rx_fifo_empty_1;
|
||||
wire rx_fifo_empty_2;
|
||||
|
||||
always @(posedge clk_in) begin
|
||||
if (clk_in_rst) begin
|
||||
rx_fifo_wr_en <= 1'b0;
|
||||
end
|
||||
else begin
|
||||
rx_fifo_wr_en <= 1'b1;
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge rx_data_clk) begin
|
||||
if (rx_data_clk_rst) begin
|
||||
rx_fifo_rd_en <= 'b0;
|
||||
end
|
||||
else begin
|
||||
rx_fifo_rd_en <= &{~rx_fifo_empty_1, ~rx_fifo_empty_2};
|
||||
end
|
||||
end
|
||||
|
||||
ad9361_fifo u_rx_fifo_i
|
||||
(
|
||||
.rst (rx_fifo_rst ), // input wire rst
|
||||
.wr_clk (clk_in ), // input wire wr_clk
|
||||
.rd_clk (rx_data_clk ), // input wire rd_clk
|
||||
.din (rx_raw_i ), // input wire [11 : 0] din
|
||||
.wr_en (rx_fifo_wr_en ), // input wire wr_en
|
||||
.rd_en (rx_fifo_rd_en ), // input wire rd_en
|
||||
.dout (rx_data_i ), // output wire [11 : 0] dout
|
||||
.full ( ), // output wire full
|
||||
.empty (rx_fifo_empty_1) // output wire empty
|
||||
);
|
||||
|
||||
ad9361_fifo u_rx_fifo_q
|
||||
(
|
||||
.rst (rx_fifo_rst ), // input wire rst
|
||||
.wr_clk (clk_in ), // input wire wr_clk
|
||||
.rd_clk (rx_data_clk ), // input wire rd_clk
|
||||
.din (rx_raw_q ), // input wire [11 : 0] din
|
||||
.wr_en (rx_fifo_wr_en ), // input wire wr_en
|
||||
.rd_en (rx_fifo_rd_en ), // input wire rd_en
|
||||
.dout (rx_data_q ), // output wire [11 : 0] dout
|
||||
.full ( ), // output wire full
|
||||
.empty (rx_fifo_empty_2) // output wire empty
|
||||
);
|
||||
|
||||
endmodule
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Company:
|
||||
// Engineer:
|
||||
// _ _ ____
|
||||
// | | ___ ___| |__ / ___| __ _ ___
|
||||
// _ | |/ _ \/ __| '_ \ | | _ / _` |/ _ \
|
||||
// | |_| | (_) \__ \ | | | | |_| | (_| | (_) |
|
||||
// \___/ \___/|___/_| |_| \____|\__,_|\___/
|
||||
//
|
||||
// Create Date: 2022/07/01 17:37:27
|
||||
// Design Name:
|
||||
// Module Name: tb_ad9361_rx_map_cmos_single
|
||||
// Project Name:
|
||||
// Target Devices:
|
||||
// Tool Versions:
|
||||
// Description:
|
||||
//
|
||||
// Dependencies:
|
||||
//
|
||||
// Revision:
|
||||
// Revision 0.01 - File Created
|
||||
// Additional Comments:
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// module tb_ad9361_rx_map_cmos_single;
|
||||
|
||||
// reg clk_in = 1'b1;
|
||||
// reg clk_2x_in = 1'b1;
|
||||
// reg rx_data_clk = 1'b1;
|
||||
// reg rst = 1'b1;
|
||||
|
||||
// wire clk_in_rst, rx_data_clk_rst;
|
||||
|
||||
// assign clk_in_rst = rst;
|
||||
// assign rx_data_clk_rst = rst;
|
||||
|
||||
// reg rx_frame = 'b0;
|
||||
// reg [11:0] rx_data = 'b0;
|
||||
|
||||
// reg rx_fifo_rst = 'b0;
|
||||
|
||||
// wire [11:0] rx_data_i, rx_data_q;
|
||||
|
||||
// ad9361_rx_map_cmos_single u_ad9361_rx_map_cmos_single
|
||||
// (
|
||||
// .clk_in (clk_in ),
|
||||
// .clk_in_rst (clk_in_rst ),
|
||||
|
||||
// .rx_data_clk (rx_data_clk ),
|
||||
// .rx_data_clk_rst(rx_data_clk_rst),
|
||||
|
||||
// .rx_fifo_rst (rx_fifo_rst ),
|
||||
|
||||
// .rx_frame (rx_frame ),
|
||||
// .rx_data (rx_data ),
|
||||
|
||||
// .rx_data_i (rx_data_i ),
|
||||
// .rx_data_q (rx_data_q )
|
||||
// );
|
||||
|
||||
// initial begin
|
||||
// #102 rst = 1'b0;
|
||||
// #1000 rx_fifo_rst = 1'b1;
|
||||
// #100 rx_fifo_rst = 1'b0;
|
||||
// end
|
||||
|
||||
// always begin
|
||||
// #5 clk_2x_in = ~clk_2x_in;
|
||||
// end
|
||||
|
||||
// always begin
|
||||
// #3 rx_data_clk = ~rx_data_clk;
|
||||
// #7 clk_in = ~clk_in;
|
||||
// end
|
||||
|
||||
// always @(posedge clk_2x_in) begin
|
||||
// if (rst) begin
|
||||
// rx_frame <= 'b0;
|
||||
// rx_data <= 'b0;
|
||||
// end
|
||||
// else begin
|
||||
// rx_frame <= ~rx_frame;
|
||||
// rx_data <= rx_data + 1'b1;
|
||||
// end
|
||||
// end
|
||||
|
||||
// endmodule
|
||||
@@ -0,0 +1,394 @@
|
||||
`timescale 1ns / 1ps
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Company:
|
||||
// Engineer:
|
||||
// _ _ ____
|
||||
// | | ___ ___| |__ / ___| __ _ ___
|
||||
// _ | |/ _ \/ __| '_ \ | | _ / _` |/ _ \
|
||||
// | |_| | (_) \__ \ | | | | |_| | (_| | (_) |
|
||||
// \___/ \___/|___/_| |_| \____|\__,_|\___/
|
||||
//
|
||||
// Create Date: 2022/07/01 17:37:27
|
||||
// Last Modified Date: 2023/03/06 10:54
|
||||
// Design Name:
|
||||
// Module Name: ad9361_rx_mapping_dual
|
||||
// Project Name:
|
||||
// Target Devices:
|
||||
// Tool Versions:
|
||||
// Description:
|
||||
//
|
||||
// Dependencies:
|
||||
//
|
||||
// Revision:
|
||||
// Revision 0.01 - File Created
|
||||
// Additional Comments:
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
module ad9361_rx_map_lvds_dual
|
||||
(
|
||||
input clk_4x_in , // sync to input data
|
||||
input clk_in_rst ,
|
||||
|
||||
input rx_data_clk , // sync to output data
|
||||
input rx_data_clk_rst ,
|
||||
|
||||
input rx_fifo_rst , // async fifo reset
|
||||
|
||||
input rx_frame_p ,
|
||||
input rx_frame_n ,
|
||||
input [ 5:0] rx_data_p , // data from ad9361 p1 port
|
||||
input [ 5:0] rx_data_n ,
|
||||
|
||||
output [11:0] rx_ch1_i ,
|
||||
output [11:0] rx_ch1_q ,
|
||||
output [11:0] rx_ch2_i ,
|
||||
output [11:0] rx_ch2_q
|
||||
);
|
||||
|
||||
genvar m;
|
||||
|
||||
// rx data
|
||||
wire [5:0] rx_data;
|
||||
wire [5:0] rx_data_i, rx_data_q;
|
||||
|
||||
generate
|
||||
for (m=0; m<6; m=m+1) begin : rx_data_iddr
|
||||
|
||||
IBUFDS #(
|
||||
.DIFF_TERM ("TRUE" )
|
||||
) u_ibufds_rx_data
|
||||
(
|
||||
.I (rx_data_p[m] ),
|
||||
.IB (rx_data_n[m] ),
|
||||
.O (rx_data[m] )
|
||||
);
|
||||
|
||||
IDDR #(
|
||||
.DDR_CLK_EDGE ("SAME_EDGE_PIPELINED" ),
|
||||
.INIT_Q1 (1'b0 ),
|
||||
.INIT_Q2 (1'b0 ),
|
||||
.SRTYPE ("ASYNC" )
|
||||
) u_rx_data_iddr (
|
||||
.CE (1'b1 ), // clock enable
|
||||
.R (1'b0 ), // iddr reset
|
||||
.S (1'b0 ), // iddr set
|
||||
.C (clk_4x_in ), // iddr clock
|
||||
.D (rx_data[m] ), // ddr data
|
||||
.Q1 (rx_data_i[m] ), // sdr data at rising edge
|
||||
.Q2 (rx_data_q[m] ) // sdr data at falling edge
|
||||
);
|
||||
|
||||
end
|
||||
endgenerate
|
||||
|
||||
// rx frame
|
||||
wire rx_frame;
|
||||
wire rx_frame_i;
|
||||
wire rx_frame_q;
|
||||
|
||||
IBUFDS #(
|
||||
.DIFF_TERM ("TRUE" )
|
||||
) u_ibufds_rx_frame
|
||||
(
|
||||
.I (rx_frame_p ),
|
||||
.IB (rx_frame_n ),
|
||||
.O (rx_frame )
|
||||
);
|
||||
|
||||
IDDR #(
|
||||
.DDR_CLK_EDGE ("SAME_EDGE_PIPELINED" ),
|
||||
.INIT_Q1 (1'b0 ),
|
||||
.INIT_Q2 (1'b0 ),
|
||||
.SRTYPE ("ASYNC" )
|
||||
) u_rx_frame_iddr (
|
||||
.CE (1'b1 ), // clock enable
|
||||
.R (1'b0 ), // iddr reset
|
||||
.S (1'b0 ), // iddr set
|
||||
.C (clk_4x_in ), // iddr clock
|
||||
.D (rx_frame ), // ddr data
|
||||
.Q1 (rx_frame_i ), // sdr data at rising edge
|
||||
.Q2 (rx_frame_q ) // sdr data at falling edge
|
||||
);
|
||||
|
||||
// unpack rx frame & data
|
||||
reg rx_frame_i_d1 = 'b0;
|
||||
reg [ 5:0] rx_data_i_d1 = 'b0;
|
||||
reg [ 5:0] rx_data_q_d1 = 'b0;
|
||||
reg rx_flag = 'b0; // rx frame rising edge indicator
|
||||
reg [ 1:0] rx_cnt = 'b0; // unpack stage counter
|
||||
|
||||
always @(posedge clk_4x_in) begin
|
||||
// wait for [rx_flag]
|
||||
rx_frame_i_d1 <= rx_frame_i;
|
||||
rx_data_i_d1 <= rx_data_i;
|
||||
rx_data_q_d1 <= rx_data_q;
|
||||
end
|
||||
|
||||
always @(posedge clk_4x_in) begin
|
||||
if (clk_in_rst) begin
|
||||
rx_flag <= 'b0;
|
||||
end
|
||||
else if (~rx_frame_i_d1 & rx_frame_i) begin
|
||||
// assert when rising edge of rx frame is detected
|
||||
rx_flag <= 'b1;
|
||||
end
|
||||
else begin
|
||||
rx_flag <= rx_flag;
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk_4x_in) begin
|
||||
if (clk_in_rst) begin
|
||||
rx_cnt <= 'b0;
|
||||
end
|
||||
else begin
|
||||
rx_cnt <= (rx_flag) ? rx_cnt + 1'b1 : rx_cnt;
|
||||
end
|
||||
end
|
||||
|
||||
reg [11:0] rx1_data_i = 'b0;
|
||||
reg [11:0] rx1_data_q = 'b0;
|
||||
reg [11:0] rx2_data_i = 'b0;
|
||||
reg [11:0] rx2_data_q = 'b0;
|
||||
|
||||
always @(posedge clk_4x_in) begin
|
||||
if (clk_in_rst) begin
|
||||
rx1_data_i <= 'b0;
|
||||
rx1_data_q <= 'b0;
|
||||
rx2_data_i <= 'b0;
|
||||
rx2_data_q <= 'b0;
|
||||
end
|
||||
else begin
|
||||
case (rx_cnt)
|
||||
3'd0: begin
|
||||
// 1st clock cycle: upper 6-bit of rx ch1 inphase/quadrature data
|
||||
rx1_data_i[11:6] <= rx_data_i_d1;
|
||||
rx1_data_q[11:6] <= rx_data_q_d1;
|
||||
end
|
||||
3'd1: begin
|
||||
// 2nd clock cycle: lower 6-bit of rx ch1 inphase/quadrature data
|
||||
rx1_data_i[ 5:0] <= rx_data_i_d1;
|
||||
rx1_data_q[ 5:0] <= rx_data_q_d1;
|
||||
end
|
||||
3'd2: begin
|
||||
// 3rd clock cycle: upper 6-bit of rx ch2 inphase/quadrature data
|
||||
rx2_data_i[11:6] <= rx_data_i_d1;
|
||||
rx2_data_q[11:6] <= rx_data_q_d1;
|
||||
end
|
||||
3'd3: begin
|
||||
// 4th clock cycle: lower 6-bit of rx ch2 inphase/quadrature data
|
||||
rx2_data_i[ 5:0] <= rx_data_i_d1;
|
||||
rx2_data_q[ 5:0] <= rx_data_q_d1;
|
||||
end
|
||||
default: begin
|
||||
rx1_data_i <= 'b0;
|
||||
rx1_data_q <= 'b0;
|
||||
rx2_data_i <= 'b0;
|
||||
rx2_data_q <= 'b0;
|
||||
end
|
||||
endcase
|
||||
end
|
||||
end
|
||||
|
||||
// write fifo when rx1/2_data_i/q are all prepared with 192MHz clock
|
||||
// read fifo at every clock cycle with 48MHz clock
|
||||
reg fifo_wr_en = 'b0;
|
||||
reg fifo_rd_en = 'b0;
|
||||
wire rx_fifo_empty_1;
|
||||
wire rx_fifo_empty_2;
|
||||
wire rx_fifo_empty_3;
|
||||
wire rx_fifo_empty_4;
|
||||
|
||||
always @(posedge clk_4x_in) begin
|
||||
if (clk_in_rst) begin
|
||||
fifo_wr_en <= 'b0;
|
||||
end
|
||||
else if (rx_cnt == 2'd3) begin
|
||||
fifo_wr_en <= 1'b1;
|
||||
end
|
||||
else begin
|
||||
fifo_wr_en <= 'b0;
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge rx_data_clk) begin
|
||||
if (rx_data_clk_rst) begin
|
||||
fifo_rd_en <= 1'b0;
|
||||
end
|
||||
else begin
|
||||
fifo_rd_en <= &{~rx_fifo_empty_1, ~rx_fifo_empty_2, ~rx_fifo_empty_3, ~rx_fifo_empty_4};
|
||||
end
|
||||
end
|
||||
|
||||
ad9361_fifo u_rx_fifo_ch1_i
|
||||
(
|
||||
.rst (rx_fifo_rst ), // input wire rst
|
||||
.wr_clk (clk_4x_in ), // input wire wr_clk
|
||||
.rd_clk (rx_data_clk ), // input wire rd_clk
|
||||
.din (rx1_data_i ), // input wire [11 : 0] din
|
||||
.wr_en (fifo_wr_en ), // input wire wr_en
|
||||
.rd_en (fifo_rd_en ), // input wire rd_en
|
||||
.dout (rx_ch1_i ), // output wire [11 : 0] dout
|
||||
.full ( ), // output wire full
|
||||
.empty (rx_fifo_empty_1) // output wire empty
|
||||
);
|
||||
|
||||
ad9361_fifo u_rx_fifo_ch1_q
|
||||
(
|
||||
.rst (rx_fifo_rst ), // input wire rst
|
||||
.wr_clk (clk_4x_in ), // input wire wr_clk
|
||||
.rd_clk (rx_data_clk ), // input wire rd_clk
|
||||
.din (rx1_data_q ), // input wire [11 : 0] din
|
||||
.wr_en (fifo_wr_en ), // input wire wr_en
|
||||
.rd_en (fifo_rd_en ), // input wire rd_en
|
||||
.dout (rx_ch1_q ), // output wire [11 : 0] dout
|
||||
.full ( ), // output wire full
|
||||
.empty (rx_fifo_empty_2) // output wire empty
|
||||
);
|
||||
|
||||
ad9361_fifo u_rx_fifo_ch2_i
|
||||
(
|
||||
.rst (rx_fifo_rst ), // input wire rst
|
||||
.wr_clk (clk_4x_in ), // input wire wr_clk
|
||||
.rd_clk (rx_data_clk ), // input wire rd_clk
|
||||
.din (rx2_data_i ), // input wire [11 : 0] din
|
||||
.wr_en (fifo_wr_en ), // input wire wr_en
|
||||
.rd_en (fifo_rd_en ), // input wire rd_en
|
||||
.dout (rx_ch2_i ), // output wire [11 : 0] dout
|
||||
.full ( ), // output wire full
|
||||
.empty (rx_fifo_empty_3) // output wire empty
|
||||
);
|
||||
|
||||
ad9361_fifo u_rx_fifo_ch2_q
|
||||
(
|
||||
.rst (rx_fifo_rst ), // input wire rst
|
||||
.wr_clk (clk_4x_in ), // input wire wr_clk
|
||||
.rd_clk (rx_data_clk ), // input wire rd_clk
|
||||
.din (rx2_data_q ), // input wire [11 : 0] din
|
||||
.wr_en (fifo_wr_en ), // input wire wr_en
|
||||
.rd_en (fifo_rd_en ), // input wire rd_en
|
||||
.dout (rx_ch2_q ), // output wire [11 : 0] dout
|
||||
.full ( ), // output wire full
|
||||
.empty (rx_fifo_empty_4) // output wire empty
|
||||
);
|
||||
|
||||
endmodule
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Company:
|
||||
// Engineer:
|
||||
//
|
||||
// Create Date: 2023/02/25 14:56:59
|
||||
// Design Name:
|
||||
// Module Name: tb_ad9361_rx_map_lvds_dual
|
||||
// Project Name:
|
||||
// Target Devices:
|
||||
// Tool Versions:
|
||||
// Description:
|
||||
//
|
||||
// Dependencies:
|
||||
//
|
||||
// Revision:
|
||||
// Revision 0.01 - File Created
|
||||
// Additional Comments:
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// module tb_ad9361_rx_map_lvds_dual;
|
||||
|
||||
// reg rx_data_clk = 1'b1;
|
||||
// reg clk_4x_in = 1'b1;
|
||||
// reg clk_8x_in = 1'b1;
|
||||
// reg rst = 1'b1;
|
||||
|
||||
// wire clk_in_rst, rx_data_clk_rst;
|
||||
// assign clk_in_rst = rst;
|
||||
// assign rx_data_clk_rst = rst;
|
||||
|
||||
// reg rx_frame_p, rx_frame_n;
|
||||
// reg [5:0] rx_data_p, rx_data_n;
|
||||
// reg rx_fifo_rst = 1'b0;
|
||||
|
||||
// wire [11:0] rx_ch1_i, rx_ch1_q, rx_ch2_i, rx_ch2_q;
|
||||
|
||||
// ad9361_rx_map_lvds_dual u_ad9361_rx_map_lvds_dual
|
||||
// (
|
||||
// .clk_4x_in (clk_4x_in ),// input clk_4x_in
|
||||
// .clk_in_rst (clk_in_rst ),// input clk_in_rst
|
||||
|
||||
// .rx_data_clk (rx_data_clk ),// input rx_data_clk
|
||||
// .rx_data_clk_rst (rx_data_clk_rst ),// input rx_data_clk_rst
|
||||
|
||||
// .rx_fifo_rst (rx_fifo_rst ),// input rx_fifo_rst
|
||||
|
||||
// .rx_frame_p (rx_frame_p ),// input rx_frame_p
|
||||
// .rx_frame_n (rx_frame_n ),// input rx_frame_n
|
||||
// .rx_data_p (rx_data_p ),// input [ 5:0] rx_data_p
|
||||
// .rx_data_n (rx_data_n ),// input [ 5:0] rx_data_n
|
||||
|
||||
// .rx_ch1_i (rx_ch1_i ),// output [11:0] rx_ch1_i
|
||||
// .rx_ch1_q (rx_ch1_q ),// output [11:0] rx_ch1_q
|
||||
// .rx_ch2_i (rx_ch2_i ),// output [11:0] rx_ch2_i
|
||||
// .rx_ch2_q (rx_ch2_q ) // output [11:0] rx_ch2_q
|
||||
// );
|
||||
|
||||
// initial begin
|
||||
// #102 rst = 1'b0;
|
||||
// #10000 rx_fifo_rst = 1'b1;
|
||||
// #100 rx_fifo_rst = 1'b0;
|
||||
// end
|
||||
|
||||
// always #5 clk_8x_in = ~clk_8x_in;
|
||||
|
||||
// always begin
|
||||
// #3;
|
||||
// clk_4x_in = ~clk_4x_in;
|
||||
// #7;
|
||||
// end
|
||||
|
||||
// always begin
|
||||
// #23;
|
||||
// rx_data_clk = ~rx_data_clk;
|
||||
// #17;
|
||||
// end
|
||||
|
||||
// reg [2:0] rx_cnt;
|
||||
|
||||
// always @(posedge clk_8x_in) begin
|
||||
// if (rst) begin
|
||||
// rx_cnt <= 'b0;
|
||||
// end
|
||||
// else begin
|
||||
// rx_cnt <= rx_cnt + 1'b1;
|
||||
// end
|
||||
// end
|
||||
|
||||
// always @(posedge clk_8x_in) begin
|
||||
// if (rst) begin
|
||||
// rx_frame_p <= 1'b0;
|
||||
// rx_frame_n <= 1'b1;
|
||||
// rx_data_p <= 6'b000000;
|
||||
// rx_data_n <= 6'b111111;
|
||||
// end
|
||||
// else begin
|
||||
// rx_data_p <= rx_data_p + 12'd1;
|
||||
// rx_data_n <= ~(rx_data_p + 12'd1);
|
||||
|
||||
// case (rx_cnt[2])
|
||||
// 1'b0: begin
|
||||
// rx_frame_p <= 1'b1;
|
||||
// rx_frame_n <= 1'b0;
|
||||
// end
|
||||
// 1'd1: begin
|
||||
// rx_frame_p <= 1'b0;
|
||||
// rx_frame_n <= 1'b1;
|
||||
// end
|
||||
// endcase
|
||||
// end
|
||||
// end
|
||||
|
||||
// endmodule
|
||||
@@ -0,0 +1,276 @@
|
||||
`timescale 1ns / 1ps
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Company:
|
||||
// Engineer:
|
||||
// _ _ ____
|
||||
// | | ___ ___| |__ / ___| __ _ ___
|
||||
// _ | |/ _ \/ __| '_ \ | | _ / _` |/ _ \
|
||||
// | |_| | (_) \__ \ | | | | |_| | (_| | (_) |
|
||||
// \___/ \___/|___/_| |_| \____|\__,_|\___/
|
||||
//
|
||||
// Create Date: 2022/07/01 16:39:19
|
||||
// Last Modified Date: 2023/03/06 11:45
|
||||
// Design Name:
|
||||
// Module Name: ad9361_tx_map_cmos_dual
|
||||
// Project Name:
|
||||
// Target Devices:
|
||||
// Tool Versions:
|
||||
// Description:
|
||||
//
|
||||
// Dependencies:
|
||||
//
|
||||
// Revision:
|
||||
// Revision 0.01 - File Created
|
||||
// Additional Comments:
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
module ad9361_tx_map_cmos_dual
|
||||
(
|
||||
input clk_2x_in ,
|
||||
input clk_in_rst ,
|
||||
|
||||
input tx_data_clk ,
|
||||
input tx_data_clk_rst ,
|
||||
|
||||
input [11:0] tx_ch1_i ,
|
||||
input [11:0] tx_ch1_q ,
|
||||
input [11:0] tx_ch2_i ,
|
||||
input [11:0] tx_ch2_q ,
|
||||
|
||||
output clk_out ,
|
||||
output tx_frame ,
|
||||
output [11:0] tx_data
|
||||
);
|
||||
|
||||
genvar m;
|
||||
|
||||
// input data fifo
|
||||
reg rx_fifo_rd_en = 'b0;
|
||||
wire [11:0] tx_fifo_ch1_i;
|
||||
wire [11:0] tx_fifo_ch1_q;
|
||||
wire [11:0] tx_fifo_ch2_i;
|
||||
wire [11:0] tx_fifo_ch2_q;
|
||||
|
||||
always @(posedge clk_2x_in) begin
|
||||
if (clk_in_rst) begin
|
||||
rx_fifo_rd_en <= 'b0;
|
||||
end
|
||||
else begin
|
||||
rx_fifo_rd_en <= ~rx_fifo_rd_en;
|
||||
end
|
||||
end
|
||||
|
||||
ad9361_fifo u_tx_fifo_ch1_i
|
||||
(
|
||||
.rst (clk_in_rst ), // input wire rst
|
||||
.wr_clk (tx_data_clk ), // input wire wr_clk
|
||||
.rd_clk (clk_2x_in ), // input wire rd_clk
|
||||
.din (tx_ch1_i ), // input wire [11 : 0] din
|
||||
.wr_en (1'b1 ), // input wire wr_en
|
||||
.rd_en (rx_fifo_rd_en ), // input wire rd_en
|
||||
.dout (tx_fifo_ch1_i ), // output wire [11 : 0] dout
|
||||
.full ( ), // output wire full
|
||||
.empty ( ) // output wire empty
|
||||
);
|
||||
|
||||
ad9361_fifo u_tx_fifo_ch1_q
|
||||
(
|
||||
.rst (clk_in_rst ), // input wire rst
|
||||
.wr_clk (tx_data_clk ), // input wire wr_clk
|
||||
.rd_clk (clk_2x_in ), // input wire rd_clk
|
||||
.din (tx_ch1_q ), // input wire [11 : 0] din
|
||||
.wr_en (1'b1 ), // input wire wr_en
|
||||
.rd_en (rx_fifo_rd_en ), // input wire rd_en
|
||||
.dout (tx_fifo_ch1_q ), // output wire [11 : 0] dout
|
||||
.full ( ), // output wire full
|
||||
.empty ( ) // output wire empty
|
||||
);
|
||||
|
||||
ad9361_fifo u_tx_fifo_ch2_i
|
||||
(
|
||||
.rst (clk_in_rst ), // input wire rst
|
||||
.wr_clk (tx_data_clk ), // input wire wr_clk
|
||||
.rd_clk (clk_2x_in ), // input wire rd_clk
|
||||
.din (tx_ch2_i ), // input wire [11 : 0] din
|
||||
.wr_en (1'b1 ), // input wire wr_en
|
||||
.rd_en (rx_fifo_rd_en ), // input wire rd_en
|
||||
.dout (tx_fifo_ch2_i ), // output wire [11 : 0] dout
|
||||
.full ( ), // output wire full
|
||||
.empty ( ) // output wire empty
|
||||
);
|
||||
|
||||
ad9361_fifo u_tx_fifo_ch2_q
|
||||
(
|
||||
.rst (clk_in_rst ), // input wire rst
|
||||
.wr_clk (tx_data_clk ), // input wire wr_clk
|
||||
.rd_clk (clk_2x_in ), // input wire rd_clk
|
||||
.din (tx_ch2_q ), // input wire [11 : 0] din
|
||||
.wr_en (1'b1 ), // input wire wr_en
|
||||
.rd_en (rx_fifo_rd_en ), // input wire rd_en
|
||||
.dout (tx_fifo_ch2_q ), // output wire [11 : 0] dout
|
||||
.full ( ), // output wire full
|
||||
.empty ( ) // output wire empty
|
||||
);
|
||||
|
||||
// frame and data control
|
||||
reg tx_frame_i = 'b0;
|
||||
reg tx_frame_q = 'b0;
|
||||
reg [11:0] tx_data_i = 'b0;
|
||||
reg [11:0] tx_data_q = 'b0;
|
||||
|
||||
always @(posedge clk_2x_in) begin
|
||||
if (clk_in_rst) begin
|
||||
tx_frame_i <= 'b0;
|
||||
tx_frame_q <= 'b0;
|
||||
tx_data_i <= 'b0;
|
||||
tx_data_q <= 'b0;
|
||||
end
|
||||
else if (rx_fifo_rd_en == 1'b0) begin
|
||||
tx_frame_i <= 1'b1;
|
||||
tx_frame_q <= 1'b1;
|
||||
tx_data_i <= tx_fifo_ch1_i;
|
||||
tx_data_q <= tx_fifo_ch1_q;
|
||||
end
|
||||
else begin
|
||||
tx_frame_i <= 1'b0;
|
||||
tx_frame_q <= 1'b0;
|
||||
tx_data_i <= tx_fifo_ch2_i;
|
||||
tx_data_q <= tx_fifo_ch2_q;
|
||||
end
|
||||
end
|
||||
|
||||
// output clock to port
|
||||
assign clk_out = clk_2x_in;
|
||||
|
||||
// output tx frame to port
|
||||
ODDR #(
|
||||
.DDR_CLK_EDGE ("SAME_EDGE" ),
|
||||
.INIT (1'b0 ),
|
||||
.SRTYPE ("ASYNC" )
|
||||
) u_tx_frame_oddr (
|
||||
.CE (1'b1 ),
|
||||
.R (1'b0 ),
|
||||
.S (1'b0 ),
|
||||
.C (clk_2x_in ),
|
||||
.D1 (tx_frame_i ),
|
||||
.D2 (tx_frame_q ),
|
||||
.Q (tx_frame )
|
||||
);
|
||||
|
||||
// output tx data to port
|
||||
generate
|
||||
for (m=0; m<12; m=m+1) begin: tx_data_oddr
|
||||
|
||||
ODDR #(
|
||||
.DDR_CLK_EDGE ("SAME_EDGE" ),
|
||||
.INIT (1'b0 ),
|
||||
.SRTYPE ("ASYNC" )
|
||||
) u_tx_data_oddr (
|
||||
.CE (1'b1 ),
|
||||
.R (1'b0 ),
|
||||
.S (1'b0 ),
|
||||
.C (clk_2x_in ),
|
||||
.D1 (tx_data_i[m] ),
|
||||
.D2 (tx_data_q[m] ),
|
||||
.Q (tx_data[m] )
|
||||
);
|
||||
|
||||
end
|
||||
endgenerate
|
||||
|
||||
endmodule
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Company:
|
||||
// Engineer:
|
||||
// _ _ ____
|
||||
// | | ___ ___| |__ / ___| __ _ ___
|
||||
// _ | |/ _ \/ __| '_ \ | | _ / _` |/ _ \
|
||||
// | |_| | (_) \__ \ | | | | |_| | (_| | (_) |
|
||||
// \___/ \___/|___/_| |_| \____|\__,_|\___/
|
||||
//
|
||||
// Create Date: 2023/02/25 14:56:59
|
||||
// Design Name:
|
||||
// Module Name: tb_ad9361_tx_map_cmos_dual
|
||||
// Project Name:
|
||||
// Target Devices:
|
||||
// Tool Versions:
|
||||
// Description:
|
||||
//
|
||||
// Dependencies:
|
||||
//
|
||||
// Revision:
|
||||
// Revision 0.01 - File Created
|
||||
// Additional Comments:
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// module tb_ad9361_tx_map_cmos_dual;
|
||||
|
||||
// reg tx_data_clk = 1'b1;
|
||||
// reg clk_2x_in = 1'b1;
|
||||
// reg rst = 1'b1;
|
||||
|
||||
// wire clk_in_rst, tx_data_clk_rst;
|
||||
|
||||
// assign clk_in_rst = rst;
|
||||
// assign tx_data_clk_rst = rst;
|
||||
|
||||
// reg [11:0] tx_ch1_i = 'b0;
|
||||
// reg [11:0] tx_ch1_q = 'b0;
|
||||
// reg [11:0] tx_ch2_i = 'b0;
|
||||
// reg [11:0] tx_ch2_q = 'b0;
|
||||
|
||||
// wire clk_out;
|
||||
// wire tx_frame;
|
||||
// wire tx_data;
|
||||
|
||||
// ad9361_tx_map_cmos_dual u_ad9361_tx_map_cmos_dual
|
||||
// (
|
||||
// .clk_2x_in (clk_2x_in ),
|
||||
// .clk_in_rst (clk_in_rst ),
|
||||
|
||||
// .tx_data_clk (tx_data_clk ),
|
||||
// .tx_data_clk_rst(tx_data_clk_rst),
|
||||
|
||||
// .tx_ch1_i (tx_ch1_i ),
|
||||
// .tx_ch1_q (tx_ch1_q ),
|
||||
// .tx_ch2_i (tx_ch2_i ),
|
||||
// .tx_ch2_q (tx_ch2_q ),
|
||||
|
||||
// .clk_out (clk_out ),
|
||||
// .tx_frame (tx_frame ),
|
||||
// .tx_data (tx_data )
|
||||
// );
|
||||
|
||||
// initial begin
|
||||
// #102 rst = 1'b0;
|
||||
// end
|
||||
|
||||
// always #5 clk_2x_in = ~clk_2x_in;
|
||||
// always begin
|
||||
// #3;
|
||||
// tx_data_clk = ~tx_data_clk;
|
||||
// #7;
|
||||
// end
|
||||
|
||||
// always @(posedge tx_data_clk) begin
|
||||
// if (tx_data_clk_rst) begin
|
||||
// tx_ch1_i <= 'b0;
|
||||
// tx_ch1_q <= 'b0;
|
||||
// tx_ch2_i <= 'b0;
|
||||
// tx_ch2_q <= 'b0;
|
||||
// end
|
||||
// else begin
|
||||
// tx_ch1_i <= tx_ch1_i + 12'd1;
|
||||
// tx_ch1_q <= tx_ch1_q + 12'd2;
|
||||
// tx_ch2_i <= tx_ch2_i + 12'd3;
|
||||
// tx_ch2_q <= tx_ch2_q + 12'd4;
|
||||
// end
|
||||
// end
|
||||
|
||||
// endmodule
|
||||
@@ -0,0 +1,197 @@
|
||||
`timescale 1ns / 1ps
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Company:
|
||||
// Engineer:
|
||||
// _ _ ____
|
||||
// | | ___ ___| |__ / ___| __ _ ___
|
||||
// _ | |/ _ \/ __| '_ \ | | _ / _` |/ _ \
|
||||
// | |_| | (_) \__ \ | | | | |_| | (_| | (_) |
|
||||
// \___/ \___/|___/_| |_| \____|\__,_|\___/
|
||||
//
|
||||
// Create Date: 2022/07/01 16:39:19
|
||||
// Design Name:
|
||||
// Module Name: ad9361_tx_mapping_single
|
||||
// Project Name:
|
||||
// Target Devices:
|
||||
// Tool Versions:
|
||||
// Description:
|
||||
//
|
||||
// Dependencies:
|
||||
//
|
||||
// Revision:
|
||||
// Revision 0.01 - File Created
|
||||
// Additional Comments:
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
module ad9361_tx_map_cmos_single
|
||||
(
|
||||
input clk_in ,
|
||||
input clk_in_rst ,
|
||||
|
||||
input tx_data_clk ,
|
||||
input tx_data_clk_rst ,
|
||||
|
||||
input [11:0] tx_data_i ,
|
||||
input [11:0] tx_data_q ,
|
||||
|
||||
output clk_out ,
|
||||
output tx_frame ,
|
||||
output [11:0] tx_data
|
||||
);
|
||||
|
||||
genvar m;
|
||||
|
||||
// inout data fifo
|
||||
wire [11:0] tx_fifo_i;
|
||||
wire [11:0] tx_fifo_q;
|
||||
|
||||
ad9361_fifo u_tx_fifo_i
|
||||
(
|
||||
.rst (clk_in_rst ), // input wire rst
|
||||
.wr_clk (tx_data_clk ), // input wire wr_clk
|
||||
.rd_clk (clk_in ), // input wire rd_clk
|
||||
.din (tx_data_i ), // input wire [11 : 0] din
|
||||
.wr_en (1'b1 ), // input wire wr_en
|
||||
.rd_en (1'b1 ), // input wire rd_en
|
||||
.dout (tx_fifo_i ), // output wire [11 : 0] dout
|
||||
.full ( ), // output wire full
|
||||
.empty ( ) // output wire empty
|
||||
);
|
||||
|
||||
ad9361_fifo u_tx_fifo_q
|
||||
(
|
||||
.rst (clk_in_rst ), // input wire rst
|
||||
.wr_clk (tx_data_clk ), // input wire wr_clk
|
||||
.rd_clk (clk_in ), // input wire rd_clk
|
||||
.din (tx_data_q ), // input wire [11 : 0] din
|
||||
.wr_en (1'b1 ), // input wire wr_en
|
||||
.rd_en (1'b1 ), // input wire rd_en
|
||||
.dout (tx_fifo_q ), // output wire [11 : 0] dout
|
||||
.full ( ), // output wire full
|
||||
.empty ( ) // output wire empty
|
||||
);
|
||||
|
||||
// frame and data control
|
||||
assign tx_frame_i = 1'b1;
|
||||
assign tx_frame_q = 1'b0;
|
||||
|
||||
// output clock to port
|
||||
assign clk_out = clk_in;
|
||||
|
||||
// output tx frame to port
|
||||
ODDR #(
|
||||
.DDR_CLK_EDGE ("SAME_EDGE" ),
|
||||
.INIT (1'b0 ),
|
||||
.SRTYPE ("ASYNC" )
|
||||
) u_tx_frame_oddr (
|
||||
.CE (1'b1 ),
|
||||
.R (1'b0 ),
|
||||
.S (1'b0 ),
|
||||
.C (clk_in ),
|
||||
.D1 (tx_frame_i ),
|
||||
.D2 (tx_frame_q ),
|
||||
.Q (tx_frame )
|
||||
);
|
||||
|
||||
// output tx data to port
|
||||
generate
|
||||
for (m=0; m<12; m=m+1) begin: tx_data_oddr
|
||||
|
||||
ODDR #(
|
||||
.DDR_CLK_EDGE ("SAME_EDGE" ),
|
||||
.INIT (1'b0 ),
|
||||
.SRTYPE ("ASYNC" )
|
||||
) u_tx_data_oddr (
|
||||
.CE (1'b1 ),
|
||||
.R (1'b0 ),
|
||||
.S (1'b0 ),
|
||||
.C (clk_in ),
|
||||
.D1 (tx_fifo_i[m] ),
|
||||
.D2 (tx_fifo_q[m] ),
|
||||
.Q (tx_data[m] )
|
||||
);
|
||||
|
||||
end
|
||||
endgenerate
|
||||
|
||||
endmodule
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Company:
|
||||
// Engineer:
|
||||
//
|
||||
// Create Date: 2023/02/25 14:56:59
|
||||
// Design Name:
|
||||
// Module Name: tb_ad9361_tx_map_cmos_single
|
||||
// Project Name:
|
||||
// Target Devices:
|
||||
// Tool Versions:
|
||||
// Description:
|
||||
//
|
||||
// Dependencies:
|
||||
//
|
||||
// Revision:
|
||||
// Revision 0.01 - File Created
|
||||
// Additional Comments:
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// module tb_ad9361_tx_map_cmos_single;
|
||||
|
||||
// reg clk_in = 1'b1;
|
||||
// reg tx_data_clk = 1'b1;
|
||||
// reg rst = 1'b1;
|
||||
|
||||
// wire clk_in_rst, tx_data_clk_rst;
|
||||
|
||||
// assign clk_in_rst = rst;
|
||||
// assign tx_data_clk_rst = rst;
|
||||
|
||||
// reg [11:0] tx_data_i = 'b0;
|
||||
// reg [11:0] tx_data_q = 'b0;
|
||||
|
||||
// wire clk_out;
|
||||
// wire tx_frame;
|
||||
// wire tx_data;
|
||||
|
||||
// ad9361_tx_map_cmos_single u_ad9361_tx_map_cmos_single
|
||||
// (
|
||||
// .clk_in (clk_in ),
|
||||
// .clk_in_rst (clk_in_rst ),
|
||||
|
||||
// .tx_data_clk (tx_data_clk ),
|
||||
// .tx_data_clk_rst (tx_data_clk_rst ),
|
||||
|
||||
// .tx_data_i (tx_data_i ),
|
||||
// .tx_data_q (tx_data_q ),
|
||||
|
||||
// .clk_out (clk_out ),
|
||||
// .tx_frame (tx_frame ),
|
||||
// .tx_data (tx_data )
|
||||
// );
|
||||
|
||||
// initial begin
|
||||
// #102 rst = 1'b0;
|
||||
// end
|
||||
|
||||
// always begin
|
||||
// #3 clk_in = ~clk_in;
|
||||
// #7 tx_data_clk = ~tx_data_clk;
|
||||
// end
|
||||
|
||||
// always @(posedge clk_in) begin
|
||||
// if (rst) begin
|
||||
// tx_data_i <= 'b0;
|
||||
// tx_data_q <= 'b0;
|
||||
// end
|
||||
// else begin
|
||||
// tx_data_i <= tx_data_i + 12'd1;
|
||||
// tx_data_q <= tx_data_q + 12'd2;
|
||||
// end
|
||||
// end
|
||||
|
||||
// endmodule
|
||||
@@ -0,0 +1,337 @@
|
||||
`timescale 1ns / 1ps
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Company:
|
||||
// Engineer:
|
||||
// _ _ ____
|
||||
// | | ___ ___| |__ / ___| __ _ ___
|
||||
// _ | |/ _ \/ __| '_ \ | | _ / _` |/ _ \
|
||||
// | |_| | (_) \__ \ | | | | |_| | (_| | (_) |
|
||||
// \___/ \___/|___/_| |_| \____|\__,_|\___/
|
||||
//
|
||||
// Create Date: 2023/03/05 23:21:27
|
||||
// Last Modified Date: 2023/03/06 11:01
|
||||
// Design Name:
|
||||
// Module Name: ad9361_tx_map_lvds_dual
|
||||
// Project Name:
|
||||
// Target Devices:
|
||||
// Tool Versions:
|
||||
// Description:
|
||||
//
|
||||
// Dependencies:
|
||||
//
|
||||
// Revision:
|
||||
// Revision 0.01 - File Created
|
||||
// Additional Comments:
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
module ad9361_tx_map_lvds_dual
|
||||
(
|
||||
input clk_4x_in ,
|
||||
input clk_in_rst ,
|
||||
|
||||
input tx_data_clk ,
|
||||
input tx_data_clk_rst ,
|
||||
|
||||
input [11:0] tx_ch1_i ,
|
||||
input [11:0] tx_ch1_q ,
|
||||
input [11:0] tx_ch2_i ,
|
||||
input [11:0] tx_ch2_q ,
|
||||
|
||||
output clk_out_p ,
|
||||
output clk_out_n ,
|
||||
output tx_frame_p ,
|
||||
output tx_frame_n ,
|
||||
output [ 5:0] tx_data_p ,
|
||||
output [ 5:0] tx_data_n
|
||||
);
|
||||
|
||||
genvar m;
|
||||
|
||||
// input data fifo
|
||||
reg [1:0] tx_control_cnt = 'b0;
|
||||
reg rx_fifo_rd_en = 'b0;
|
||||
wire [11:0] tx_fifo_ch1_i;
|
||||
wire [11:0] tx_fifo_ch1_q;
|
||||
wire [11:0] tx_fifo_ch2_i;
|
||||
wire [11:0] tx_fifo_ch2_q;
|
||||
|
||||
always @(posedge clk_4x_in) begin
|
||||
if (clk_in_rst) begin
|
||||
tx_control_cnt <= 'b0;
|
||||
end
|
||||
else begin
|
||||
tx_control_cnt <= tx_control_cnt + 1'b1;
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk_4x_in) begin
|
||||
if (clk_in_rst) begin
|
||||
rx_fifo_rd_en <= 'b0;
|
||||
end
|
||||
else if (tx_control_cnt == 2'd2) begin
|
||||
rx_fifo_rd_en <= 1'b1;
|
||||
end
|
||||
else begin
|
||||
rx_fifo_rd_en <= 'b0;
|
||||
end
|
||||
end
|
||||
|
||||
ad9361_fifo u_tx_fifo_ch1_i
|
||||
(
|
||||
.rst (clk_in_rst ), // input wire rst
|
||||
.wr_clk (tx_data_clk ), // input wire wr_clk
|
||||
.rd_clk (clk_4x_in ), // input wire rd_clk
|
||||
.din (tx_ch1_i ), // input wire [11 : 0] din
|
||||
.wr_en (1'b1 ), // input wire wr_en
|
||||
.rd_en (rx_fifo_rd_en ), // input wire rd_en
|
||||
.dout (tx_fifo_ch1_i ), // output wire [11 : 0] dout
|
||||
.full ( ), // output wire full
|
||||
.empty ( ) // output wire empty
|
||||
);
|
||||
|
||||
ad9361_fifo u_tx_fifo_ch1_q
|
||||
(
|
||||
.rst (clk_in_rst ), // input wire rst
|
||||
.wr_clk (tx_data_clk ), // input wire wr_clk
|
||||
.rd_clk (clk_4x_in ), // input wire rd_clk
|
||||
.din (tx_ch1_q ), // input wire [11 : 0] din
|
||||
.wr_en (1'b1 ), // input wire wr_en
|
||||
.rd_en (rx_fifo_rd_en ), // input wire rd_en
|
||||
.dout (tx_fifo_ch1_q ), // output wire [11 : 0] dout
|
||||
.full ( ), // output wire full
|
||||
.empty ( ) // output wire empty
|
||||
);
|
||||
|
||||
ad9361_fifo u_tx_fifo_ch2_i
|
||||
(
|
||||
.rst (clk_in_rst ), // input wire rst
|
||||
.wr_clk (tx_data_clk ), // input wire wr_clk
|
||||
.rd_clk (clk_4x_in ), // input wire rd_clk
|
||||
.din (tx_ch2_i ), // input wire [11 : 0] din
|
||||
.wr_en (1'b1 ), // input wire wr_en
|
||||
.rd_en (rx_fifo_rd_en ), // input wire rd_en
|
||||
.dout (tx_fifo_ch2_i ), // output wire [11 : 0] dout
|
||||
.full ( ), // output wire full
|
||||
.empty ( ) // output wire empty
|
||||
);
|
||||
|
||||
ad9361_fifo u_tx_fifo_ch2_q
|
||||
(
|
||||
.rst (clk_in_rst ), // input wire rst
|
||||
.wr_clk (tx_data_clk ), // input wire wr_clk
|
||||
.rd_clk (clk_4x_in ), // input wire rd_clk
|
||||
.din (tx_ch2_q ), // input wire [11 : 0] din
|
||||
.wr_en (1'b1 ), // input wire wr_en
|
||||
.rd_en (rx_fifo_rd_en ), // input wire rd_en
|
||||
.dout (tx_fifo_ch2_q ), // output wire [11 : 0] dout
|
||||
.full ( ), // output wire full
|
||||
.empty ( ) // output wire empty
|
||||
);
|
||||
|
||||
|
||||
// frame and data control
|
||||
reg tx_frame_r = 'b0; // rising edge data
|
||||
reg tx_frame_f = 'b0; // falling edge data
|
||||
reg [5:0] tx_data_r = 'b0;
|
||||
reg [5:0] tx_data_f = 'b0;
|
||||
|
||||
always @(posedge clk_4x_in) begin
|
||||
if (clk_in_rst) begin
|
||||
tx_frame_r <= 'b0;
|
||||
tx_frame_f <= 'b0;
|
||||
tx_data_r <= 'b0;
|
||||
tx_data_f <= 'b0;
|
||||
end
|
||||
else begin
|
||||
case (tx_control_cnt)
|
||||
2'd0: begin
|
||||
tx_frame_r <= 1'b1;
|
||||
tx_frame_f <= 1'b1;
|
||||
tx_data_r <= tx_fifo_ch1_i[11: 6];
|
||||
tx_data_f <= tx_fifo_ch1_q[11: 6];
|
||||
end
|
||||
2'd1: begin
|
||||
tx_frame_r <= 1'b1;
|
||||
tx_frame_f <= 1'b1;
|
||||
tx_data_r <= tx_fifo_ch1_i[5:0];
|
||||
tx_data_f <= tx_fifo_ch1_q[5:0];
|
||||
end
|
||||
2'd2: begin
|
||||
tx_frame_r <= 1'b0;
|
||||
tx_frame_f <= 1'b0;
|
||||
tx_data_r <= tx_fifo_ch2_i[11:6];
|
||||
tx_data_f <= tx_fifo_ch2_q[11:6];
|
||||
end
|
||||
2'd3: begin
|
||||
tx_frame_r <= 1'b0;
|
||||
tx_frame_f <= 1'b0;
|
||||
tx_data_r <= tx_fifo_ch2_i[5:0];
|
||||
tx_data_f <= tx_fifo_ch2_q[5:0];
|
||||
end
|
||||
default: begin
|
||||
tx_frame_r <= 'b0;
|
||||
tx_frame_f <= 'b0;
|
||||
tx_data_r <= 'b0;
|
||||
tx_data_f <= 'b0;
|
||||
end
|
||||
endcase
|
||||
end
|
||||
end
|
||||
|
||||
// output clock to port
|
||||
wire clk_out;
|
||||
assign clk_out = clk_4x_in;
|
||||
|
||||
OBUFDS u_obufds_clk_out
|
||||
(
|
||||
.I (clk_out ),
|
||||
.O (clk_out_p ),
|
||||
.OB (clk_out_n )
|
||||
);
|
||||
|
||||
// output tx frame to port
|
||||
ODDR #(
|
||||
.DDR_CLK_EDGE ("SAME_EDGE" ),
|
||||
.INIT (1'b0 ),
|
||||
.SRTYPE ("ASYNC" )
|
||||
) u_tx_frame_oddr (
|
||||
.CE (1'b1 ),
|
||||
.R (1'b0 ),
|
||||
.S (1'b0 ),
|
||||
.C (clk_4x_in ),
|
||||
.D1 (tx_frame_r ),
|
||||
.D2 (tx_frame_f ),
|
||||
.Q (tx_frame )
|
||||
);
|
||||
|
||||
OBUFDS u_obufds_tx_frame
|
||||
(
|
||||
.I (tx_frame ),
|
||||
.O (tx_frame_p ),
|
||||
.OB (tx_frame_n )
|
||||
);
|
||||
|
||||
// output tx data to port
|
||||
wire [5:0] tx_data;
|
||||
|
||||
generate
|
||||
for (m=0; m<6; m=m+1) begin: tx_data_oddr
|
||||
|
||||
ODDR #(
|
||||
.DDR_CLK_EDGE ("SAME_EDGE" ),
|
||||
.INIT (1'b0 ),
|
||||
.SRTYPE ("ASYNC" )
|
||||
) u_tx_data_oddr (
|
||||
.CE (1'b1 ),
|
||||
.R (1'b0 ),
|
||||
.S (1'b0 ),
|
||||
.C (clk_4x_in ),
|
||||
.D1 (tx_data_r[m] ),
|
||||
.D2 (tx_data_f[m] ),
|
||||
.Q (tx_data[m] )
|
||||
);
|
||||
|
||||
OBUFDS u_obufds_tx_data
|
||||
(
|
||||
.I (tx_data[m] ),
|
||||
.O (tx_data_p[m] ),
|
||||
.OB (tx_data_n[m] )
|
||||
);
|
||||
|
||||
end
|
||||
endgenerate
|
||||
|
||||
endmodule
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Company:
|
||||
// Engineer:
|
||||
//
|
||||
// Create Date: 2023/02/25 14:56:59
|
||||
// Design Name:
|
||||
// Module Name: tb_ad9361_tx_map_lvds_dual
|
||||
// Project Name:
|
||||
// Target Devices:
|
||||
// Tool Versions:
|
||||
// Description:
|
||||
//
|
||||
// Dependencies:
|
||||
//
|
||||
// Revision:
|
||||
// Revision 0.01 - File Created
|
||||
// Additional Comments:
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// module tb_ad9361_tx_map_lvds_dual;
|
||||
|
||||
// reg tx_data_clk = 1'b1;
|
||||
// reg clk_4x_in = 1'b1;
|
||||
// reg rst = 1'b1;
|
||||
|
||||
// wire clk_in_rst, tx_data_clk_rst;
|
||||
|
||||
// assign clk_in_rst = rst;
|
||||
// assign tx_data_clk_rst = rst;
|
||||
|
||||
// reg [11:0] tx_ch1_i = 'b0;
|
||||
// reg [11:0] tx_ch1_q = 'b0;
|
||||
// reg [11:0] tx_ch2_i = 'b0;
|
||||
// reg [11:0] tx_ch2_q = 'b0;
|
||||
|
||||
// wire clk_out_p, clk_out_n;
|
||||
// wire tx_frame_p, tx_frame_n;
|
||||
// wire [5:0] tx_data_p, tx_data_n;
|
||||
|
||||
// ad9361_tx_map_lvds_dual u_ad9361_tx_map_lvds_dual
|
||||
// (
|
||||
// .clk_4x_in (clk_4x_in ), // input clk_4x_in
|
||||
// .clk_in_rst (clk_in_rst ), // input clk_in_rst
|
||||
|
||||
// .tx_data_clk (tx_data_clk ), // input tx_data_clk
|
||||
// .tx_data_clk_rst (tx_data_clk_rst ), // input tx_data_clk_rst
|
||||
|
||||
// .tx_ch1_i (tx_ch1_i ), // input [11:0] tx_ch1_i
|
||||
// .tx_ch1_q (tx_ch1_q ), // input [11:0] tx_ch1_q
|
||||
// .tx_ch2_i (tx_ch2_i ), // input [11:0] tx_ch2_i
|
||||
// .tx_ch2_q (tx_ch2_q ), // input [11:0] tx_ch2_q
|
||||
|
||||
// .clk_out_p (clk_out_p ), // output clk_out_p
|
||||
// .clk_out_n (clk_out_n ), // output clk_out_n
|
||||
// .tx_frame_p (tx_frame_p ), // output tx_frame_p
|
||||
// .tx_frame_n (tx_frame_n ), // output tx_frame_n
|
||||
// .tx_data_p (tx_data_p ), // output [ 5:0] tx_data_p
|
||||
// .tx_data_n (tx_data_n ) // output [ 5:0] tx_data_n
|
||||
// );
|
||||
|
||||
// initial begin
|
||||
// #102 rst = 1'b0;
|
||||
// end
|
||||
|
||||
// always #5 clk_4x_in = ~clk_4x_in;
|
||||
// always begin
|
||||
// #13;
|
||||
// tx_data_clk = ~tx_data_clk;
|
||||
// #7;
|
||||
// end
|
||||
|
||||
// always @(posedge tx_data_clk) begin
|
||||
// if (tx_data_clk_rst) begin
|
||||
// tx_ch1_i <= 'b0;
|
||||
// tx_ch1_q <= 'b0;
|
||||
// tx_ch2_i <= 'b0;
|
||||
// tx_ch2_q <= 'b0;
|
||||
// end
|
||||
// else begin
|
||||
// tx_ch1_i <= tx_ch1_i + 12'd1;
|
||||
// tx_ch1_q <= tx_ch1_q + 12'd2;
|
||||
// tx_ch2_i <= tx_ch2_i + 12'd3;
|
||||
// tx_ch2_q <= tx_ch2_q + 12'd4;
|
||||
// end
|
||||
// end
|
||||
|
||||
// endmodule
|
||||
Reference in New Issue
Block a user