fix(top): reverse iq in recv
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
set_property MAX_FANOUT 512 [get_nets *u_RecvTop/mag*]
|
||||
# set_property MAX_FANOUT 512 [get_nets u_Receiver/mag_valid]
|
||||
# set_false_path -through [get_nets u_Receiver/rst]
|
||||
set_false_path -through [get_nets u_RecvTop/SR[0]]
|
||||
# set_false_path -through [get_nets u_RecvTop/SR[0]]
|
||||
+1
-18
@@ -64,11 +64,6 @@ module PAPR #(
|
||||
// accumulate ==> average ==> papr
|
||||
wire [MAG_WIDTH-1:0] vec_mag_1024;
|
||||
reg [ 5:0] cnt;
|
||||
// shift_1024 shift_1024 (
|
||||
// .D (vec_mag), // input wire [21 : 0] D
|
||||
// .CLK(clk), // input wire CLK
|
||||
// .Q (vec_mag_1024) // output wire [21 : 0] Q
|
||||
// );
|
||||
|
||||
shift_reg #(
|
||||
.DATA_WIDTH(MAG_WIDTH),
|
||||
@@ -144,22 +139,10 @@ module PAPR #(
|
||||
end
|
||||
|
||||
|
||||
// ******** Wire & Reg ********
|
||||
|
||||
// ******** Assingment ********
|
||||
|
||||
// ******** Logic Block ********
|
||||
|
||||
// ******** Inst ********
|
||||
|
||||
// ******** Debug ********
|
||||
|
||||
// NOTE: comment
|
||||
|
||||
ila_frame_sync u_ila_frame_sync (
|
||||
.clk (clk), // input wire clk
|
||||
.probe0(vec_mag), // input wire [21:0] probe0
|
||||
.probe1(mag_valid), // input wire [0:0] probe1
|
||||
.probe1(data_avg), // input wire [21:0] probe0
|
||||
.probe2(frame_sync) // input wire [0:0] probe2
|
||||
);
|
||||
|
||||
|
||||
+36
-22
@@ -29,6 +29,7 @@ module RecvTop (
|
||||
input [11:0] dinq,
|
||||
// mgc control
|
||||
output [ 3:0] ad9361_ctrl_in,
|
||||
output wire flag_mgc_done_pulse, // active high pulse signal
|
||||
output wire frame_sync_pulse, // in domain clk
|
||||
//vio
|
||||
input vio_tsync_inter16, //为1的时候启用内插,从16倍过采样中挑一路
|
||||
@@ -47,7 +48,7 @@ module RecvTop (
|
||||
wire rst_freq;
|
||||
wire DAGC_rdy;
|
||||
wire framesync; //帧同步峰
|
||||
wire framesync_delay; //帧同步峰,与频率补偿输出对应
|
||||
wire flag_cfo_done; //帧同步峰,与频率补偿输出对应
|
||||
wire framesync_tsync; //帧同步标志,与TSync输出对应
|
||||
wire IntpARdy; //TSync输出nd
|
||||
wire nd_SC_FDE_dout; //SC_FDE输出nd
|
||||
@@ -139,6 +140,7 @@ module RecvTop (
|
||||
.rx_data_i (dini),
|
||||
.rx_data_q (dinq),
|
||||
.ad9361_ctrl_in (ad9361_ctrl_in),
|
||||
.flag_mgc_done_pulse(flag_mgc_done_pulse),
|
||||
.flag_mgc_done (flag_mgc_done)
|
||||
);
|
||||
|
||||
@@ -256,6 +258,7 @@ module RecvTop (
|
||||
.m_axis_data_tdata (dmf_tdata_interp4_q)
|
||||
);
|
||||
|
||||
wire [7:0] cnt_chu_seq_sync_max_vio;
|
||||
localparam CNT_CHU_SEQ_SYNC_MAX = 40; //! should not less than 3 due to the minimum rst of aresetn
|
||||
|
||||
wire [21:0] mag;
|
||||
@@ -266,7 +269,7 @@ module RecvTop (
|
||||
wire rst_frame_sync; // derive from frame sync pulse
|
||||
reg [ 7:0] cnt_chu_seq_sync; // frame sync delay to chu seq sample start pos
|
||||
|
||||
assign rst_frame_sync = ((cnt_chu_seq_sync >= 1) && (cnt_chu_seq_sync < CNT_CHU_SEQ_SYNC_MAX));
|
||||
assign rst_frame_sync = ((cnt_chu_seq_sync >= 1) && (cnt_chu_seq_sync < cnt_chu_seq_sync_max_vio));
|
||||
|
||||
//* calc the magnitude
|
||||
MagnitudeEstimator #(
|
||||
@@ -298,7 +301,7 @@ module RecvTop (
|
||||
cnt_chu_seq_sync <= 1;
|
||||
end
|
||||
// avoid the tailing of the convolution (here we use CNT_CHU_SEQ_SYNC_MAX clocks)
|
||||
else if (cnt_chu_seq_sync >= 1 && cnt_chu_seq_sync < CNT_CHU_SEQ_SYNC_MAX) begin
|
||||
else if (cnt_chu_seq_sync >= 1 && cnt_chu_seq_sync < cnt_chu_seq_sync_max_vio) begin
|
||||
cnt_chu_seq_sync <= cnt_chu_seq_sync + 1;
|
||||
end
|
||||
else begin
|
||||
@@ -310,7 +313,7 @@ module RecvTop (
|
||||
if (rst) begin
|
||||
flag_frame_sync <= 0;
|
||||
end
|
||||
else if (cnt_chu_seq_sync == CNT_CHU_SEQ_SYNC_MAX) begin
|
||||
else if (cnt_chu_seq_sync == cnt_chu_seq_sync_max_vio) begin
|
||||
flag_frame_sync <= 1;
|
||||
end
|
||||
else begin
|
||||
@@ -380,7 +383,7 @@ module RecvTop (
|
||||
.datain_q (DAGC_out_q),
|
||||
.dataout_i (freqdataout_i),
|
||||
.dataout_q (freqdataout_q),
|
||||
.framesync_delay(framesync_delay),
|
||||
.framesync_delay(flag_cfo_done),
|
||||
.data_save (data_save),
|
||||
.rst_freq (rst_freq)
|
||||
);
|
||||
@@ -396,7 +399,7 @@ module RecvTop (
|
||||
.douti (IntpOuti),
|
||||
.doutq (IntpOutq),
|
||||
.vio_tsync_inter16(vio_tsync_inter16),
|
||||
.framesync (framesync_delay), //帧同步标志
|
||||
.framesync (flag_cfo_done), //帧同步标志
|
||||
.framesync_tsync (framesync_tsync), //帧同步标志
|
||||
//debug
|
||||
.cnt_tsync (cnt_tsync),
|
||||
@@ -536,24 +539,35 @@ module RecvTop (
|
||||
|
||||
// ***** debug *****
|
||||
|
||||
vio_recv_top u_vio_recv_top (
|
||||
.clk (clk),
|
||||
.probe_out0(cnt_chu_seq_sync_max_vio)
|
||||
);
|
||||
|
||||
ila_recv_top u_ila_recv_top (
|
||||
.clk (clk),
|
||||
.probe0 (flag_mgc_done), // width: 1
|
||||
.probe1 (flag_frame_sync), // width: 1
|
||||
.probe2 (mf_data_interp4_q), // width: 32
|
||||
.probe3 (mf_data_interp4_i), // width: 32
|
||||
.probe4 (freqestm.freq_out), // width: 14
|
||||
.probe5 (freqdataout_i), // width: 10
|
||||
.probe6 (freqdataout_q), // width: 10
|
||||
.probe7 (nd_SC_FDE_dout), // width: 1
|
||||
.probe8 (SC_FDE_douti), // width: 10
|
||||
.probe9 (SC_FDE_doutq), // width: 10
|
||||
.probe10(LDPC_SyncOut), // width: 1
|
||||
.probe11(LDPC_Rdy), // width: 1
|
||||
.probe12(LDPC_Dout), // width: 1
|
||||
.probe13(bad_frames), // width: 9
|
||||
.probe14(total_frames), // width: 9
|
||||
.probe15(mgc_start) // width: 1
|
||||
.probe0 (dini), // width: 12
|
||||
.probe1 (dinq), // width: 12
|
||||
.probe2 (mf_data_interp4_i[29-:12]), // width: 12
|
||||
.probe3 (mf_data_interp4_q[29-:12]), // width: 12
|
||||
.probe4 (flag_mgc_done), // width: 1
|
||||
.probe5 (flag_frame_sync), // width: 1
|
||||
.probe6 (flag_cfo_done), // width: 1
|
||||
.probe7 (freqdataout_i), // width: 10
|
||||
.probe8 (freqdataout_q), // width: 10
|
||||
.probe9 (IntpARdy), // width: 1
|
||||
.probe10(IntpOuti), // width: 10
|
||||
.probe11(IntpOutq), // width: 10
|
||||
.probe12(nd_SC_FDE_dout), // width: 1
|
||||
.probe13(SC_FDE_douti), // width: 10
|
||||
.probe14(SC_FDE_doutq), // width: 10
|
||||
.probe15(phase_adjust_rdy), // width: 1
|
||||
.probe16(phase_adjust_douti), // width: 10
|
||||
.probe17(phase_adjust_doutq), // width: 10
|
||||
.probe18(LDPC_Rdy), // width: 1
|
||||
.probe19(LDPC_Dout), // width: 1
|
||||
.probe20(good_frames), // width: 9
|
||||
.probe21(bad_frames) // width: 9
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ module ad9361_mgc_pin_ctrl (
|
||||
input [11:0] rx_data_q,
|
||||
// this port is from zynq to ad9361
|
||||
output wire [ 3:0] ad9361_ctrl_in,
|
||||
output wire flag_mgc_done_pulse, // active high pulse signal
|
||||
output reg flag_mgc_done = 0 // active high level signal
|
||||
|
||||
);
|
||||
@@ -62,6 +63,7 @@ module ad9361_mgc_pin_ctrl (
|
||||
assign dec_pulse = (cs == S_DEC);
|
||||
|
||||
assign start_posedge = start & ~start_d1;
|
||||
assign flag_mgc_done_pulse = power_measure_done_pulse;
|
||||
|
||||
// ******** Logic Block ********
|
||||
|
||||
|
||||
+14
-16
@@ -75,7 +75,7 @@ module net_city (
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (rst) begin
|
||||
rx_rst <= 1;
|
||||
rx_rst <= 0;
|
||||
end
|
||||
else if (tx_start) begin
|
||||
rx_rst <= 1;
|
||||
@@ -211,31 +211,29 @@ module net_city (
|
||||
end
|
||||
|
||||
8'd50: begin
|
||||
if (recv_net_data_nd) begin
|
||||
if (recv_net_data[23:00] == 24'h7e5a33) begin
|
||||
// if (recv_net_data_nd) begin
|
||||
// if (recv_net_data[23:00] == 24'h7e5a33) begin
|
||||
state_net <= 8'd51;
|
||||
is_net <= 1'b1;
|
||||
|
||||
cnt_trans_slot <= cnt_trans_slot + 32'd1;
|
||||
cnt_inter_slot <= cnt_inter_slot + 32'd1;
|
||||
|
||||
recv_id <= recv_net_data[63:56];
|
||||
recv_video_id01 <= recv_net_data[55:48];
|
||||
recv_video_id02 <= recv_net_data[47:40];
|
||||
recv_video_id03 <= recv_net_data[39:32];
|
||||
recv_connect_node <= recv_net_data[31:24];
|
||||
end
|
||||
else begin
|
||||
state_net <= 8'd200;
|
||||
is_net <= 1'b0;
|
||||
// end
|
||||
// else begin
|
||||
// state_net <= 8'd200;
|
||||
// is_net <= 1'b0;
|
||||
|
||||
cnt_trans_slot <= cnt_inter_slot + 32'd1;
|
||||
end
|
||||
end
|
||||
else begin
|
||||
cnt_trans_slot <= cnt_trans_slot + 32'd1;
|
||||
cnt_inter_slot <= cnt_inter_slot + 32'd1;
|
||||
end
|
||||
// cnt_trans_slot <= cnt_inter_slot + 32'd1;
|
||||
// end
|
||||
// end
|
||||
// else begin
|
||||
// cnt_trans_slot <= cnt_trans_slot + 32'd1;
|
||||
// cnt_inter_slot <= cnt_inter_slot + 32'd1;
|
||||
// end
|
||||
end
|
||||
8'd51: begin
|
||||
state_net <= 8'd200;
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ module power_measure (
|
||||
);
|
||||
|
||||
localparam CNT_WAIT_9361_MAX = 80; //* 等待周期数
|
||||
localparam CNT_MEASURING_MAX = 512; // * 观察64个周期
|
||||
localparam CNT_MEASURING_MAX = 256; // * 观察64个周期
|
||||
localparam CNT_ADJUST_TIMES_MAX = 25;
|
||||
localparam CNT_AMP_TOO_HIGH_THRESHOLD = 6;
|
||||
// ******** Wire & Reg ********
|
||||
|
||||
+61
-44
@@ -89,6 +89,7 @@ module system_top (
|
||||
wire tx_data_src_tvalid;
|
||||
// tx signal
|
||||
wire tx_test_flag;
|
||||
wire flag_mgc_done_pulse;
|
||||
|
||||
// baseband signal
|
||||
wire [11:0] ad9361_rx_data_i;
|
||||
@@ -98,6 +99,13 @@ module system_top (
|
||||
wire [11:0] ad9361_tx_data_i;
|
||||
wire [11:0] ad9361_tx_data_q;
|
||||
wire [ 2:0] speed_mode;
|
||||
// mux
|
||||
wire bb_tx_iq_reverse;
|
||||
wire bb_rx_iq_reverse;
|
||||
wire [11:0] bb_tx_i;
|
||||
wire [11:0] bb_tx_q;
|
||||
wire [11:0] bb_rx_i;
|
||||
wire [11:0] bb_rx_q;
|
||||
|
||||
// phy control signal
|
||||
wire phy_rst_vio;
|
||||
@@ -135,6 +143,11 @@ module system_top (
|
||||
assign ad9361_txnrx = gpio_o[3]; // ad9361 txnrx
|
||||
|
||||
|
||||
assign ad9361_tx_data_i = bb_tx_iq_reverse ? bb_tx_q : bb_tx_i;
|
||||
assign ad9361_tx_data_q = bb_tx_iq_reverse ? bb_tx_i : bb_tx_q;
|
||||
assign bb_rx_i = bb_rx_iq_reverse ? ad9361_rx_data_q : ad9361_rx_data_i;
|
||||
assign bb_rx_q = bb_rx_iq_reverse ? ad9361_rx_data_i : ad9361_rx_data_q;
|
||||
|
||||
// ******** Logic Block ********
|
||||
|
||||
// ******** Inst ********
|
||||
@@ -196,7 +209,7 @@ module system_top (
|
||||
.gpio_t (gpio_t),
|
||||
// intr pl to ps
|
||||
.pl2ps_intr2 (intr_2ps),
|
||||
.pl2ps_intr3 (pl2ps_intr3),
|
||||
.pl2ps_intr3 (flag_mgc_done_pulse),
|
||||
// tx fifo
|
||||
.tx_data_src_count (tx_data_src_count),
|
||||
.tx_data_src_tdata (tx_data_src_tdata),
|
||||
@@ -211,44 +224,47 @@ module system_top (
|
||||
);
|
||||
|
||||
|
||||
// tdma #(
|
||||
// .SLOT_LEN (750000), // 50MHz--> 15ms
|
||||
// .TIC_TO_PS_LEN (700000),
|
||||
tdma #(
|
||||
.SLOT_LEN (750000), // 50MHz--> 15ms
|
||||
.TIC_TO_PS_LEN (700000),
|
||||
.TIC_FRAME_SYNC(42344)
|
||||
// .SLOT_LEN (625001), // 50MHz--> 15ms
|
||||
// .TIC_TO_PS_LEN (575000),
|
||||
// .TIC_FRAME_SYNC(42344)
|
||||
// ) u_tdma (
|
||||
// .clk (clk_1x),
|
||||
// .rst (rst_sys),
|
||||
// .flag_is_master (0),
|
||||
// .flag_frame_sync(frame_sync_pulse),
|
||||
// .intr_2ps (intr_2ps),
|
||||
// .tx_start (tx_start),
|
||||
// .rx_rst (rx_rst)
|
||||
// );
|
||||
|
||||
net_city u_net_city (
|
||||
) u_tdma (
|
||||
.clk (clk_1x),
|
||||
.rst_initial (rst_sys),
|
||||
.rst_manual (rst_manual),
|
||||
.rst (rst_sys),
|
||||
.flag_is_master (flag_is_master),
|
||||
.flag_frame_sync(frame_sync_pulse),
|
||||
.intr_2ps (intr_2ps),
|
||||
.tx_start (tx_start),
|
||||
.trans_net_data (),
|
||||
.flag_video_send (),
|
||||
.recv_id (),
|
||||
.frame_sync (frame_sync_pulse),
|
||||
.recv_net_data_nd(1),
|
||||
.recv_net_data (0),
|
||||
.frame_sync_time (42344),
|
||||
.id_num (node_id),
|
||||
.max_slot_num (max_slot_num),
|
||||
.video_id01 (0),
|
||||
.video_id02 (0),
|
||||
.video_id03 (0),
|
||||
.is_net (),
|
||||
.flag_to_uc (),
|
||||
.intr_ps (intr_2ps),
|
||||
.rx_rst (rx_rst),
|
||||
.tx_done (tx_done)
|
||||
.rx_rst (rx_rst)
|
||||
);
|
||||
|
||||
// net_city u_net_city (
|
||||
// .clk (clk_1x),
|
||||
// .rst_initial (rst_sys),
|
||||
// .rst_manual (rst_manual),
|
||||
// .tx_start (tx_start),
|
||||
// .trans_net_data (),
|
||||
// .flag_video_send (),
|
||||
// .recv_id (),
|
||||
// .frame_sync (frame_sync_pulse),
|
||||
// .recv_net_data_nd(1'b1),
|
||||
// .recv_net_data (64'd0),
|
||||
// .frame_sync_time (42344),
|
||||
// .id_num (node_id),
|
||||
// .max_slot_num (max_slot_num),
|
||||
// .video_id01 (0),
|
||||
// .video_id02 (0),
|
||||
// .video_id03 (0),
|
||||
// .is_net (),
|
||||
// .flag_to_uc (),
|
||||
// .intr_ps (intr_2ps),
|
||||
// .rx_rst (rx_rst),
|
||||
// .tx_done (tx_done)
|
||||
// );
|
||||
|
||||
|
||||
// ---- PHY layer logic start
|
||||
|
||||
@@ -278,8 +294,8 @@ module system_top (
|
||||
.tx_data_src_tready(enc_fifo_rd_en),
|
||||
.tx_data_src_tvalid(~enc_fifo_empty),
|
||||
.hopping_freq (),
|
||||
.ad9361_tx_data_i (ad9361_tx_data_i),
|
||||
.ad9361_tx_data_q (ad9361_tx_data_q),
|
||||
.ad9361_tx_data_i (bb_tx_i),
|
||||
.ad9361_tx_data_q (bb_tx_q),
|
||||
.test (tx_test_flag | phy_tx_test_flag_vio),
|
||||
.hop_wait (100)
|
||||
);
|
||||
@@ -290,9 +306,10 @@ module system_top (
|
||||
.clk_4x (clk_4x),
|
||||
.rst (rst_sys | rx_rst | phy_rst),
|
||||
.rst2 (rst_sys | phy_rst),
|
||||
.dini (ad9361_rx_data_i),
|
||||
.dinq (ad9361_rx_data_q),
|
||||
.dini (bb_rx_i),
|
||||
.dinq (bb_rx_q),
|
||||
.ad9361_ctrl_in (ad9361_ctrl_in),
|
||||
.flag_mgc_done_pulse(flag_mgc_done_pulse),
|
||||
.frame_sync_pulse (frame_sync_pulse),
|
||||
.vio_tsync_inter16 (1),
|
||||
.EQUenable_vio (1),
|
||||
@@ -361,7 +378,7 @@ module system_top (
|
||||
// .clk (ad9361_rx_clk),
|
||||
// .probe0(ad9361_rx_data_i),
|
||||
// .probe1(ad9361_rx_data_q),
|
||||
// .probe2(u_ad9361_mgc_pin_ctrl.flag_adjust)
|
||||
// .probe2(u_RecvTop.flag_mgc_done)
|
||||
// );
|
||||
|
||||
// ila_ad9361_tx u_ila_ad9361_tx (
|
||||
@@ -381,13 +398,13 @@ module system_top (
|
||||
intr_2ps_vio_d1 <= intr_2ps_vio;
|
||||
end
|
||||
|
||||
|
||||
|
||||
vio_phy_control u_vio_phy_control (
|
||||
.clk (clk_1x), // input wire clk
|
||||
.probe_out0(rst_manual), // output wire [0 : 0]
|
||||
.probe_out1(node_id), // output wire [7 : 0]
|
||||
.probe_out2(max_slot_num), // output wire [7 : 0]
|
||||
.probe_out3(intr_2ps_vio), // output wire [0 : 0]
|
||||
.probe_out4(tx_start_vio) // output wire [0 : 0]
|
||||
.probe_out0(flag_is_master), // output wire [0 : 0]
|
||||
.probe_out1(bb_tx_iq_reverse), // output wire [0 : 0]
|
||||
.probe_out2(bb_rx_iq_reverse) // output wire [0 : 0]
|
||||
);
|
||||
|
||||
|
||||
|
||||
+45
-17
@@ -14,29 +14,36 @@
|
||||
// ! PLEASE MAKE SURE THE PARAMETER ARE VALID
|
||||
// ! WHEN U INSTANTIATE THIS MODULE
|
||||
module tdma #(
|
||||
parameter SLOT_LEN = 1250000,
|
||||
parameter TIC_TO_PS_LEN = 1200000,
|
||||
parameter TIC_FRAME_SYNC = 42272
|
||||
parameter SLOT_LEN = 750000,
|
||||
parameter TIC_TO_PS_LEN = 700000,
|
||||
parameter TIC_FRAME_SYNC = 42344
|
||||
) (
|
||||
input clk,
|
||||
input rst,
|
||||
input flag_is_master, // TODO: refactor it to parameters
|
||||
input flag_frame_sync,
|
||||
output intr_2ps,
|
||||
(* KEEP = "TRUE" *) output tx_start,
|
||||
(* KEEP = "TRUE" *) output rx_rst
|
||||
output tx_start,
|
||||
output reg rx_rst
|
||||
);
|
||||
|
||||
// TODO: 需要检查综合后电路是否会被优化
|
||||
// BUG: 需要修复bug,重构代码,把主从分开写,通过参数进行优化
|
||||
|
||||
// ******** Wire & Reg ********
|
||||
|
||||
reg flag_is_tx_slot;
|
||||
reg [23:0] cnt;
|
||||
|
||||
// ******** Assingment ********
|
||||
|
||||
assign tx_start = flag_is_master & (cnt == 16'd10);
|
||||
assign intr_2ps = flag_is_master & (cnt == TIC_TO_PS_LEN - 1);
|
||||
|
||||
// ******** Logic Block ********
|
||||
|
||||
|
||||
reg [23:0] cnt;
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (rst) begin
|
||||
cnt <= 0;
|
||||
@@ -48,7 +55,7 @@ module tdma #(
|
||||
end
|
||||
else begin
|
||||
// master
|
||||
if (cnt < SLOT_LEN) begin
|
||||
if (cnt < SLOT_LEN - 1) begin
|
||||
cnt <= cnt + 1;
|
||||
end
|
||||
else begin
|
||||
@@ -57,26 +64,47 @@ module tdma #(
|
||||
end
|
||||
end
|
||||
end
|
||||
assign tx_start = flag_is_tx_slot & (cnt == 16'd10);
|
||||
assign rx_rst = flag_is_tx_slot | (~flag_is_tx_slot & (cnt <= 16'd10));
|
||||
assign intr_2ps = ~flag_is_tx_slot & (cnt == TIC_TO_PS_LEN);
|
||||
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (rst) begin
|
||||
flag_is_tx_slot <= 0;
|
||||
if (flag_is_master) begin
|
||||
rx_rst <= 1;
|
||||
end
|
||||
else if (!flag_is_master && flag_frame_sync) begin
|
||||
flag_is_tx_slot <= 0;
|
||||
end
|
||||
else if (cnt == 16'd1) begin
|
||||
flag_is_tx_slot <= ~flag_is_tx_slot;
|
||||
else begin
|
||||
rx_rst <= flag_is_master | (cnt <= 16'd4);
|
||||
end
|
||||
end
|
||||
|
||||
// always @(posedge clk) begin
|
||||
// if (rst) begin
|
||||
// flag_is_tx_slot <= 0;
|
||||
// end
|
||||
// else if (!flag_is_master && flag_frame_sync) begin
|
||||
// flag_is_tx_slot <= 0;
|
||||
// end
|
||||
// else if (cnt == 16'd1) begin
|
||||
// flag_is_tx_slot <= ~flag_is_tx_slot;
|
||||
// end
|
||||
// end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ******** Inst ********
|
||||
|
||||
// ******** Debug ********
|
||||
|
||||
|
||||
ila_mac_layer u_ila_mac_layer (
|
||||
.clk (clk),
|
||||
.probe0(cnt), // width: 24
|
||||
.probe1(tx_start), // width: 1
|
||||
.probe2(rx_rst), // width: 1
|
||||
.probe3(flag_is_master), // width: 1
|
||||
.probe4(intr_2ps), // width: 1
|
||||
.probe5(flag_frame_sync) // width: 1
|
||||
);
|
||||
|
||||
|
||||
endmodule
|
||||
|
||||
+10
-45
@@ -22,60 +22,25 @@
|
||||
|
||||
module tb_tdma ();
|
||||
|
||||
|
||||
|
||||
reg clk = 1;
|
||||
reg clk_tx = 1;
|
||||
reg rst = 1;
|
||||
always #1 clk <= ~clk;
|
||||
initial begin
|
||||
#1000 rst <= 1'b0;
|
||||
#10 rst <= 1'b0;
|
||||
end
|
||||
|
||||
wire flag_frame_sync_m;
|
||||
reg flag_frame_sync_s = 0;
|
||||
wire intr_2ps_m;
|
||||
wire intr_2ps_s;
|
||||
wire tic_hop_m;
|
||||
wire tic_hop_s;
|
||||
wire tx_start_m;
|
||||
wire tx_start_s;
|
||||
|
||||
assign flag_frame_sync_m = 1'b0;
|
||||
|
||||
tdma #(
|
||||
.SLOT_LEN (1250000),
|
||||
.TIC_TO_PS_LEN (1200000),
|
||||
.TIC_FRAME_SYNC(42272)
|
||||
) u_tdma_master (
|
||||
.SLOT_LEN (625000), // 50MHz--> 15ms
|
||||
.TIC_TO_PS_LEN (575000),
|
||||
.TIC_FRAME_SYNC(42344)
|
||||
) u_tdma (
|
||||
.clk (clk),
|
||||
.rst (rst),
|
||||
.flag_is_master (1'b1),
|
||||
.flag_frame_sync(flag_frame_sync_m),
|
||||
.intr_2ps (intr_2ps_m),
|
||||
// .tic_hop (tic_hop_m),
|
||||
.tx_start (tx_start_m)
|
||||
.flag_is_master (1),
|
||||
.flag_frame_sync(0),
|
||||
.intr_2ps (intr_2ps),
|
||||
.tx_start (tx_start),
|
||||
.rx_rst (rx_rst)
|
||||
);
|
||||
|
||||
|
||||
tdma #(
|
||||
.SLOT_LEN (20000),
|
||||
.TIC_TO_PS_LEN (18000),
|
||||
.TIC_FRAME_SYNC(2000)
|
||||
) u_tdma_slave (
|
||||
.clk (clk),
|
||||
.rst (rst),
|
||||
.flag_is_master (1'b0),
|
||||
.flag_frame_sync(flag_frame_sync_s),
|
||||
.intr_2ps (intr_2ps_s),
|
||||
// .tic_hop (tic_hop_s),
|
||||
.tx_start (tx_start_s)
|
||||
);
|
||||
|
||||
|
||||
initial begin
|
||||
#12000 flag_frame_sync_s <= 1'b1;
|
||||
#3 flag_frame_sync_s <= 1'b0;
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
# this is a demo create ip using tcl script
|
||||
|
||||
# create a new ip ila named ila_rx2, if the ip already exists, skip create_ip step
|
||||
create_ip -name ila -vendor xilinx.com -library ip -version 6.2 -module_name ila_tdma
|
||||
# set the ip property
|
||||
set_property -dict [list \
|
||||
CONFIG.C_EN_STRG_QUAL {1} \
|
||||
CONFIG.C_NUM_OF_PROBES {22} \
|
||||
CONFIG.C_PROBE0_WIDTH {12} \
|
||||
CONFIG.C_PROBE1_WIDTH {12} \
|
||||
CONFIG.C_PROBE2_WIDTH {12} \
|
||||
CONFIG.C_PROBE3_WIDTH {12} \
|
||||
CONFIG.C_PROBE4_WIDTH {1} \
|
||||
CONFIG.C_PROBE5_WIDTH {1} \
|
||||
CONFIG.C_PROBE6_WIDTH {1} \
|
||||
CONFIG.C_PROBE7_WIDTH {10} \
|
||||
CONFIG.C_PROBE8_WIDTH {10} \
|
||||
CONFIG.C_PROBE9_WIDTH {1} \
|
||||
CONFIG.C_PROBE10_WIDTH {10} \
|
||||
CONFIG.C_PROBE11_WIDTH {10} \
|
||||
CONFIG.C_PROBE12_WIDTH {1} \
|
||||
CONFIG.C_PROBE13_WIDTH {10} \
|
||||
CONFIG.C_PROBE14_WIDTH {10} \
|
||||
CONFIG.C_PROBE15_WIDTH {1} \
|
||||
CONFIG.C_PROBE16_WIDTH {10} \
|
||||
CONFIG.C_PROBE17_WIDTH {10} \
|
||||
CONFIG.C_PROBE18_WIDTH {1} \
|
||||
CONFIG.C_PROBE19_WIDTH {1} \
|
||||
CONFIG.C_PROBE20_WIDTH {9} \
|
||||
CONFIG.C_PROBE21_WIDTH {9} \
|
||||
|
||||
] [get_ips ila_recv_top]
|
||||
|
||||
|
||||
set_property -dict [list \
|
||||
CONFIG.C_NUM_OF_PROBES {6} \
|
||||
CONFIG.C_PROBE0_WIDTH {24} \
|
||||
] [get_ips ila_tdma]
|
||||
Reference in New Issue
Block a user