feat(top): add mac layer control, half tested
This commit is contained in:
+129
-93
@@ -108,7 +108,21 @@ module system_top (
|
||||
|
||||
// tx signal
|
||||
wire frame_sync_pulse;
|
||||
wire rx_rst;
|
||||
wire tx_done;
|
||||
wire intr_2ps_vio;
|
||||
reg intr_2ps_vio_d1;
|
||||
wire intr_2ps_vio_pos;
|
||||
|
||||
wire tx_start_vio;
|
||||
reg tx_start_vio_d1;
|
||||
wire tx_start_vio_pos;
|
||||
|
||||
// vio
|
||||
wire rst_manual;
|
||||
wire [ 7:0] node_id;
|
||||
wire intr_2ps;
|
||||
wire [ 7:0] max_slot_num;
|
||||
|
||||
// ******** Assingment ********
|
||||
|
||||
@@ -197,76 +211,101 @@ module system_top (
|
||||
);
|
||||
|
||||
|
||||
// tdma #(
|
||||
// .SLOT_LEN (750000), // 50MHz--> 15ms
|
||||
// .TIC_TO_PS_LEN (700000),
|
||||
// .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 (
|
||||
.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),
|
||||
.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)
|
||||
);
|
||||
|
||||
|
||||
// ---- PHY layer logic start
|
||||
|
||||
// enc_control u_enc_control (
|
||||
// .clk (clk_poweron),
|
||||
// .rst (rst_sys | phy_rst_ps),
|
||||
// .s_axis_fifo_tvalid (tx_data_src_tvalid),
|
||||
// .s_axis_fifo_tready (tx_data_src_tready),
|
||||
// .s_axis_fifo_tdata (tx_data_src_tdata),
|
||||
// .data_src_count (tx_data_src_count),
|
||||
// .fifo_enc_out_rd_clk (clk_1x),
|
||||
// .fifo_enc_out_rd_en (enc_fifo_rd_en),
|
||||
// .fifo_enc_out_dout_map(enc_fifo_dout_map),
|
||||
// .fifo_enc_out_empty (enc_fifo_empty)
|
||||
// );
|
||||
|
||||
|
||||
// tdma #(
|
||||
// .SLOT_LEN (1250000), // 50MHz--> 25ms
|
||||
// .TIC_TO_PS_LEN (1200000),
|
||||
// .TIC_FRAME_SYNC(42272)
|
||||
// ) u_tdma (
|
||||
// .clk (clk_1x),
|
||||
// .rst (rst_sys),
|
||||
// .flag_is_master (1'b0),
|
||||
// .flag_frame_sync(frame_sync_pulse),
|
||||
// .intr_2ps (intr_2ps),
|
||||
// .tx_start (tx_start)
|
||||
// );
|
||||
|
||||
|
||||
// Transmitter u_Transmitter (
|
||||
// .clk (clk_1x),
|
||||
// .rst (rst_sys | phy_rst | phy_rst_vio),
|
||||
// .speed_mode (speed_mode),
|
||||
// .send_data_ready (send_data_ready),
|
||||
// .send_start (send_start),
|
||||
// .send_over (send_over),
|
||||
// .clk_data_src (clk_data_src),
|
||||
// .tx_data_src_tdata (enc_fifo_dout_map),
|
||||
// .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),
|
||||
// .test (tx_test_flag | phy_tx_test_flag_vio),
|
||||
// .hop_wait (100)
|
||||
// );
|
||||
|
||||
// Receiver u_Receiver (
|
||||
// .clk (clk_1x),
|
||||
// .clk_2x (clk_2x),
|
||||
// .clk_4x (clk_4x),
|
||||
// .rst (rst_sys | phy_rst | phy_rst_vio),
|
||||
// .speed_mode (speed_mode),
|
||||
// .ad9361_rx_data_i(ad9361_rx_data_i),
|
||||
// .ad9361_rx_data_q(ad9361_rx_data_q),
|
||||
// .frame_sync_pulse(frame_sync_pulse)
|
||||
// );
|
||||
|
||||
ad9361_mgc_pin_ctrl u_ad9361_mgc_pin_ctrl (
|
||||
.clk (clk_1x),
|
||||
.rst (rst_sys | phy_rst),
|
||||
.rx_data_i (ad9361_rx_data_i),
|
||||
.rx_data_q (ad9361_rx_data_q),
|
||||
.ad9361_ctrl_in(ad9361_ctrl_in)
|
||||
enc_control u_enc_control (
|
||||
.clk (clk_poweron),
|
||||
.rst (rst_sys | phy_rst_ps),
|
||||
.s_axis_fifo_tvalid (tx_data_src_tvalid),
|
||||
.s_axis_fifo_tready (tx_data_src_tready),
|
||||
.s_axis_fifo_tdata (tx_data_src_tdata),
|
||||
.data_src_count (tx_data_src_count),
|
||||
.fifo_enc_out_rd_clk (clk_1x),
|
||||
.fifo_enc_out_rd_en (enc_fifo_rd_en),
|
||||
.fifo_enc_out_dout_map(enc_fifo_dout_map),
|
||||
.fifo_enc_out_empty (enc_fifo_empty)
|
||||
);
|
||||
|
||||
|
||||
Transmitter u_Transmitter (
|
||||
.clk (clk_1x),
|
||||
.rst (rst_sys | phy_rst),
|
||||
.speed_mode (2),
|
||||
.send_data_ready (send_data_ready),
|
||||
.send_start (tx_start),
|
||||
.send_over (tx_done),
|
||||
.clk_data_src (clk_data_src),
|
||||
.tx_data_src_tdata (enc_fifo_dout_map),
|
||||
.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),
|
||||
.test (tx_test_flag | phy_tx_test_flag_vio),
|
||||
.hop_wait (100)
|
||||
);
|
||||
|
||||
RecvTop u_RecvTop (
|
||||
.clk (clk_1x),
|
||||
.clk_2x (clk_2x),
|
||||
.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),
|
||||
.ad9361_ctrl_in (ad9361_ctrl_in),
|
||||
.frame_sync_pulse (frame_sync_pulse),
|
||||
.vio_tsync_inter16(1),
|
||||
.EQUenable_vio (1),
|
||||
.Zerozone_vio (8'd29),
|
||||
.vio_stopbit (7'd60),
|
||||
.flag_stop (flag_stop),
|
||||
.addr_stop (addr_stop),
|
||||
.recvNetData (recvNetData),
|
||||
.recvNetDataNd (recvNetDataNd)
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -318,41 +357,38 @@ module system_top (
|
||||
|
||||
// ******** Debug ********
|
||||
|
||||
ila_ad9361_rx u_ila_ad9361_rx (
|
||||
.clk (ad9361_rx_clk),
|
||||
.probe0(ad9361_rx_data_i),
|
||||
.probe1(ad9361_rx_data_q),
|
||||
.probe2(u_ad9361_mgc_pin_ctrl.flag_adjust)
|
||||
);
|
||||
// ila_ad9361_rx u_ila_ad9361_rx (
|
||||
// .clk (ad9361_rx_clk),
|
||||
// .probe0(ad9361_rx_data_i),
|
||||
// .probe1(ad9361_rx_data_q),
|
||||
// .probe2(u_ad9361_mgc_pin_ctrl.flag_adjust)
|
||||
// );
|
||||
|
||||
ila_ad9361_tx u_ila_ad9361_tx (
|
||||
.clk (ad9361_tx_clk), // input wire clk
|
||||
.probe0(ad9361_tx_data_i), // input wire [11:0] probe0
|
||||
.probe1(ad9361_tx_data_q) // input wire [11:0] probe1
|
||||
);
|
||||
// ila_ad9361_tx u_ila_ad9361_tx (
|
||||
// .clk (ad9361_tx_clk), // input wire clk
|
||||
// .probe0(ad9361_tx_data_i), // input wire [11:0] probe0
|
||||
// .probe1(ad9361_tx_data_q) // input wire [11:0] probe1
|
||||
// );
|
||||
|
||||
|
||||
assign tx_start_vio_pos = tx_start_vio & ~tx_start_vio_d1;
|
||||
always @(posedge clk_1x) begin
|
||||
tx_start_vio_d1 <= tx_start_vio;
|
||||
end
|
||||
|
||||
assign intr_2ps_vio_pos = intr_2ps_vio & ~intr_2ps_vio_d1;
|
||||
always @(posedge clk_1x) begin
|
||||
intr_2ps_vio_d1 <= intr_2ps_vio;
|
||||
end
|
||||
|
||||
vio_phy_control u_vio_phy_control (
|
||||
.clk (clk_1x), // input wire clk
|
||||
.probe_out0(phy_rst_vio), // output wire [0 : 0] probe_out0
|
||||
.probe_out1(phy_tx_test_flag_vio), // output wire [0 : 0] probe_out1
|
||||
.probe_out2(send_start) // output wire [0 : 0] probe_out2
|
||||
.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]
|
||||
);
|
||||
|
||||
|
||||
vio_gpio u_vio_gpio (
|
||||
.clk (clk_poweron),
|
||||
.probe_out0(rf_gpio),
|
||||
.probe_out1(led_red),
|
||||
.probe_out2(led_yellow),
|
||||
.probe_out3(led_blue)
|
||||
);
|
||||
|
||||
vio_tx_speed_mode u_vio_tx_speed_mode (
|
||||
.clk (clk_1x),
|
||||
.probe_out0(speed_mode)
|
||||
);
|
||||
|
||||
|
||||
|
||||
endmodule
|
||||
|
||||
Reference in New Issue
Block a user