Files
eb001/src/main/verilog/backBoardMstTop.v

158 lines
2.8 KiB
Coq
Raw Normal View History

2023-08-21 21:14:43 +08:00
////////////////////////
//LVDS-BUS SYSTEM DEMO//
////////////////////////
module master_top(
input resetn,
input clock,
input lvds_up_din_p,
input lvds_up_din_n,
output lvds_down_dout_p,
output lvds_down_dout_n,
2023-12-07 11:10:43 +08:00
2024-01-08 18:01:29 +08:00
input [15:0] io_FSMC_dataIn,
output [15:0] io_FSMC_dataOut,
output io_FSMC_dataOEn,
input io_FSMC_ce,
input io_FSMC_oe,
input io_FSMC_we,
input io_FSMC_adv,
2023-12-07 11:10:43 +08:00
output cdrErr ,
output crcErr ,
2024-01-08 18:01:29 +08:00
output linkErr
2023-08-21 21:14:43 +08:00
);
wire clk_400m;
2023-09-14 19:16:17 +08:00
wire clk_400m_a;
2023-08-21 21:14:43 +08:00
wire clk_100m;
2023-09-14 19:16:17 +08:00
wire clk_100m_a;
2023-08-21 21:14:43 +08:00
wire clk_50m;
wire clk_50m_a;
2023-09-14 19:16:17 +08:00
wire clk_10m_a;
2023-08-21 21:14:43 +08:00
reg rst_n;
wire lvds_down_dout;
wire lvds_up_din;
reg rstn_d;
2023-09-14 19:16:17 +08:00
wire reset_calib;
wire lock_o;
wire reset_stop;
2023-08-21 21:14:43 +08:00
2023-09-15 15:36:44 +08:00
always@(posedge clk_10m_a) begin
2023-09-12 17:51:32 +08:00
rstn_d <= resetn;
2023-08-21 21:14:43 +08:00
rst_n <= rstn_d;
end
2023-08-22 15:32:01 +08:00
Gowin_PLLO Gowin_PLLO(
2023-09-14 19:16:17 +08:00
.lock(lock_o),
2023-08-22 15:32:01 +08:00
.clkouta(clk_400m),
.clkin(clock)
2023-08-21 21:14:43 +08:00
);
TLVDS_OBUF lvds_downstream_out(
.O(lvds_down_dout_p),
.OB(lvds_down_dout_n),
.I(lvds_down_dout)
);
TLVDS_IBUF lvds_upstream_in(
.O(lvds_up_din),
.I(lvds_up_din_p),
.IB(lvds_up_din_n)
);
2023-09-14 19:16:17 +08:00
DHCEN dhcen_inst (
.CLKIN(clk_400m),
.CE(reset_stop),
.CLKOUT(clk_400m_a)
);
//reset sync module, all the IDES/OSER and related CLKDIV MUST be reset by this module
oser_rst u_oser_rst(
.clk_in(clock), // or any other speed comparble with fabric, DO NOT use HCLK as fabric cannot work at so high speed.
.rst_n(rst_n),
.pll_lock(lock_o), // trigged by PLL Lock
.reset_stop(reset_stop), // for DHCEN CE
.reset_calib(reset_calib), // for IDES and CLKDIV reset
.set_calib(),
.ready()
);
defparam Inst4_CLKDIVC.DIV_MODE="4";
defparam Inst4_CLKDIVC.GSREN="false";
CLKDIV Inst4_CLKDIVC(
.RESETN (~reset_calib),
.HCLKIN (clk_400m_a),
.CALIB (1'b0 ),
.CLKOUT (clk_100m_a)
);
defparam Inst2_CLKDIVC.DIV_MODE="2";
defparam Inst2_CLKDIVC.GSREN="false";
CLKDIV Inst2_CLKDIVC(
.RESETN (~reset_calib),
.HCLKIN (clk_100m_a),
.CALIB (1'b0 ),
.CLKOUT (clk_50m_a)
);
defparam Inst5_CLKDIVC.DIV_MODE="5";
defparam Inst5_CLKDIVC.GSREN="false";
2023-08-21 21:14:43 +08:00
CLKDIV Inst5_CLKDIVC(
2023-09-14 19:16:17 +08:00
.RESETN (~reset_calib),
.HCLKIN (clk_50m_a),
2023-08-21 21:14:43 +08:00
.CALIB (1'b0 ),
2023-09-14 19:16:17 +08:00
.CLKOUT (clk_10m_a)
2023-08-21 21:14:43 +08:00
);
2023-09-14 19:16:17 +08:00
2023-08-21 21:14:43 +08:00
BackBoardMst i_BackBoardMst(
2024-01-08 18:01:29 +08:00
.io_FSMC_dataIn(io_FSMC_dataIn),
.io_FSMC_dataOut(io_FSMC_dataOut),
.io_FSMC_dataOEn(io_FSMC_dataOEn),
.io_FSMC_ce(io_FSMC_ce),
.io_FSMC_oe(io_FSMC_oe),
.io_FSMC_we(io_FSMC_we),
.io_FSMC_adv(io_FSMC_adv),
2023-08-21 21:14:43 +08:00
2023-09-14 19:16:17 +08:00
.reset(~rst_n),
.clock(clk_10m_a),
.io_reset_calib(reset_calib),
.io_oser_pclk(clk_10m_a),
.io_oser_fclk(clk_50m_a),
.io_ides_pclk(clk_100m_a),
.io_ides_fclk(clk_400m_a),
2023-08-21 21:14:43 +08:00
.io_lvds_down_dout(lvds_down_dout),
2023-12-07 11:10:43 +08:00
.io_lvds_up_din(lvds_up_din),
.io_cdrErr (cdrErr),
.io_crcErr (crcErr),
2024-01-08 18:01:29 +08:00
.io_linkErr(linkErr)
2023-08-21 21:14:43 +08:00
);
2023-08-22 15:32:01 +08:00
endmodule