Skip to content

Commit

Permalink
skidbuffer + lfsr finally working in the fpga
Browse files Browse the repository at this point in the history
  • Loading branch information
amamory committed Aug 9, 2020
1 parent cb57847 commit fae3d81
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 41 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
export VIVADO=/home/lsa/xilinx/2018.2/Vivado/2018.2/bin/vivado
export VIVADO_DESIGN_NAME=skid_testing
export VIVADO_TOP_NAME=${VIVADO_DESIGN_NAME}_wrapper
export XIL_APP_NAME=dma_test
export XIL_APP_NAME=dma_int_test

if [ -f $VIVADO ]; then
echo "###################################"
Expand Down
24 changes: 9 additions & 15 deletions hw/bd/design_1.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ set bCheckIPsPassed 1
set bCheckIPs 1
if { $bCheckIPs == 1 } {
set list_check_ips "\
user.org:user:skidbuffer:1.0\
user.org:user:skidbuffer_lfsr:1.0\
xilinx.com:ip:system_ila:1.1\
xilinx.com:ip:axi_dma:7.1\
xilinx.com:ip:smartconnect:1.0\
Expand Down Expand Up @@ -1010,16 +1010,13 @@ proc create_root_design { parentCell } {

# Create ports

# Create instance: skidbuffer_0, and set properties
set skidbuffer_0 [ create_bd_cell -type ip -vlnv user.org:user:skidbuffer:1.0 skidbuffer_0 ]
set_property -dict [ list \
CONFIG.DW {32} \
] $skidbuffer_0
# Create instance: skidbuffer_lfsr_0, and set properties
set skidbuffer_lfsr_0 [ create_bd_cell -type ip -vlnv user.org:user:skidbuffer_lfsr:1.0 skidbuffer_lfsr_0 ]

# Create instance: system_ila_0, and set properties
set system_ila_0 [ create_bd_cell -type ip -vlnv xilinx.com:ip:system_ila:1.1 system_ila_0 ]
set_property -dict [ list \
CONFIG.C_BRAM_CNT {1} \
CONFIG.C_BRAM_CNT {6} \
CONFIG.C_MON_TYPE {MIX} \
CONFIG.C_NUM_MONITOR_SLOTS {2} \
CONFIG.C_PROBE0_WIDTH {2} \
Expand All @@ -1038,23 +1035,20 @@ proc create_root_design { parentCell } {
create_hier_cell_zynq [current_bd_instance .] zynq

# Create interface connections
connect_bd_intf_net -intf_net skidbuffer_0_m [get_bd_intf_pins skidbuffer_0/m] [get_bd_intf_pins zynq/S_AXIS_DMA]
connect_bd_intf_net -intf_net [get_bd_intf_nets skidbuffer_0_m] [get_bd_intf_pins system_ila_0/SLOT_1_AXIS] [get_bd_intf_pins zynq/S_AXIS_DMA]
set_property -dict [ list \
HDL_ATTRIBUTE.DEBUG {true} \
] [get_bd_intf_nets skidbuffer_0_m]
connect_bd_intf_net -intf_net S_AXIS_DMA_1 [get_bd_intf_pins skidbuffer_lfsr_0/m] [get_bd_intf_pins zynq/S_AXIS_DMA]
connect_bd_intf_net -intf_net [get_bd_intf_nets S_AXIS_DMA_1] [get_bd_intf_pins system_ila_0/SLOT_1_AXIS] [get_bd_intf_pins zynq/S_AXIS_DMA]
connect_bd_intf_net -intf_net zynq_DDR [get_bd_intf_ports DDR] [get_bd_intf_pins zynq/DDR]
connect_bd_intf_net -intf_net zynq_FIXED_IO [get_bd_intf_ports FIXED_IO] [get_bd_intf_pins zynq/FIXED_IO]
connect_bd_intf_net -intf_net zynq_M_AXIS_DMA [get_bd_intf_pins skidbuffer_0/s] [get_bd_intf_pins zynq/M_AXIS_DMA]
connect_bd_intf_net -intf_net zynq_M_AXIS_DMA [get_bd_intf_pins skidbuffer_lfsr_0/s] [get_bd_intf_pins zynq/M_AXIS_DMA]
connect_bd_intf_net -intf_net [get_bd_intf_nets zynq_M_AXIS_DMA] [get_bd_intf_pins system_ila_0/SLOT_0_AXIS] [get_bd_intf_pins zynq/M_AXIS_DMA]
set_property -dict [ list \
HDL_ATTRIBUTE.DEBUG {true} \
] [get_bd_intf_nets zynq_M_AXIS_DMA]

# Create port connections
connect_bd_net -net zynq_clock [get_bd_pins skidbuffer_0/clock] [get_bd_pins system_ila_0/clk] [get_bd_pins zynq/clock]
connect_bd_net -net zynq_clock [get_bd_pins skidbuffer_lfsr_0/clock] [get_bd_pins system_ila_0/clk] [get_bd_pins zynq/clock]
connect_bd_net -net zynq_irq [get_bd_pins system_ila_0/probe0] [get_bd_pins zynq/irq]
connect_bd_net -net zynq_reset_n [get_bd_pins skidbuffer_0/reset_n] [get_bd_pins system_ila_0/resetn] [get_bd_pins zynq/reset_n]
connect_bd_net -net zynq_reset_n [get_bd_pins skidbuffer_lfsr_0/reset_n] [get_bd_pins system_ila_0/resetn] [get_bd_pins zynq/reset_n]

# Create address segments
create_bd_addr_seg -range 0x20000000 -offset 0x00000000 [get_bd_addr_spaces zynq/axi_dma_0/Data_MM2S] [get_bd_addr_segs zynq/processing_system7_0/S_AXI_HP0/HP0_DDR_LOWOCM] SEG_processing_system7_0_HP0_DDR_LOWOCM
Expand Down
40 changes: 16 additions & 24 deletions src/dma_int_test/dma_int_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

//#include "platform.h"

// Hermes packet size, including the flits for header and size
#define PACKET_SIZE 6
// the size of the data burst
#define PACKET_SIZE 400

// PS is receiving from the device
#define RX_INTR_ID XPAR_FABRIC_ZYNQ_AXI_DMA_0_MM2S_INTROUT_INTR
Expand All @@ -27,10 +27,8 @@ XScuGic IntcInstance;
XAxiDma myDma;

// data buffers
//u32 hermes_pkg[] = {0x00000101,0x0002,0x0001,0x0002};
u32 hermes_pkg[] = {0x00000001, 0x00000004, 0x00000000, 0x44444444, 0x55555555, 0x66666666};

u32 hermes_pkg_in[10] = {0};
u32 hermes_pkg[PACKET_SIZE];
u32 hermes_pkg_in[PACKET_SIZE];

// Flags interrupt handlers use to notify the application context the events.
volatile int TxDone;
Expand Down Expand Up @@ -102,16 +100,12 @@ int main(){
XAxiDma_IntrEnable(&myDma, XAXIDMA_IRQ_IOC_MASK, XAXIDMA_DEVICE_TO_DMA);

// =======================================
// Running DMA self test
// fill vector with data
// =======================================
/*
status = XAxiDma_Selftest(&myDma);
if (status != XST_SUCCESS) {
xil_printf("Self-test failed !\r\n");
return XST_FAILURE;
for (int i = 0; i < PACKET_SIZE;i++){
hermes_pkg[i] = i;
}
xil_printf("Self-test passed !!!\r\n");
*/

// =======================================
// Send data
// =======================================
Expand Down Expand Up @@ -151,7 +145,7 @@ int main(){

xil_printf("Checking data ... ");
Xil_DCacheInvalidateRange((UINTPTR)hermes_pkg_in, PACKET_SIZE*sizeof(int));

/*
if (memcmp(hermes_pkg,hermes_pkg_in,PACKET_SIZE*sizeof(int))==0){
xil_printf("packets matched !!!\n");
}else{
Expand All @@ -161,25 +155,23 @@ int main(){
}
}
xil_printf("--- Exiting main() --- \r\n");
/*
*/

// checking the header
int cmp=1;
cmp &= hermes_pkg[0] == hermes_pkg_in[2] ? 1 : 0;
cmp &= hermes_pkg[1] == hermes_pkg_in[1] ? 1 : 0;
cmp &= hermes_pkg[2] == hermes_pkg_in[0] ? 1 : 0;
// cheking the payload
for (int i =3; i<PACKET_SIZE; i++){
cmp &= (hermes_pkg[i]+1) == hermes_pkg_in[i] ? 1 : 0;
// checking the payload
for (int i =0; i<PACKET_SIZE; i++){
cmp &= (hermes_pkg_in[i]) == i ? 1 : 0;
}
if (cmp==1){
xil_printf("packets matched !!!\n");
}else{
xil_printf("packets do not matched !!!\n");
for (int i =0; i<PACKET_SIZE; i++){
xil_printf("sent [%x] and received [%x]\n", hermes_pkg[i],hermes_pkg_in[i]);
xil_printf("[%x] x [%x]\n", hermes_pkg[i],hermes_pkg_in[i]);
}
}
*/

return XST_SUCCESS;

}
Expand Down

0 comments on commit fae3d81

Please sign in to comment.