You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
353 lines
12 KiB
353 lines
12 KiB
`include "config.v"
|
|
`timescale 1ns / 1ns
|
|
module Top (
|
|
input sys_clk,
|
|
input rst_n,
|
|
|
|
/*******************************************************************************
|
|
* genlock *
|
|
*******************************************************************************/
|
|
input genlock_in_hsync,
|
|
input genlock_in_vsync,
|
|
input genlock_in_fsync,
|
|
output genlock_in_state_led,
|
|
|
|
/*******************************************************************************
|
|
* GENLOCK_OUTPUT *
|
|
*******************************************************************************/
|
|
|
|
output [9:0] genlock_out_dac,
|
|
output genlock_out_dac_clk,
|
|
output genlock_out_dac_state_led,
|
|
|
|
/*******************************************************************************
|
|
* TTL_IN *
|
|
*******************************************************************************/
|
|
|
|
input sync_ttl_in1,
|
|
output sync_ttl_in1_state_led,
|
|
|
|
input sync_ttl_in2,
|
|
output sync_ttl_in2_state_led,
|
|
|
|
input sync_ttl_in3,
|
|
output sync_ttl_in3_state_led,
|
|
|
|
input sync_ttl_in4,
|
|
output sync_ttl_in4_state_led,
|
|
|
|
|
|
/*******************************************************************************
|
|
* TTL_OUT *
|
|
*******************************************************************************/
|
|
|
|
output sync_ttl_out1,
|
|
output sync_ttl_out1_state_led,
|
|
|
|
output sync_ttl_out2,
|
|
output sync_ttl_out2_state_led,
|
|
|
|
output sync_ttl_out3,
|
|
output sync_ttl_out3_state_led,
|
|
|
|
output sync_ttl_out4,
|
|
output sync_ttl_out4_state_led,
|
|
|
|
/*******************************************************************************
|
|
* TIMECODE_IN *
|
|
*******************************************************************************/
|
|
input timecode_headphone_in,
|
|
output timecode_headphone_in_state_led,
|
|
input timecode_bnc_in,
|
|
output timecode_bnc_in_state_led,
|
|
|
|
/*******************************************************************************
|
|
* TIMECODE_OUTPUT *
|
|
*******************************************************************************/
|
|
|
|
output timecode_out_bnc,
|
|
output timecode_out_bnc_select,
|
|
output timecode_out_bnc_state_led,
|
|
|
|
output timecode_out_headphone,
|
|
output timecode_out_headphone_select,
|
|
output timecode_out_headphone_state_led,
|
|
|
|
/*******************************************************************************
|
|
* STM32_IF *
|
|
*******************************************************************************/
|
|
output stm32if_camera_sync_out,
|
|
output stm32if_timecode_sync_out,
|
|
output stm32if_start_signal_out,
|
|
output [3:0] stm32if_timecode_add,
|
|
output [3:0] stm32if_timecode_data,
|
|
|
|
//SPI 串行总线1
|
|
input wire spi1_cs_pin,
|
|
input wire spi1_clk_pin,
|
|
input wire spi1_rx_pin,
|
|
output wire spi1_tx_pin,
|
|
|
|
//SPI 串行总线2
|
|
input wire spi2_cs_pin,
|
|
input wire spi2_clk_pin,
|
|
input wire spi2_rx_pin,
|
|
output wire spi2_tx_pin,
|
|
|
|
/*******************************************************************************
|
|
* debug_signal_output *
|
|
*******************************************************************************/
|
|
output [15:0] debug_signal_output,
|
|
|
|
/*******************************************************************************
|
|
* CODE_BOARD *
|
|
*******************************************************************************/
|
|
output wire core_board_debug_led
|
|
);
|
|
|
|
localparam HARDWARE_TEST_MODE = 1;
|
|
|
|
SPLL spll (
|
|
.clkin1(sys_clk), // input
|
|
.pll_lock(pll_lock), // output
|
|
.clkout0(sys_clk_25m), // output
|
|
.clkout1(sys_clk_10m), // output
|
|
.clkout2(sys_clk_5m) // output
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
* 调试器 *
|
|
*******************************************************************************/
|
|
// wire [6:0] trig0_i;
|
|
// JtagHubIst jtag_hub_ist (
|
|
// .resetn_i(rst_n), // input
|
|
// .drck_o (drck_o), // output
|
|
// .hub_tdi (hub_tdi), // output
|
|
// .capt_o (capt_o), // output
|
|
// .shift_o (shift_o), // output
|
|
// .conf_sel(conf_sel), // output [14:0]
|
|
// .id_o (id_o), // output [4:0]
|
|
// .hub_tdo (hub_tdo) // input [14:0]
|
|
// );
|
|
|
|
// DebugCoreIst debug_core_ist (
|
|
// .hub_tdi (hub_tdi), // input
|
|
// .hub_tdo (hub_tdo[0]), // output
|
|
// .id_i (id_o), // input [4:0]
|
|
// .capt_i (capt_o), // input
|
|
// .shift_i (shift_o), // input
|
|
// .conf_sel(conf_sel[0]), // input
|
|
// .drck_in (drck_o), // input
|
|
// .clk (sys_clk), // input
|
|
// .resetn_i(rst_n), // input
|
|
// .trig0_i (trig0_i)
|
|
// );
|
|
|
|
|
|
/*******************************************************************************
|
|
* DEBUG_LED *
|
|
*******************************************************************************/
|
|
// zutils_debug_led #(
|
|
// .PERIOD_COUNT(10000000)
|
|
// ) core_board_debug_led_inst (
|
|
// .clk(sys_clk),
|
|
// .rst_n(rst_n),
|
|
// .debug_led(core_board_debug_led)
|
|
// );
|
|
|
|
/*******************************************************************************
|
|
* SPIREADER *
|
|
*******************************************************************************/
|
|
|
|
wire [31:0] reg_reader_bus_addr;
|
|
wire [31:0] reg_reader_bus_wr_data;
|
|
wire reg_reader_bus_wr_en;
|
|
wire [31:0] reg_reader_bus_rd_data;
|
|
spi_reg_reader spi_reg_reader_inst (
|
|
.clk (sys_clk),
|
|
.rst_n(rst_n),
|
|
|
|
.addr(reg_reader_bus_addr),
|
|
.wr_data(reg_reader_bus_wr_data),
|
|
.wr_en(reg_reader_bus_wr_en),
|
|
.rd_data(reg_reader_bus_rd_data),
|
|
//
|
|
.spi_cs_pin(spi2_cs_pin),
|
|
.spi_clk_pin(spi2_clk_pin),
|
|
.spi_rx_pin(spi2_rx_pin),
|
|
.spi_tx_pin(spi2_tx_pin)
|
|
);
|
|
|
|
wire [31:0] stm32_rd_data;
|
|
wire [31:0] fpga_test_rd_data;
|
|
wire [31:0] control_sensor_rd_data;
|
|
wire [31:0] ttlin1_rd_data;
|
|
wire [31:0] ttlin2_rd_data;
|
|
wire [31:0] ttlin3_rd_data;
|
|
wire [31:0] ttlin4_rd_data;
|
|
wire [31:0] timecode_in_rd_data;
|
|
wire [31:0] genlock_in_rd_data;
|
|
wire [31:0] ttlout1_rd_data;
|
|
wire [31:0] ttlout2_rd_data;
|
|
wire [31:0] ttlout3_rd_data;
|
|
wire [31:0] ttlout4_rd_data;
|
|
wire [31:0] timecode_out_rd_data;
|
|
wire [31:0] genlock_out_rd_data;
|
|
wire [31:0] stm32_if_rd_data;
|
|
wire [31:0] debuger_rd_data;
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
* TEST_SPI_REG *
|
|
*******************************************************************************/
|
|
zutils_register16 #(
|
|
.REG_START_ADD(`REG_ADD_OFF_FPGA_TEST),
|
|
.REG0_INIT(31'h0000_0000),
|
|
.REG1_INIT(31'h1111_1111),
|
|
.REG2_INIT(31'h2222_2222),
|
|
.REG3_INIT(31'h3333_3333),
|
|
.REG4_INIT(31'h4444_4444),
|
|
.REG5_INIT(31'h5555_5555),
|
|
.REG6_INIT(31'h6666_6666),
|
|
.REG7_INIT(31'h7777_7777),
|
|
.REG8_INIT(31'h8888_8888),
|
|
.REG9_INIT(31'h9999_9999),
|
|
.REGA_INIT(31'haaaa_aaaa),
|
|
.REGB_INIT(31'hbbbb_bbbb),
|
|
.REGC_INIT(31'hcccc_cccc),
|
|
.REGD_INIT(31'hdddd_dddd),
|
|
.REGE_INIT(31'heeee_eeee),
|
|
.REGF_INIT(31'hffff_ffff)
|
|
) test_reg (
|
|
.clk(sys_clk),
|
|
.rst_n(rst_n),
|
|
.addr(reg_reader_bus_addr),
|
|
.wr_data(reg_reader_bus_wr_data),
|
|
.wr_en(reg_reader_bus_wr_en),
|
|
.rd_data(fpga_test_rd_data)
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
* 输出组件 *
|
|
*******************************************************************************/
|
|
|
|
wire [7:0] ttl_output_signal_in;
|
|
|
|
// ttl_output #(
|
|
// .REG_START_ADD(`REG_ADD_OFF_TTLIN1),
|
|
// .TEST(HARDWARE_TEST_MODE),
|
|
// .ID(1)
|
|
// ) ttl_output_1 (
|
|
// .clk (sys_clk),
|
|
// .rst_n(rst_n),
|
|
|
|
// .addr(reg_reader_bus_addr),
|
|
// .wr_data(reg_reader_bus_wr_data),
|
|
// .wr_en(reg_reader_bus_wr_en),
|
|
// .rd_data(ttlout1_rd_data),
|
|
|
|
// .signal_in(ttl_output_signal_in),
|
|
|
|
// .ttloutput(sync_ttl_out1),
|
|
// .ttloutput_state_led(sync_ttl_out1_state_led)
|
|
// );
|
|
|
|
// ttl_output #(
|
|
// .REG_START_ADD(`REG_ADD_OFF_TTLIN2),
|
|
// .TEST(HARDWARE_TEST_MODE),
|
|
// .ID(2)
|
|
// ) ttl_output_2 (
|
|
// .clk (sys_clk),
|
|
// .rst_n(rst_n),
|
|
|
|
// .addr(reg_reader_bus_addr),
|
|
// .wr_data(reg_reader_bus_wr_data),
|
|
// .wr_en(reg_reader_bus_wr_en),
|
|
// .rd_data(ttlout2_rd_data),
|
|
|
|
// .signal_in(ttl_output_signal_in),
|
|
|
|
// .ttloutput(sync_ttl_out2),
|
|
// .ttloutput_state_led(sync_ttl_out2_state_led)
|
|
// );
|
|
|
|
// ttl_output #(
|
|
// .REG_START_ADD(`REG_ADD_OFF_TTLIN3),
|
|
// .TEST(HARDWARE_TEST_MODE),
|
|
// .ID(3)
|
|
// ) ttl_output_3 (
|
|
// .clk (sys_clk),
|
|
// .rst_n(rst_n),
|
|
|
|
// .addr(reg_reader_bus_addr),
|
|
// .wr_data(reg_reader_bus_wr_data),
|
|
// .wr_en(reg_reader_bus_wr_en),
|
|
// .rd_data(ttlout3_rd_data),
|
|
|
|
// .signal_in(ttl_output_signal_in),
|
|
|
|
// .ttloutput(sync_ttl_out3),
|
|
// .ttloutput_state_led(sync_ttl_out3_state_led)
|
|
// );
|
|
|
|
// ttl_output #(
|
|
// .REG_START_ADD(`REG_ADD_OFF_TTLIN4),
|
|
// .TEST(HARDWARE_TEST_MODE),
|
|
// .ID(4)
|
|
// ) ttl_output_4 (
|
|
// .clk (sys_clk),
|
|
// .rst_n(rst_n),
|
|
|
|
// .addr(reg_reader_bus_addr),
|
|
// .wr_data(reg_reader_bus_wr_data),
|
|
// .wr_en(reg_reader_bus_wr_en),
|
|
// .rd_data(ttlout4_rd_data),
|
|
|
|
// .signal_in(ttl_output_signal_in),
|
|
|
|
// .ttloutput(sync_ttl_out4),
|
|
// .ttloutput_state_led(sync_ttl_out4_state_led)
|
|
// );
|
|
|
|
|
|
// rd_data_router rd_data_router_inst (
|
|
// .addr(reg_reader_bus_addr),
|
|
|
|
// .stm32_rd_data(stm32_rd_data),
|
|
// .fpga_test_rd_data(fpga_test_rd_data),
|
|
// .control_sensor_rd_data(control_sensor_rd_data),
|
|
// .ttlin1_rd_data(ttlin1_rd_data),
|
|
// .ttlin2_rd_data(ttlin2_rd_data),
|
|
// .ttlin3_rd_data(ttlin3_rd_data),
|
|
// .ttlin4_rd_data(ttlin4_rd_data),
|
|
// .timecode_in_rd_data(timecode_in_rd_data),
|
|
// .genlock_in_rd_data(genlock_in_rd_data),
|
|
|
|
// .ttlout1_rd_data(ttlout1_rd_data), // ok
|
|
// .ttlout2_rd_data(ttlout2_rd_data), // ok
|
|
// .ttlout3_rd_data(ttlout3_rd_data), // ok
|
|
// .ttlout4_rd_data(ttlout4_rd_data), // ok
|
|
|
|
// .timecode_out_rd_data(timecode_out_rd_data),
|
|
// .genlock_out_rd_data(genlock_out_rd_data),
|
|
// .stm32_if_rd_data(stm32_if_rd_data),
|
|
// .debuger_rd_data(debuger_rd_data),
|
|
|
|
// .rd_data_out(reg_reader_bus_rd_data)
|
|
// );
|
|
assign reg_reader_bus_rd_data[31:0] = fpga_test_rd_data[31:0];
|
|
|
|
assign debug_signal_output[0] = spi2_cs_pin;
|
|
assign debug_signal_output[1] = spi2_clk_pin;
|
|
assign debug_signal_output[2] = spi2_rx_pin;
|
|
assign debug_signal_output[3] = spi2_tx_pin;
|
|
assign core_board_debug_led = 1;
|
|
|
|
|
|
|
|
endmodule
|