From: Martin Jerabek Date: Mon, 16 May 2016 17:25:07 +0000 (+0200) Subject: system: can_crossbar fixed and added to device tree, updated vivado script X-Git-Url: http://rtime.felk.cvut.cz/gitweb/fpga/zynq/canbench-sw.git/commitdiff_plain/570de39169ecb20f86b073152234c55dc14d3787 system: can_crossbar fixed and added to device tree, updated vivado script --- diff --git a/petalinux/subsystems/linux/configs/device-tree/system-top.dts b/petalinux/subsystems/linux/configs/device-tree/system-top.dts index d5ab8ba..1ca6dcf 100644 --- a/petalinux/subsystems/linux/configs/device-tree/system-top.dts +++ b/petalinux/subsystems/linux/configs/device-tree/system-top.dts @@ -18,3 +18,7 @@ interrupts = <0 30 4>; reg-io-width = <4>; }; + +&can_crossbar_0 { + compatible = "can-crossbar"; +}; diff --git a/petalinux/subsystems/linux/configs/kernel/config b/petalinux/subsystems/linux/configs/kernel/config index d853ee6..3a9bf3e 100644 --- a/petalinux/subsystems/linux/configs/kernel/config +++ b/petalinux/subsystems/linux/configs/kernel/config @@ -61,6 +61,7 @@ CONFIG_IRQ_DOMAIN=y CONFIG_IRQ_DOMAIN_HIERARCHY=y CONFIG_GENERIC_MSI_IRQ=y CONFIG_HANDLE_DOMAIN_IRQ=y +# CONFIG_IRQ_DOMAIN_DEBUG is not set CONFIG_IRQ_FORCED_THREADING=y CONFIG_SPARSE_IRQ=y CONFIG_GENERIC_CLOCKEVENTS=y @@ -209,6 +210,7 @@ CONFIG_OLD_SIGACTION=y # # GCOV-based kernel profiling # +# CONFIG_GCOV_KERNEL is not set CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y CONFIG_HAVE_GENERIC_DMA_COHERENT=y CONFIG_SLABINFO=y @@ -451,13 +453,13 @@ CONFIG_ARCH_NR_GPIO=1024 CONFIG_PREEMPT=y CONFIG_PREEMPT_COUNT=y CONFIG_HZ_FIXED=0 -CONFIG_HZ_100=y +# CONFIG_HZ_100 is not set # CONFIG_HZ_200 is not set # CONFIG_HZ_250 is not set # CONFIG_HZ_300 is not set # CONFIG_HZ_500 is not set -# CONFIG_HZ_1000 is not set -CONFIG_HZ=100 +CONFIG_HZ_1000=y +CONFIG_HZ=1000 CONFIG_SCHED_HRTICK=y # CONFIG_THUMB2_KERNEL is not set CONFIG_AEABI=y @@ -945,9 +947,10 @@ CONFIG_OF=y # # Device Tree and Open Firmware support # -# CONFIG_OF_UNITTEST is not set +CONFIG_OF_UNITTEST=y CONFIG_OF_FLATTREE=y CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_DYNAMIC=y CONFIG_OF_ADDRESS=y CONFIG_OF_ADDRESS_PCI=y CONFIG_OF_IRQ=y @@ -957,7 +960,8 @@ CONFIG_OF_PCI=y CONFIG_OF_PCI_IRQ=y CONFIG_OF_MTD=y CONFIG_OF_RESERVED_MEM=y -# CONFIG_OF_OVERLAY is not set +CONFIG_OF_RESOLVE=y +CONFIG_OF_OVERLAY=y CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y # CONFIG_PARPORT is not set CONFIG_BLK_DEV=y @@ -2825,6 +2829,7 @@ CONFIG_USB_ULPI_VIEWPORT=y CONFIG_USB_GADGET=y # CONFIG_USB_GADGET_DEBUG is not set # CONFIG_USB_GADGET_DEBUG_FILES is not set +# CONFIG_USB_GADGET_DEBUG_FS is not set CONFIG_USB_GADGET_VBUS_DRAW=2 CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 @@ -3102,7 +3107,7 @@ CONFIG_DMA_OF=y # CONFIG_AUXDISPLAY is not set CONFIG_UIO=y # CONFIG_UIO_CIF is not set -CONFIG_UIO_PDRV_GENIRQ=y +CONFIG_UIO_PDRV_GENIRQ=m # CONFIG_UIO_DMEM_GENIRQ is not set # CONFIG_UIO_AEC is not set # CONFIG_UIO_SERCOS3 is not set @@ -3591,6 +3596,7 @@ CONFIG_NLS_ISO8859_1=y # CONFIG_PRINTK_TIME is not set CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 # CONFIG_BOOT_PRINTK_DELAY is not set +CONFIG_DYNAMIC_DEBUG=y # # Compile-time checks and compiler options @@ -3603,7 +3609,7 @@ CONFIG_FRAME_WARN=1024 # CONFIG_READABLE_ASM is not set # CONFIG_UNUSED_SYMBOLS is not set # CONFIG_PAGE_OWNER is not set -# CONFIG_DEBUG_FS is not set +CONFIG_DEBUG_FS=y # CONFIG_HEADERS_CHECK is not set # CONFIG_DEBUG_SECTION_MISMATCH is not set # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set @@ -3685,6 +3691,7 @@ CONFIG_TRACING_SUPPORT=y # # Runtime Testing # +# CONFIG_LKDTM is not set # CONFIG_TEST_LIST_SORT is not set # CONFIG_BACKTRACE_SELF_TEST is not set # CONFIG_RBTREE_TEST is not set diff --git a/system/ip/can_crossbar_1.0/component.xml b/system/ip/can_crossbar_1.0/component.xml index 95b512e..65cef99 100644 --- a/system/ip/can_crossbar_1.0/component.xml +++ b/system/ip/can_crossbar_1.0/component.xml @@ -266,7 +266,7 @@ viewChecksum - f744e7b0 + 77f2c99d @@ -282,7 +282,7 @@ viewChecksum - f744e7b0 + 77f2c99d @@ -1026,8 +1026,8 @@ AXI_Peripheral can_crossbar_v1.0 - 4 - 2016-05-12T18:37:17Z + 6 + 2016-05-15T12:24:39Z /home/martin/projects/cvut/bakalarka/canbench-sw/system/ip/can_crossbar_1.0 @@ -1036,7 +1036,7 @@ 2016.1 - + diff --git a/system/ip/can_crossbar_1.0/hdl/can_crossbar_v1_0_S00_AXI.v b/system/ip/can_crossbar_1.0/hdl/can_crossbar_v1_0_S00_AXI.v index 9a384bc..980d428 100644 --- a/system/ip/can_crossbar_1.0/hdl/can_crossbar_v1_0_S00_AXI.v +++ b/system/ip/can_crossbar_1.0/hdl/can_crossbar_v1_0_S00_AXI.v @@ -26,75 +26,41 @@ assign {ifc4_line, ifc3_line, ifc2_line, ifc1_line} = ctrl_word[15:8]; assign can_en = ctrl_word[20:16]; assign can_stby = ctrl_word[21]; +wire [3:0] can_line_rx; wire [3:0] line_rx; wire [3:0] line_tx; -/* -assign ifc_rx[0] = (ifc1_line == 0 ? line_rx[0] : 1'b1) - & (ifc1_line == 1 ? line_rx[1] : 1'b1) - & (ifc1_line == 2 ? line_rx[2] : 1'b1) - & (ifc1_line == 3 ? line_rx[3] : 1'b1); -assign ifc_rx[1] = (ifc2_line == 0 ? line_rx[0] : 1'b1) - & (ifc2_line == 1 ? line_rx[1] : 1'b1) - & (ifc2_line == 2 ? line_rx[2] : 1'b1) - & (ifc2_line == 3 ? line_rx[3] : 1'b1); -assign ifc_rx[2] = (ifc3_line == 0 ? line_rx[0] : 1'b1) - & (ifc3_line == 1 ? line_rx[1] : 1'b1) - & (ifc3_line == 2 ? line_rx[2] : 1'b1) - & (ifc3_line == 3 ? line_rx[3] : 1'b1); -assign ifc_rx[3] = (ifc4_line == 0 ? line_rx[0] : 1'b1) - & (ifc4_line == 1 ? line_rx[1] : 1'b1) - & (ifc4_line == 2 ? line_rx[2] : 1'b1) - & (ifc4_line == 3 ? line_rx[3] : 1'b1); -*/ assign ifc_rx[0] = line_rx[ifc1_line]; assign ifc_rx[1] = line_rx[ifc2_line]; assign ifc_rx[2] = line_rx[ifc3_line]; assign ifc_rx[3] = line_rx[ifc4_line]; -assign line_rx[0] = ~can_en[0] ? 1'b1 : +assign can_line_rx[0] = (can1_line == 0 ? can_rx[0] : 1'b1) & (can2_line == 0 ? can_rx[1] : 1'b1) & (can3_line == 0 ? can_rx[2] : 1'b1) & (can4_line == 0 ? can_rx[3] : 1'b1); -assign line_rx[1] = ~can_en[1] ? 1'b1 : +assign can_line_rx[1] = (can1_line == 1 ? can_rx[0] : 1'b1) & (can2_line == 1 ? can_rx[1] : 1'b1) & (can3_line == 1 ? can_rx[2] : 1'b1) & (can4_line == 1 ? can_rx[3] : 1'b1); -assign line_rx[2] = ~can_en[2] ? 1'b1 : +assign can_line_rx[2] = (can1_line == 2 ? can_rx[0] : 1'b1) & (can2_line == 2 ? can_rx[1] : 1'b1) & (can3_line == 2 ? can_rx[2] : 1'b1) & (can4_line == 2 ? can_rx[3] : 1'b1); -assign line_rx[3] = ~can_en[3] ? 1'b1 : +assign can_line_rx[3] = (can1_line == 3 ? can_rx[0] : 1'b1) & (can2_line == 3 ? can_rx[1] : 1'b1) & (can3_line == 3 ? can_rx[2] : 1'b1) & (can4_line == 3 ? can_rx[3] : 1'b1); -/* -assign can_tx[0] = ~can_en[0] ? 1'b1 : - (can1_line == 0 ? line_tx[0] : 1'b1) - & (can1_line == 1 ? line_tx[1] : 1'b1) - & (can1_line == 2 ? line_tx[2] : 1'b1) - & (can1_line == 3 ? line_tx[3] : 1'b1); -assign can_tx[1] = ~can_en[1] ? 1'b1 : - (can2_line == 0 ? line_tx[0] : 1'b1) - & (can2_line == 1 ? line_tx[1] : 1'b1) - & (can2_line == 2 ? line_tx[2] : 1'b1) - & (can2_line == 3 ? line_tx[3] : 1'b1); -assign can_tx[2] = ~can_en[2] ? 1'b1 : - (can3_line == 0 ? line_tx[0] : 1'b1) - & (can3_line == 1 ? line_tx[1] : 1'b1) - & (can3_line == 2 ? line_tx[2] : 1'b1) - & (can3_line == 3 ? line_tx[3] : 1'b1); -assign can_tx[3] = ~can_en[3] ? 1'b1 : - (can4_line == 0 ? line_tx[0] : 1'b1) - & (can4_line == 1 ? line_tx[1] : 1'b1) - & (can4_line == 2 ? line_tx[2] : 1'b1) - & (can4_line == 3 ? line_tx[3] : 1'b1); -*/ +assign line_rx[0] = can_en[0] ? can_line_rx[0] : line_tx[0]; +assign line_rx[1] = can_en[1] ? can_line_rx[1] : line_tx[1]; +assign line_rx[2] = can_en[2] ? can_line_rx[2] : line_tx[2]; +assign line_rx[3] = can_en[3] ? can_line_rx[3] : line_tx[3]; + assign can_tx[0] = can_en[0] ? line_tx[can1_line] : 1'b1; assign can_tx[1] = can_en[1] ? line_tx[can2_line] : 1'b1; assign can_tx[2] = can_en[2] ? line_tx[can3_line] : 1'b1; @@ -228,7 +194,7 @@ endmodule //-- Number of Slave Registers 4 reg [C_S_AXI_DATA_WIDTH-1:0] slv_reg0; reg [C_S_AXI_DATA_WIDTH-1:0] slv_reg1; - reg [C_S_AXI_DATA_WIDTH-1:0] slv_reg2; + wire [C_S_AXI_DATA_WIDTH-1:0] slv_reg2; reg [C_S_AXI_DATA_WIDTH-1:0] slv_reg3; wire slv_reg_rden; wire slv_reg_wren; @@ -336,7 +302,7 @@ endmodule begin slv_reg0 <= 32'b0_1111_11_10_01_00_11_10_01_00; slv_reg1 <= 0; - slv_reg2 <= 0; + //slv_reg2 <= 0; slv_reg3 <= 0; end else begin @@ -357,13 +323,13 @@ endmodule // Slave register 1 slv_reg1[(byte_index*8) +: 8] <= S_AXI_WDATA[(byte_index*8) +: 8]; end - 2'h2: + /*2'h2: for ( byte_index = 0; byte_index <= (C_S_AXI_DATA_WIDTH/8)-1; byte_index = byte_index+1 ) if ( S_AXI_WSTRB[byte_index] == 1 ) begin // Respective byte enables are asserted as per write strobes // Slave register 2 slv_reg2[(byte_index*8) +: 8] <= S_AXI_WDATA[(byte_index*8) +: 8]; - end + end */ 2'h3: for ( byte_index = 0; byte_index <= (C_S_AXI_DATA_WIDTH/8)-1; byte_index = byte_index+1 ) if ( S_AXI_WSTRB[byte_index] == 1 ) begin @@ -374,7 +340,7 @@ endmodule default : begin slv_reg0 <= slv_reg0; slv_reg1 <= slv_reg1; - slv_reg2 <= slv_reg2; + //slv_reg2 <= slv_reg2; slv_reg3 <= slv_reg3; end endcase @@ -521,6 +487,22 @@ endmodule .can_stby(can_stby), .ctrl_word(slv_reg0) ); + + wire [3:0] test_can_rx; + wire [3:0] test_can_tx; + wire [3:0] test_ifc_rx; + wire [3:0] test_ifc_tx; + assign {test_can_rx, test_ifc_tx} = slv_reg1[7:0]; + assign slv_reg2 = {24'h0, test_ifc_rx, test_can_tx}; + cross_impl #() cross_test_inst + ( + .can_rx(test_can_rx), + .can_tx(test_can_tx), + .ifc_rx(test_ifc_rx), + .ifc_tx(test_ifc_tx), + .can_stby(), + .ctrl_word(slv_reg0) + ); // User logic ends endmodule diff --git a/system/script/recreate.tcl b/system/script/recreate.tcl index 32ad4f4..ad39c41 100644 --- a/system/script/recreate.tcl +++ b/system/script/recreate.tcl @@ -76,7 +76,8 @@ if {[string equal [get_filesets -quiet sources_1] ""]} { # Set IP repository paths set obj [get_filesets sources_1] -set_property "ip_repo_paths" "[file normalize "$origin_dir/../ip/sja1000_1.0"] [file normalize "$origin_dir/../ip/sja1000_1.0"] [file normalize "$origin_dir/../ip/can_merge"] [file normalize "$origin_dir/../ip/canbench_cc_gpio"]" $obj +#set_property "ip_repo_paths" "[file normalize "$origin_dir/../ip/sja1000_1.0"] [file normalize "$origin_dir/../ip/can_crossbar_1.0"] [file normalize "$origin_dir/../ip/can_merge"] [file normalize "$origin_dir/../ip/canbench_cc_gpio"]" $obj +set_property "ip_repo_paths" "[file normalize "$origin_dir/../ip"]" $obj # Rebuild user ip_repo's index before adding any source files update_ip_catalog -rebuild diff --git a/system/src/top/top.bd b/system/src/top/top.bd index 3887d58..2628992 100644 --- a/system/src/top/top.bd +++ b/system/src/top/top.bd @@ -469,13 +469,6 @@ top_rst_processing_system7_0_100M_0 - - axi_test_0 - - - top_axi_test_0_0 - - xlconcat_0 @@ -500,10 +493,10 @@ - can_merge_0 - + can_crossbar_0 + - top_can_merge_0_0 + top_can_crossbar_0_0 @@ -518,16 +511,16 @@ - - processing_system7_0_axi_periph_M01_AXI - - - processing_system7_0_axi_periph_M03_AXI + + processing_system7_0_axi_periph_M02_AXI + + + @@ -535,7 +528,6 @@ - @@ -546,6 +538,7 @@ + processing_system7_0_FCLK_RESET0_N @@ -555,7 +548,6 @@ rst_processing_system7_0_100M_peripheral_aresetn - @@ -563,6 +555,7 @@ + rst_processing_system7_0_100M_interconnect_aresetn @@ -612,30 +605,87 @@ processing_system7_0_CAN0_PHY_TX - - - - can_merge_0_can_rx - - - - - + processing_system7_0_CAN1_PHY_TX - + sja1000_0_can_tx - + sja1000_1_can_tx - + + + + can_crossbar_0_ifc4_rx + + + + + can_crossbar_0_ifc3_rx + + + + + can_crossbar_0_ifc2_rx + + + + + can_crossbar_0_ifc1_rx + + + + + can_crossbar_0_can4_tx + + + + + can_crossbar_0_can3_tx + + + + + can_crossbar_0_can2_tx + + + + + can_crossbar_0_can1_tx + + + + + can_crossbar_0_can_stby + + + + + CAN1_RXD_1 + + + + + CAN2_RXD_1 + + + + + CAN3_RXD_1 + + + + + CAN4_RXD_1 + + @@ -2251,12 +2301,6 @@ 4G 32 - - SEG_axi_test_0_S00_AXI_reg - /axi_test_0/S00_AXI/S00_AXI_reg - 0x43C10000 - 4K - SEG_sja1000_0_S00_AXI_reg /sja1000_0/S00_AXI/S00_AXI_reg @@ -2269,6 +2313,12 @@ 0x43C30000 4K + + SEG_can_crossbar_0_S00_AXI_reg + /can_crossbar_0/S00_AXI/S00_AXI_reg + 0x43C20000 + 4K +